Skip to content

Commit

Permalink
fix(tracks): allow forcing native text tracks on or off (#4172)
Browse files Browse the repository at this point in the history
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().
  • Loading branch information
gkatsev authored Mar 7, 2017
1 parent 88ee6af commit 67634cf
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/js/control-bar/track-button.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
1 change: 1 addition & 0 deletions src/js/tech/html5.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand Down
4 changes: 3 additions & 1 deletion src/js/tech/tech.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 67634cf

Please sign in to comment.