Skip to content

Commit 8f64bee

Browse files
committed
Remove invalid item id usage as media source id
Looking at the change history, an ` || item.Id` was introduced in 4c31742 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.
1 parent e8e4ff0 commit 8f64bee

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

src/components/playback/playbackmanager.js

+10-8
Original file line numberDiff line numberDiff line change
@@ -2602,16 +2602,11 @@ export class PlaybackManager {
26022602
});
26032603
}
26042604

2605-
const apiClient = ServerConnections.getApiClient(item.ServerId);
2606-
let mediaSourceId;
2605+
let mediaSourceId = playOptions.mediaSourceId;
26072606

2607+
const apiClient = ServerConnections.getApiClient(item.ServerId);
26082608
const isLiveTv = [BaseItemKind.TvChannel, BaseItemKind.LiveTvChannel].includes(item.Type);
2609-
2610-
if (!isLiveTv) {
2611-
mediaSourceId = playOptions.mediaSourceId || item.Id;
2612-
}
2613-
2614-
const getMediaStreams = isLiveTv ? Promise.resolve([]) : apiClient.getItem(apiClient.getCurrentUserId(), mediaSourceId)
2609+
const getMediaStreams = isLiveTv ? Promise.resolve([]) : apiClient.getItem(apiClient.getCurrentUserId(), mediaSourceId || item.Id)
26152610
.then(fullItem => {
26162611
return fullItem.MediaStreams;
26172612
});
@@ -2644,13 +2639,20 @@ export class PlaybackManager {
26442639
playOptions.items = null;
26452640

26462641
const trackOptions = {};
2642+
let isIdFallbackNeeded = false;
26472643

26482644
autoSetNextTracks(prevSource, mediaStreams, trackOptions, user.Configuration.RememberAudioSelections, user.Configuration.RememberSubtitleSelections);
26492645
if (trackOptions.DefaultAudioStreamIndex != null) {
26502646
options.audioStreamIndex = trackOptions.DefaultAudioStreamIndex;
2647+
isIdFallbackNeeded = true;
26512648
}
26522649
if (trackOptions.DefaultSubtitleStreamIndex != null) {
26532650
options.subtitleStreamIndex = trackOptions.DefaultSubtitleStreamIndex;
2651+
isIdFallbackNeeded = true;
2652+
}
2653+
2654+
if (isIdFallbackNeeded) {
2655+
mediaSourceId ||= item.Id;
26542656
}
26552657

26562658
return getPlaybackMediaSource(player, apiClient, deviceProfile, item, mediaSourceId, options).then(async (mediaSource) => {

0 commit comments

Comments
 (0)