diff --git a/ui/component/viewers/videoViewer/internal/videojs.jsx b/ui/component/viewers/videoViewer/internal/videojs.jsx index 754c864df..bf6ca13e6 100644 --- a/ui/component/viewers/videoViewer/internal/videojs.jsx +++ b/ui/component/viewers/videoViewer/internal/videojs.jsx @@ -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(); @@ -481,7 +482,7 @@ export default React.memo(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); @@ -489,6 +490,16 @@ export default React.memo(function VideoJs(props: Props) { } 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);