Skip to content

Commit

Permalink
Default to original version if playlist fetch gives issues + log error
Browse files Browse the repository at this point in the history
  • Loading branch information
miko committed Jan 15, 2025
1 parent c4af5ba commit df3b660
Showing 1 changed file with 12 additions and 1 deletion.
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

0 comments on commit df3b660

Please sign in to comment.