From df3b6606121bb21241a8852811d02256040f1bf2 Mon Sep 17 00:00:00 2001 From: miko Date: Wed, 15 Jan 2025 22:17:15 +0200 Subject: [PATCH] Default to original version if playlist fetch gives issues + log error --- .../viewers/videoViewer/internal/videojs.jsx | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/ui/component/viewers/videoViewer/internal/videojs.jsx b/ui/component/viewers/videoViewer/internal/videojs.jsx index 754c864dfd..bf6ca13e64 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);