Skip to content

Commit

Permalink
fix: not showing default text tracks over video (#4217)
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 authored Mar 23, 2017
1 parent 6cf4ef8 commit 4653922
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 @@ -38,6 +38,7 @@ class TextTrackMenuItem extends MenuItem {
if (tracks) {
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 @@ -622,11 +622,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 4653922

Please sign in to comment.