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

fix: update ssa/ass checks, custom track location, offsets

This commit is contained in:
Ivan Schurawel 2022-11-13 20:22:55 -05:00 committed by Ivan Schurawel
parent 49bae6b67c
commit abc663f6f6
4 changed files with 65 additions and 40 deletions

View file

@ -1035,10 +1035,26 @@ import { setBackdropTransparency, TRANSPARENCY_LEVEL } from '../../../components
setTimeout(resetIdle, 0);
}
/**
* Only show option if:
* - player has support
* - has more than 1 subtitle track
* - has valid secondary tracks
* - primary subtitle is not off
* - primary subtitle has support (index + 1 because `'Off'` is index 0 in `streams` array)
*/
function currentTrackCanHaveSecondarySubtitle(player, streams, currentIndex) {
const secondaryStreams = playbackManager.secondarySubtitleTracks(player);
return playbackManager.playerHasSecondarySubtitleSupport(player) &&
streams.length > 1 &&
secondaryStreams.length > 0 &&
currentIndex !== -1 &&
playbackManager.trackHasSecondarySubtitleSupport(streams[currentIndex + 1], player);
}
function showSubtitleTrackSelection() {
const player = currentPlayer;
const streams = playbackManager.subtitleTracks(player);
const secondaryStreams = playbackManager.secondarySubtitleTracks(player);
let currentIndex = playbackManager.getSubtitleStreamIndex(player);
if (currentIndex == null) {
@ -1062,21 +1078,7 @@ import { setBackdropTransparency, TRANSPARENCY_LEVEL } from '../../../components
return opt;
});
/**
* Only show option if:
* - player has support
* - has more than 1 subtitle track
* - has valid secondary tracks
* - primary subtitle is not off
* - primary subtitle is `External`
*/
if (
playbackManager.playerHasSecondarySubtitleSupport(player) &&
streams.length > 1 &&
secondaryStreams.length > 0 &&
currentIndex !== -1 &&
playbackManager.isSubtitleStreamExternal(currentIndex, player)
) {
if (currentTrackCanHaveSecondarySubtitle(player, streams, currentIndex)) {
const secondarySubtitleMenuItem = {
name: globalize.translate('SecondarySubtitles'),
id: 'secondarysubtitle'