diff --git a/src/components/playback/playbackmanager.js b/src/components/playback/playbackmanager.js index c11e176df31..54541337a18 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'); 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 EnableDirectPlay: false, - EnableDirectStream: false, - AllowVideoStreamCopy: false, + EnableDirectStream: tryVideoStreamCopy, + AllowVideoStreamCopy: tryVideoStreamCopy, AllowAudioStreamCopy: currentlyPreventsAudioStreamCopy || currentlyPreventsVideoStreamCopy ? false : null }); diff --git a/src/utils/mediaSource.ts b/src/utils/mediaSource.ts index ef196db60f5..5b11ee39674 100644 --- a/src/utils/mediaSource.ts +++ b/src/utils/mediaSource.ts @@ -6,6 +6,6 @@ import type { MediaSourceInfo } from '@jellyfin/sdk/lib/generated-client'; * @returns _true_ if the media source is an HLS stream, _false_ otherwise. */ export function isHls(mediaSource: MediaSourceInfo|null|undefined): boolean { - const protocol = mediaSource?.TranscodingSubProtocol || mediaSource?.Container; - return protocol?.toUpperCase() === 'HLS'; + return mediaSource?.TranscodingSubProtocol?.toUpperCase() === 'HLS' + || mediaSource?.Container?.toUpperCase() === 'HLS'; }