Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Default to original version if playlist fetch gives issues + log error #3210

Merged
merged 1 commit into from
Jan 15, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion ui/component/viewers/videoViewer/internal/videojs.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ import videojs from 'video.js';
import { useIsMobile } from 'effects/use-screensize';
import { platform } from 'util/platform';
import Lbry from 'lbry';
import { Lbryio } from 'lbryinc';

import { getStripeEnvironment } from 'util/stripe';
const stripeEnvironment = getStripeEnvironment();
Expand Down Expand Up @@ -481,14 +482,24 @@ export default React.memo<Props>(function VideoJs(props: Props) {
trimmedUrl = trimmedUrl.toString();

// change to m3u8 if applicable
if (response && response.redirected && response.url && trimmedUrl.endsWith('m3u8')) {
if (response && response.redirected && response.url && trimmedUrl.endsWith('m3u8') && response.status < 400) {
vjsPlayer.claimSrcVhs = { type: HLS_FILETYPE, src: response.url };
vjsPlayer.src(vjsPlayer.claimSrcVhs);

contentUrl = response.url;
} else {
if (source) vjsPlayer.src(vjsPlayer.claimSrcOriginal);
}

// Log possible errors
if (response.status >= 400) {
Lbryio.call('event', 'desktop_error', {
error_message: `PlayerSourceLoadError: Url: ${response.url}
| Redirected: ${String(response.redirected)}
| Status: ${response.status}
| Body: ${typeof response.body === 'string' ? response.body : 'Body not string'}`,
});
}
}

doSetVideoSourceLoaded(uri);
Expand Down
Loading