mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
fix: only show secondary if primary sill valid, remove resolveOnClick
This commit is contained in:
parent
e01124cbca
commit
f33699ad8a
2 changed files with 32 additions and 10 deletions
|
@ -1062,8 +1062,21 @@ import { setBackdropTransparency, TRANSPARENCY_LEVEL } from '../../../components
|
||||||
return opt;
|
return opt;
|
||||||
});
|
});
|
||||||
|
|
||||||
// Only show option if: player has support, has more than 1 subtitle track, has valid secondary tracks, primary subtitle is not off
|
/**
|
||||||
if (playbackManager.hasSecondarySubtitleSupport(player) && streams.length > 1 && secondaryStreams.length > 0 && currentIndex !== -1) {
|
* 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.hasSecondarySubtitleSupport(player) &&
|
||||||
|
streams.length > 1 &&
|
||||||
|
secondaryStreams.length > 0 &&
|
||||||
|
currentIndex !== -1 &&
|
||||||
|
playbackManager.isSubtitleStreamExternal(currentIndex, player)
|
||||||
|
) {
|
||||||
const secondarySubtitleMenuItem = {
|
const secondarySubtitleMenuItem = {
|
||||||
name: globalize.translate('SecondarySubtitles'),
|
name: globalize.translate('SecondarySubtitles'),
|
||||||
id: 'secondarysubtitle'
|
id: 'secondarysubtitle'
|
||||||
|
@ -1077,7 +1090,6 @@ import { setBackdropTransparency, TRANSPARENCY_LEVEL } from '../../../components
|
||||||
actionsheet.show({
|
actionsheet.show({
|
||||||
title: globalize.translate('Subtitles'),
|
title: globalize.translate('Subtitles'),
|
||||||
items: menuItems,
|
items: menuItems,
|
||||||
resolveOnClick: true,
|
|
||||||
positionTo: positionTo
|
positionTo: positionTo
|
||||||
}).then(function (id) {
|
}).then(function (id) {
|
||||||
if (id === 'secondarysubtitle') {
|
if (id === 'secondarysubtitle') {
|
||||||
|
|
|
@ -471,15 +471,30 @@ function tryRemoveElement(elem) {
|
||||||
destroyFlvPlayer(this);
|
destroyFlvPlayer(this);
|
||||||
destroyCastPlayer(this);
|
destroyCastPlayer(this);
|
||||||
|
|
||||||
|
let secondaryTrackValid = true;
|
||||||
|
|
||||||
this.#subtitleTrackIndexToSetOnPlaying = options.mediaSource.DefaultSubtitleStreamIndex == null ? -1 : options.mediaSource.DefaultSubtitleStreamIndex;
|
this.#subtitleTrackIndexToSetOnPlaying = options.mediaSource.DefaultSubtitleStreamIndex == null ? -1 : options.mediaSource.DefaultSubtitleStreamIndex;
|
||||||
if (this.#subtitleTrackIndexToSetOnPlaying != null && this.#subtitleTrackIndexToSetOnPlaying >= 0) {
|
if (this.#subtitleTrackIndexToSetOnPlaying != null && this.#subtitleTrackIndexToSetOnPlaying >= 0) {
|
||||||
const initialSubtitleStream = options.mediaSource.MediaStreams[this.#subtitleTrackIndexToSetOnPlaying];
|
const initialSubtitleStream = options.mediaSource.MediaStreams[this.#subtitleTrackIndexToSetOnPlaying];
|
||||||
if (!initialSubtitleStream || initialSubtitleStream.DeliveryMethod === 'Encode') {
|
if (!initialSubtitleStream || initialSubtitleStream.DeliveryMethod === 'Encode') {
|
||||||
this.#subtitleTrackIndexToSetOnPlaying = -1;
|
this.#subtitleTrackIndexToSetOnPlaying = -1;
|
||||||
}
|
}
|
||||||
|
// secondary track should not be shown if primary track is no longer `External` or is not on
|
||||||
|
if (initialSubtitleStream && initialSubtitleStream.DeliveryMethod !== 'External') {
|
||||||
|
secondaryTrackValid = false;
|
||||||
}
|
}
|
||||||
// Continue using the secondary track that has been set during this watch session
|
} else {
|
||||||
const currentSecondaryTrackIndex = playbackManager.getSecondarySubtitleStreamIndex();
|
secondaryTrackValid = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get the secondary track that has been set during this watch session
|
||||||
|
let currentSecondaryTrackIndex = playbackManager.getSecondarySubtitleStreamIndex();
|
||||||
|
|
||||||
|
if (!secondaryTrackValid) {
|
||||||
|
currentSecondaryTrackIndex = -1;
|
||||||
|
playbackManager.setSecondarySubtitleStreamIndex(currentSecondaryTrackIndex);
|
||||||
|
}
|
||||||
|
|
||||||
this.#secondarySubtitleTrackIndexToSetOnPlaying = currentSecondaryTrackIndex == null ? -1 : currentSecondaryTrackIndex;
|
this.#secondarySubtitleTrackIndexToSetOnPlaying = currentSecondaryTrackIndex == null ? -1 : currentSecondaryTrackIndex;
|
||||||
if (this.#secondarySubtitleTrackIndexToSetOnPlaying != null && this.#secondarySubtitleTrackIndexToSetOnPlaying >= 0) {
|
if (this.#secondarySubtitleTrackIndexToSetOnPlaying != null && this.#secondarySubtitleTrackIndexToSetOnPlaying >= 0) {
|
||||||
const initialSecondarySubtitleStream = options.mediaSource.MediaStreams[this.#secondarySubtitleTrackIndexToSetOnPlaying];
|
const initialSecondarySubtitleStream = options.mediaSource.MediaStreams[this.#secondarySubtitleTrackIndexToSetOnPlaying];
|
||||||
|
@ -1118,11 +1133,6 @@ function tryRemoveElement(elem) {
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
destroyCustomTrack(videoElement, targetTrackIndex) {
|
destroyCustomTrack(videoElement, targetTrackIndex) {
|
||||||
if (this.#resizeObserver) {
|
|
||||||
this.#resizeObserver.disconnect();
|
|
||||||
this.#resizeObserver = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
this.destroyCustomRenderedTrackElements(targetTrackIndex);
|
this.destroyCustomRenderedTrackElements(targetTrackIndex);
|
||||||
this.destroyNativeTracks(videoElement, targetTrackIndex);
|
this.destroyNativeTracks(videoElement, targetTrackIndex);
|
||||||
this.destroyStoredTrackInfo(targetTrackIndex);
|
this.destroyStoredTrackInfo(targetTrackIndex);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue