diff --git a/src/components/playback/playbackmanager.js b/src/components/playback/playbackmanager.js index c5f5182cc89..64621df1406 100644 --- a/src/components/playback/playbackmanager.js +++ b/src/components/playback/playbackmanager.js @@ -2580,16 +2580,11 @@ export class PlaybackManager { }); } - const apiClient = ServerConnections.getApiClient(item.ServerId); - let mediaSourceId; + let mediaSourceId = playOptions.mediaSourceId; + const apiClient = ServerConnections.getApiClient(item.ServerId); 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; }); @@ -2622,13 +2617,20 @@ export class PlaybackManager { playOptions.items = null; const trackOptions = {}; + let needsTrackWorkaround = false; autoSetNextTracks(prevSource, mediaStreams, trackOptions, user.Configuration.RememberAudioSelections, user.Configuration.RememberSubtitleSelections); if (trackOptions.DefaultAudioStreamIndex != null) { options.audioStreamIndex = trackOptions.DefaultAudioStreamIndex; + needsTrackWorkaround = true; } if (trackOptions.DefaultSubtitleStreamIndex != null) { options.subtitleStreamIndex = trackOptions.DefaultSubtitleStreamIndex; + needsTrackWorkaround = true; + } + + if (needsTrackWorkaround) { + mediaSourceId ||= item.Id; } return getPlaybackMediaSource(player, apiClient, deviceProfile, item, mediaSourceId, options).then(async (mediaSource) => {