From 20e29b81b5f76cf694d52b38bea2d2b06cb9996a Mon Sep 17 00:00:00 2001 From: gnattu Date: Tue, 28 May 2024 05:45:29 +0800 Subject: [PATCH] Always try transcode as last resort --- src/components/playback/playbackmanager.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/components/playback/playbackmanager.js b/src/components/playback/playbackmanager.js index 819abfee79..666034e6fd 100644 --- a/src/components/playback/playbackmanager.js +++ b/src/components/playback/playbackmanager.js @@ -3296,18 +3296,21 @@ class PlaybackManager { const streamInfo = error.streamInfo || getPlayerData(player).streamInfo; if (streamInfo?.url) { + const isAlreadyFallbacking = streamInfo.url.toLowerCase().includes('transcodereasons=directplayerror'); const currentlyPreventsVideoStreamCopy = streamInfo.url.toLowerCase().indexOf('allowvideostreamcopy=false') !== -1; const currentlyPreventsAudioStreamCopy = streamInfo.url.toLowerCase().indexOf('allowaudiostreamcopy=false') !== -1; // Auto switch to transcoding if (enablePlaybackRetryWithTranscoding(streamInfo, errorType, currentlyPreventsVideoStreamCopy, currentlyPreventsAudioStreamCopy)) { const startTime = getCurrentTicks(player) || streamInfo.playerStartPositionTicks; + const isRemoteSource = streamInfo.item.LocationType === 'Remote'; + // force transcoding and only allow remuxing for remote source like liveTV, but only for initial trial + const tryVideoStreamCopy = isRemoteSource && !isAlreadyFallbacking; changeStream(player, startTime, { - // force transcoding and only allow remuxing for remote source like liveTV EnableDirectPlay: false, EnableDirectStream: false, - AllowVideoStreamCopy: streamInfo.item.LocationType === 'Remote', + AllowVideoStreamCopy: tryVideoStreamCopy, AllowAudioStreamCopy: currentlyPreventsAudioStreamCopy || currentlyPreventsVideoStreamCopy ? false : null });