Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow VideoStreamCopy for remote source fallback #5617

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions src/components/playback/playbackmanager.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
});

Expand Down
4 changes: 2 additions & 2 deletions src/utils/mediaSource.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
}
Loading