chore: use specific method for checking track
This commit is contained in:
committed by
Ivan Schurawel
parent
e871300265
commit
e01124cbca
@@ -670,6 +670,10 @@ function tryRemoveElement(elem) {
|
||||
return this.#currentTrackOffset;
|
||||
}
|
||||
|
||||
isPrimaryTrack(textTrackIndex) {
|
||||
return textTrackIndex === this._PRIMARY_TEXT_TRACK_INDEX;
|
||||
}
|
||||
|
||||
isSecondaryTrack(textTrackIndex) {
|
||||
return textTrackIndex === this._SECONDARY_TEXT_TRACK_INDEX;
|
||||
}
|
||||
@@ -1050,15 +1054,12 @@ function tryRemoveElement(elem) {
|
||||
* @private
|
||||
*/
|
||||
destroyCustomRenderedTrackElements(targetTrackIndex) {
|
||||
const destroyPrimaryTrack = targetTrackIndex === this._PRIMARY_TEXT_TRACK_INDEX;
|
||||
const destroySecondaryTrack = targetTrackIndex === this._SECONDARY_TEXT_TRACK_INDEX;
|
||||
|
||||
if (destroyPrimaryTrack) {
|
||||
if (this.isPrimaryTrack(targetTrackIndex)) {
|
||||
if (this.#videoSubtitlesElem) {
|
||||
tryRemoveElement(this.#videoSubtitlesElem);
|
||||
this.#videoSubtitlesElem = null;
|
||||
}
|
||||
} else if (destroySecondaryTrack) {
|
||||
} else if (this.isSecondaryTrack(targetTrackIndex)) {
|
||||
if (this.#videoSecondarySubtitlesElem) {
|
||||
tryRemoveElement(this.#videoSecondarySubtitlesElem);
|
||||
this.#videoSecondarySubtitlesElem = null;
|
||||
@@ -1099,13 +1100,10 @@ function tryRemoveElement(elem) {
|
||||
* @private
|
||||
*/
|
||||
destroyStoredTrackInfo(targetTrackIndex) {
|
||||
const destroyPrimaryTrack = targetTrackIndex === this._PRIMARY_TEXT_TRACK_INDEX;
|
||||
const destroySecondaryTrack = targetTrackIndex === this._SECONDARY_TEXT_TRACK_INDEX;
|
||||
|
||||
if (destroyPrimaryTrack) {
|
||||
if (this.isPrimaryTrack(targetTrackIndex)) {
|
||||
this.#customTrackIndex = -1;
|
||||
this.#currentTrackEvents = null;
|
||||
} else if (destroySecondaryTrack) {
|
||||
} else if (this.isSecondaryTrack(targetTrackIndex)) {
|
||||
this.#customSecondaryTrackIndex = -1;
|
||||
this.#currentSecondaryTrackEvents = null;
|
||||
} else { // destroy all
|
||||
|
||||
Reference in New Issue
Block a user