Skip to content

Commit

Permalink
Remove invalid item id usage as media source id
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Kevinjil committed Dec 18, 2024
1 parent 052eb6d commit 3a5efbd
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions src/components/playback/playbackmanager.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
});
Expand Down

0 comments on commit 3a5efbd

Please sign in to comment.