1
0
Fork 0
mirror of https://github.com/jellyfin/jellyfin-web synced 2025-03-30 19:56:21 +00:00

Merge pull request #5617 from gnattu/relax-remux-requirement-for-remote

Allow VideoStreamCopy for remote source fallback
This commit is contained in:
Bill Thornton 2024-05-30 11:11:57 -04:00 committed by GitHub
commit 40e7dc9007
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 8 additions and 5 deletions

View file

@ -3296,18 +3296,21 @@ class PlaybackManager {
const streamInfo = error.streamInfo || getPlayerData(player).streamInfo; const streamInfo = error.streamInfo || getPlayerData(player).streamInfo;
if (streamInfo?.url) { if (streamInfo?.url) {
const isAlreadyFallbacking = streamInfo.url.toLowerCase().includes('transcodereasons');
const currentlyPreventsVideoStreamCopy = streamInfo.url.toLowerCase().indexOf('allowvideostreamcopy=false') !== -1; const currentlyPreventsVideoStreamCopy = streamInfo.url.toLowerCase().indexOf('allowvideostreamcopy=false') !== -1;
const currentlyPreventsAudioStreamCopy = streamInfo.url.toLowerCase().indexOf('allowaudiostreamcopy=false') !== -1; const currentlyPreventsAudioStreamCopy = streamInfo.url.toLowerCase().indexOf('allowaudiostreamcopy=false') !== -1;
// Auto switch to transcoding // Auto switch to transcoding
if (enablePlaybackRetryWithTranscoding(streamInfo, errorType, currentlyPreventsVideoStreamCopy, currentlyPreventsAudioStreamCopy)) { if (enablePlaybackRetryWithTranscoding(streamInfo, errorType, currentlyPreventsVideoStreamCopy, currentlyPreventsAudioStreamCopy)) {
const startTime = getCurrentTicks(player) || streamInfo.playerStartPositionTicks; 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, { changeStream(player, startTime, {
// force transcoding
EnableDirectPlay: false, EnableDirectPlay: false,
EnableDirectStream: false, EnableDirectStream: tryVideoStreamCopy,
AllowVideoStreamCopy: false, AllowVideoStreamCopy: tryVideoStreamCopy,
AllowAudioStreamCopy: currentlyPreventsAudioStreamCopy || currentlyPreventsVideoStreamCopy ? false : null AllowAudioStreamCopy: currentlyPreventsAudioStreamCopy || currentlyPreventsVideoStreamCopy ? false : null
}); });

View file

@ -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. * @returns _true_ if the media source is an HLS stream, _false_ otherwise.
*/ */
export function isHls(mediaSource: MediaSourceInfo|null|undefined): boolean { export function isHls(mediaSource: MediaSourceInfo|null|undefined): boolean {
const protocol = mediaSource?.TranscodingSubProtocol || mediaSource?.Container; return mediaSource?.TranscodingSubProtocol?.toUpperCase() === 'HLS'
return protocol?.toUpperCase() === 'HLS'; || mediaSource?.Container?.toUpperCase() === 'HLS';
} }