Skip to content

Commit

Permalink
Backport pull request #6396 from jellyfin-web/release-10.10.z
Browse files Browse the repository at this point in the history
Remove invalid item id usage as media source id

Original-merge: 4793223

Merged-by: thornbill <thornbill@users.noreply.github.com>

Backported-by: Joshua M. Boniface <joshua@boniface.me>
  • Loading branch information
Kevinjil authored and joshuaboniface committed Feb 3, 2025
1 parent 4eb578b commit aa33101
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions src/components/playback/playbackmanager.js
Original file line number Diff line number Diff line change
Expand Up @@ -2609,16 +2609,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;
});
Expand Down Expand Up @@ -2651,13 +2646,20 @@ export class PlaybackManager {
playOptions.items = null;

const trackOptions = {};
let isIdFallbackNeeded = false;

autoSetNextTracks(prevSource, mediaStreams, trackOptions, user.Configuration.RememberAudioSelections, user.Configuration.RememberSubtitleSelections);
if (trackOptions.DefaultAudioStreamIndex != null) {
options.audioStreamIndex = trackOptions.DefaultAudioStreamIndex;
isIdFallbackNeeded = true;
}
if (trackOptions.DefaultSubtitleStreamIndex != null) {
options.subtitleStreamIndex = trackOptions.DefaultSubtitleStreamIndex;
isIdFallbackNeeded = true;
}

if (isIdFallbackNeeded) {
mediaSourceId ||= item.Id;
}

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

0 comments on commit aa33101

Please sign in to comment.