From 3a5efbd476c6634850311b1851e6e61865cc2443 Mon Sep 17 00:00:00 2001 From: Kevin Jilissen Date: Tue, 17 Dec 2024 22:03:03 +0100 Subject: [PATCH] Remove invalid item id usage as media source id Looking at the change history, an ` || item.Id` was introduced in 4c31742cc50c19702f2c1610c2bcfc0d6c4d210b to query for the item, but this workaround is only needed for track selection in some cases and breaks playback in others. Only apply it when a track is selected. --- src/components/playback/playbackmanager.js | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/src/components/playback/playbackmanager.js b/src/components/playback/playbackmanager.js index c5f5182cc89..7e6c120781b 100644 --- a/src/components/playback/playbackmanager.js +++ b/src/components/playback/playbackmanager.js @@ -2580,16 +2580,15 @@ export class PlaybackManager { }); } - const apiClient = ServerConnections.getApiClient(item.ServerId); - let mediaSourceId; - - const isLiveTv = [BaseItemKind.TvChannel, BaseItemKind.LiveTvChannel].includes(item.Type); - - if (!isLiveTv) { - mediaSourceId = playOptions.mediaSourceId || item.Id; + let mediaSourceId = playOptions.mediaSourceId; + const needsTrackWorkaround = (playOptions.audioStreamIndex || playOptions.subtitleStreamIndex); + if (needsTrackWorkaround) { + mediaSourceId ||= item.Id; } - const getMediaStreams = isLiveTv ? Promise.resolve([]) : apiClient.getItem(apiClient.getCurrentUserId(), mediaSourceId) + const apiClient = ServerConnections.getApiClient(item.ServerId); + const isLiveTv = [BaseItemKind.TvChannel, BaseItemKind.LiveTvChannel].includes(item.Type); + const getMediaStreams = isLiveTv ? Promise.resolve([]) : apiClient.getItem(apiClient.getCurrentUserId(), mediaSourceId || item.Id) .then(fullItem => { return fullItem.MediaStreams; });