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

Next episode has mismatched language between server and ui (rebased) #5998

Closed
Closed
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions CONTRIBUTORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@
- [Connor Smith](https://github.com/ConnorS1110)
- [iFraan](https://github.com/iFraan)
- [Ali](https://github.com/bu3alwa)
- [jmerdich](https://github.com/jmerdich)

## Emby Contributors

Expand Down
23 changes: 23 additions & 0 deletions src/components/playback/playbackmanager.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,13 @@ function normalizeName(t) {
return t.toLowerCase().replace(' ', '');
}

function addOrReplaceUrlParam(url, key, value) {
// eslint-disable-next-line compat/compat
const newurl = new URL(url, window.location);
newurl.searchParams.set(key, value);
return newurl.href;
}

function getItemsForPlayback(serverId, query) {
const apiClient = ServerConnections.getApiClient(serverId);

Expand Down Expand Up @@ -2460,12 +2467,28 @@ class PlaybackManager {
if (streamType == 'Subtitle') {
if (isSecondarySubtitle) {
mediaSource.DefaultSecondarySubtitleStreamIndex = bestStreamIndex;
// Secondary subtitles are client side only, update this if it ever gets transcoding support.
} else {
mediaSource.DefaultSubtitleStreamIndex = bestStreamIndex;
const isHardcodedSubtitle = mediaSource.MediaStreams[bestStreamIndex].DeliveryMethod === 'Transcode';
if (mediaSource.TranscodingUrl) {
mediaSource.TranscodingUrl = addOrReplaceUrlParam(
mediaSource.TranscodingUrl,
'SubtitleStreamIndex',
isHardcodedSubtitle ? mediaSource.DefaultSubtitleStreamIndex.toString() : '-1'
);
}
}
}
if (streamType == 'Audio') {
mediaSource.DefaultAudioStreamIndex = bestStreamIndex;
if (mediaSource.TranscodingUrl) {
mediaSource.TranscodingUrl = addOrReplaceUrlParam(
mediaSource.TranscodingUrl,
'AudioStreamIndex',
mediaSource.DefaultAudioStreamIndex.toString()
);
}
}
} else {
console.debug(`AutoSet ${streamType} - Threshold not met. Using default.`);
Expand Down
Loading