1
0
Fork 0
mirror of https://github.com/jellyfin/jellyfin-web synced 2025-03-30 19:56:21 +00:00

Use default subtitle index if set

This commit is contained in:
BakerAO 2024-09-30 11:03:55 -05:00
parent 6c3b6317dc
commit 7c30c2e860

View file

@ -1178,17 +1178,20 @@ export default function (view) {
function autoSelectSubtitleTrack() {
const player = currentPlayer;
const streams = playbackManager.subtitleTracks(player);
const streams = playbackManager.subtitleTracks(player) ?? [];
const currentIndex = playbackManager.getSubtitleStreamIndex(player) ?? -1;
const defaultIndex = player?.streamInfo?.mediaSource?.DefaultSubtitleStreamIndex ?? -1;
if (currentIndex === -1 && streams.length > 0) {
const firstSubtitleIndex = streams[0].Index;
playbackManager.setSubtitleStreamIndex(firstSubtitleIndex, player);
if (defaultIndex > -1) {
playbackManager.setSubtitleStreamIndex(defaultIndex, player);
} else {
const firstSubtitleIndex = streams[0].Index;
playbackManager.setSubtitleStreamIndex(firstSubtitleIndex, player);
}
} else {
playbackManager.setSubtitleStreamIndex(-1, player);
}
toggleSubtitleSync();
}
/**