Skip to content

Commit

Permalink
fix: not showing default text tracks over video (#4216)
Browse files Browse the repository at this point in the history
This allows default tracks or tracks with a `mode`of `showing` to be seen
when they are added (as we would expect). Rather than only being seen
after the first `modechange` event (aka a selection from the menu). This is done by watching for `loadstart` on Player.
  • Loading branch information
brandonocasey committed Mar 23, 2017
1 parent 61e2078 commit dbfba28
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ class TextTrackMenuItem extends MenuItem {
this.track = track;
const changeHandler = Fn.bind(this, this.handleTracksChange);

player.on(['loadstart', 'texttrackchange'], changeHandler);
tracks.addEventListener('change', changeHandler);
this.on('dispose', function() {
tracks.removeEventListener('change', changeHandler);
Expand Down
4 changes: 4 additions & 0 deletions src/js/tech/tech.js
Original file line number Diff line number Diff line change
Expand Up @@ -595,11 +595,15 @@ class Tech extends Component {

textTracksChanges();
tracks.addEventListener('change', textTracksChanges);
tracks.addEventListener('addtrack', textTracksChanges);
tracks.addEventListener('removetrack', textTracksChanges);

this.on('dispose', function() {
remoteTracks.off('addtrack', handleAddTrack);
remoteTracks.off('removetrack', handleRemoveTrack);
tracks.removeEventListener('change', textTracksChanges);
tracks.removeEventListener('addtrack', textTracksChanges);
tracks.removeEventListener('removetrack', textTracksChanges);

for (let i = 0; i < tracks.length; i++) {
const track = tracks[i];
Expand Down

0 comments on commit dbfba28

Please sign in to comment.