mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
chore: use specific method for checking track
This commit is contained in:
parent
e871300265
commit
e01124cbca
1 changed files with 8 additions and 10 deletions
|
@ -670,6 +670,10 @@ function tryRemoveElement(elem) {
|
||||||
return this.#currentTrackOffset;
|
return this.#currentTrackOffset;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
isPrimaryTrack(textTrackIndex) {
|
||||||
|
return textTrackIndex === this._PRIMARY_TEXT_TRACK_INDEX;
|
||||||
|
}
|
||||||
|
|
||||||
isSecondaryTrack(textTrackIndex) {
|
isSecondaryTrack(textTrackIndex) {
|
||||||
return textTrackIndex === this._SECONDARY_TEXT_TRACK_INDEX;
|
return textTrackIndex === this._SECONDARY_TEXT_TRACK_INDEX;
|
||||||
}
|
}
|
||||||
|
@ -1050,15 +1054,12 @@ function tryRemoveElement(elem) {
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
destroyCustomRenderedTrackElements(targetTrackIndex) {
|
destroyCustomRenderedTrackElements(targetTrackIndex) {
|
||||||
const destroyPrimaryTrack = targetTrackIndex === this._PRIMARY_TEXT_TRACK_INDEX;
|
if (this.isPrimaryTrack(targetTrackIndex)) {
|
||||||
const destroySecondaryTrack = targetTrackIndex === this._SECONDARY_TEXT_TRACK_INDEX;
|
|
||||||
|
|
||||||
if (destroyPrimaryTrack) {
|
|
||||||
if (this.#videoSubtitlesElem) {
|
if (this.#videoSubtitlesElem) {
|
||||||
tryRemoveElement(this.#videoSubtitlesElem);
|
tryRemoveElement(this.#videoSubtitlesElem);
|
||||||
this.#videoSubtitlesElem = null;
|
this.#videoSubtitlesElem = null;
|
||||||
}
|
}
|
||||||
} else if (destroySecondaryTrack) {
|
} else if (this.isSecondaryTrack(targetTrackIndex)) {
|
||||||
if (this.#videoSecondarySubtitlesElem) {
|
if (this.#videoSecondarySubtitlesElem) {
|
||||||
tryRemoveElement(this.#videoSecondarySubtitlesElem);
|
tryRemoveElement(this.#videoSecondarySubtitlesElem);
|
||||||
this.#videoSecondarySubtitlesElem = null;
|
this.#videoSecondarySubtitlesElem = null;
|
||||||
|
@ -1099,13 +1100,10 @@ function tryRemoveElement(elem) {
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
destroyStoredTrackInfo(targetTrackIndex) {
|
destroyStoredTrackInfo(targetTrackIndex) {
|
||||||
const destroyPrimaryTrack = targetTrackIndex === this._PRIMARY_TEXT_TRACK_INDEX;
|
if (this.isPrimaryTrack(targetTrackIndex)) {
|
||||||
const destroySecondaryTrack = targetTrackIndex === this._SECONDARY_TEXT_TRACK_INDEX;
|
|
||||||
|
|
||||||
if (destroyPrimaryTrack) {
|
|
||||||
this.#customTrackIndex = -1;
|
this.#customTrackIndex = -1;
|
||||||
this.#currentTrackEvents = null;
|
this.#currentTrackEvents = null;
|
||||||
} else if (destroySecondaryTrack) {
|
} else if (this.isSecondaryTrack(targetTrackIndex)) {
|
||||||
this.#customSecondaryTrackIndex = -1;
|
this.#customSecondaryTrackIndex = -1;
|
||||||
this.#currentSecondaryTrackEvents = null;
|
this.#currentSecondaryTrackEvents = null;
|
||||||
} else { // destroy all
|
} else { // destroy all
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue