Skip to content

Commit b984b91

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 052eb6d commit b984b91

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

src/components/playback/playbackmanager.js

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2580,16 +2580,11 @@ export class PlaybackManager {
25802580
});
25812581
}
25822582

2583-
const apiClient = ServerConnections.getApiClient(item.ServerId);
2584-
let mediaSourceId;
2583+
let mediaSourceId = playOptions.mediaSourceId;
25852584

2585+
const apiClient = ServerConnections.getApiClient(item.ServerId);
25862586
const isLiveTv = [BaseItemKind.TvChannel, BaseItemKind.LiveTvChannel].includes(item.Type);
2587-
2588-
if (!isLiveTv) {
2589-
mediaSourceId = playOptions.mediaSourceId || item.Id;
2590-
}
2591-
2592-
const getMediaStreams = isLiveTv ? Promise.resolve([]) : apiClient.getItem(apiClient.getCurrentUserId(), mediaSourceId)
2587+
const getMediaStreams = isLiveTv ? Promise.resolve([]) : apiClient.getItem(apiClient.getCurrentUserId(), mediaSourceId || item.Id)
25932588
.then(fullItem => {
25942589
return fullItem.MediaStreams;
25952590
});
@@ -2622,13 +2617,20 @@ export class PlaybackManager {
26222617
playOptions.items = null;
26232618

26242619
const trackOptions = {};
2620+
let needsTrackWorkaround = false;
26252621

26262622
autoSetNextTracks(prevSource, mediaStreams, trackOptions, user.Configuration.RememberAudioSelections, user.Configuration.RememberSubtitleSelections);
26272623
if (trackOptions.DefaultAudioStreamIndex != null) {
26282624
options.audioStreamIndex = trackOptions.DefaultAudioStreamIndex;
2625+
needsTrackWorkaround = true;
26292626
}
26302627
if (trackOptions.DefaultSubtitleStreamIndex != null) {
26312628
options.subtitleStreamIndex = trackOptions.DefaultSubtitleStreamIndex;
2629+
needsTrackWorkaround = true;
2630+
}
2631+
2632+
if (needsTrackWorkaround) {
2633+
mediaSourceId ||= item.Id;
26322634
}
26332635

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

0 commit comments

Comments
 (0)