From aa33101e1dd4b75b4b105e8405f00f872a826315 Mon Sep 17 00:00:00 2001 From: Kevinjil <32480819+Kevinjil@users.noreply.github.com> Date: Mon, 3 Feb 2025 12:29:40 -0500 Subject: [PATCH] Backport pull request #6396 from jellyfin-web/release-10.10.z Remove invalid item id usage as media source id Original-merge: 4793223f5d1235395572b02ed79687beb35d37e4 Merged-by: thornbill Backported-by: Joshua M. Boniface --- src/components/playback/playbackmanager.js | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/components/playback/playbackmanager.js b/src/components/playback/playbackmanager.js index 33d612ad89..de0c50e57d 100644 --- a/src/components/playback/playbackmanager.js +++ b/src/components/playback/playbackmanager.js @@ -2609,16 +2609,11 @@ export class PlaybackManager { }); } + let mediaSourceId = playOptions.mediaSourceId; + const apiClient = ServerConnections.getApiClient(item.ServerId); - let mediaSourceId; - const isLiveTv = [BaseItemKind.TvChannel, BaseItemKind.LiveTvChannel].includes(item.Type); - - if (!isLiveTv) { - mediaSourceId = playOptions.mediaSourceId || item.Id; - } - - const getMediaStreams = isLiveTv ? Promise.resolve([]) : apiClient.getItem(apiClient.getCurrentUserId(), mediaSourceId) + const getMediaStreams = isLiveTv ? Promise.resolve([]) : apiClient.getItem(apiClient.getCurrentUserId(), mediaSourceId || item.Id) .then(fullItem => { return fullItem.MediaStreams; }); @@ -2651,13 +2646,20 @@ export class PlaybackManager { playOptions.items = null; const trackOptions = {}; + let isIdFallbackNeeded = false; autoSetNextTracks(prevSource, mediaStreams, trackOptions, user.Configuration.RememberAudioSelections, user.Configuration.RememberSubtitleSelections); if (trackOptions.DefaultAudioStreamIndex != null) { options.audioStreamIndex = trackOptions.DefaultAudioStreamIndex; + isIdFallbackNeeded = true; } if (trackOptions.DefaultSubtitleStreamIndex != null) { options.subtitleStreamIndex = trackOptions.DefaultSubtitleStreamIndex; + isIdFallbackNeeded = true; + } + + if (isIdFallbackNeeded) { + mediaSourceId ||= item.Id; } return getPlaybackMediaSource(player, apiClient, deviceProfile, item, mediaSourceId, options).then(async (mediaSource) => {