Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove invalid item id usage as media source id #6396

Open
wants to merge 1 commit into
base: release-10.10.z
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 10 additions & 8 deletions src/components/playback/playbackmanager.js
Original file line number Diff line number Diff line change
Expand Up @@ -2603,16 +2603,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 @@ -2645,13 +2640,20 @@ export class PlaybackManager {
playOptions.items = null;

const trackOptions = {};
let needsTrackWorkaround = false;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a minor note, I normally try to prefix boolean variables with is or has... maybe something like isIdFallbackNeeded could work here

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It could possibly make more logical sense to make setting mediaSourceId to be part of autoSetNextTracks (as that's what this is specific to). I'm not sure if I would consider it a workaround anyway since playOptions.mediaSourceId would be filled in when the user manually selects a subtitle or audio track.


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) => {
Expand Down
Loading