1
0
mirror of https://github.com/videojs/video.js.git synced 2024-12-14 11:23:30 +02:00

fix(tracks): allow forcing native text tracks on or off (#4172)

In addition, the track buttons need to update on the ready event because when the tech loads, it could run with support native captions, so, it needs to know whether to include the captions settings menu.
And all tracks should always be included in player.textTracks() and not just player.remoteTextTracks().
This commit is contained in:
Gary Katsevman 2017-03-07 13:53:57 -05:00 committed by GitHub
parent 88ee6af431
commit 67634cf216
3 changed files with 5 additions and 1 deletions

View File

@ -38,6 +38,7 @@ class TrackButton extends MenuButton {
tracks.addEventListener('removetrack', updateHandler);
tracks.addEventListener('addtrack', updateHandler);
this.player_.on('ready', updateHandler);
this.player_.on('dispose', function() {
tracks.removeEventListener('removetrack', updateHandler);

View File

@ -68,6 +68,7 @@ class Html5 extends Tech {
// store HTMLTrackElement and TextTrack to remote list
this.remoteTextTrackEls().addTrackElement_(node);
this.remoteTextTracks().addTrack(node.track);
this.textTracks().addTrack(node.track);
if (!crossoriginTracks &&
!this.el_.hasAttribute('crossorigin') &&
Url.isCrossOrigin(node.src)) {

View File

@ -130,8 +130,10 @@ class Tech extends Component {
}
});
if (options.nativeCaptions === false) {
if (options.nativeCaptions === false || options.nativeTextTracks === false) {
this.featuresNativeTextTracks = false;
} else if (options.nativeCaptions === true || options.nativeTextTracks === true) {
this.featuresNativeTextTracks = true;
}
if (!this.featuresNativeTextTracks) {