Skip to content

Commit

Permalink
Turn meta event listener on when playlisItem changes JW7-1984
Browse files Browse the repository at this point in the history
  • Loading branch information
egreaves committed Jan 28, 2016
1 parent 086da58 commit c0ad3b4
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/js/controller/captions.js
Expand Up @@ -17,12 +17,11 @@ define([
// Listen for provider subtitle tracks
// ignoring provider "subtitlesTrackChanged" since index should be managed here
_model.mediaController.on('subtitlesTracks', function(e) {
_model.mediaController.off('meta');
if(! e.tracks.length) {
// If we don't get WebVTT captions, listen for metadata captions
_model.mediaController.on('meta',_metaHandler, this);
return;
}
// If we get webvtt captions, do not override with metadata captions
_model.mediaController.off('meta', _metaHandler);

_tracks = [];
_tracksById = {};
Expand Down Expand Up @@ -115,6 +114,10 @@ define([
_metaCuesByTextTime = {};
_unknownCount = 0;

// meta event listener may have been turned off in subtitlesTracks event
_model.mediaController.off('meta', _metaHandler);
_model.mediaController.on('meta', _metaHandler, this);

var tracks = item.tracks,
track, kind, i;
for (i = 0; i < tracks.length; i++) {
Expand Down

0 comments on commit c0ad3b4

Please sign in to comment.