Skip to content

Commit

Permalink
fix(FEC-10832): captions not shown in change media from media with 60…
Browse files Browse the repository at this point in the history
…8 captions (#149)

Issue: native captions doesn't change to disable in change media.
Solution: always disable native text tracks on change media
  • Loading branch information
Yuvalke authored Jul 7, 2021
1 parent 934f80f commit 84e2e97
Showing 1 changed file with 2 additions and 13 deletions.
15 changes: 2 additions & 13 deletions src/hls-adapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -744,7 +744,7 @@ export default class HlsAdapter extends BaseMediaSourceAdapter {
_selectNativeTextTrack(textTrack: TextTrack): void {
const selectedTrack = this._nativeTextTracksMap[textTrack.index];
if (selectedTrack) {
this._disableNativeTextTracks();
this.disableNativeTextTracks();
selectedTrack.mode = this._config.subtitleDisplay ? 'showing' : 'hidden';
this._notifyTrackChanged(textTrack);
}
Expand All @@ -754,17 +754,6 @@ export default class HlsAdapter extends BaseMediaSourceAdapter {
this._onTrackChanged(textTrack);
}

/**
* Disables all the video element text tracks.
* @private
* @returns {void}
*/
_disableNativeTextTracks(): void {
Array.from(this._videoElement.textTracks).forEach(track => {
track.mode = 'disabled';
});
}

/** Hide the text track
* @function hideTextTrack
* @returns {void}
Expand All @@ -775,7 +764,7 @@ export default class HlsAdapter extends BaseMediaSourceAdapter {
if (this._hls.subtitleTracks.length) {
this._hls.subtitleTrack = -1;
} else {
this._disableNativeTextTracks();
this.disableNativeTextTracks();
}
}
}
Expand Down

0 comments on commit 84e2e97

Please sign in to comment.