diff --git a/src/StremioVideo/StremioVideo.js b/src/StremioVideo/StremioVideo.js index 246fe5a..cc2ee53 100644 --- a/src/StremioVideo/StremioVideo.js +++ b/src/StremioVideo/StremioVideo.js @@ -66,6 +66,9 @@ function StremioVideo() { video.on('extraSubtitlesTrackLoaded', function(track) { events.emit('extraSubtitlesTrackLoaded', track); }); + video.on('extraSubtitlesTrackAdded', function(track) { + events.emit('extraSubtitlesTrackAdded', track); + }); if (Video.manifest.external) { video.on('implementationChanged', function(manifest) { events.emit('implementationChanged', manifest); diff --git a/src/withHTMLSubtitles/withHTMLSubtitles.js b/src/withHTMLSubtitles/withHTMLSubtitles.js index 5abddfa..ffc8be3 100644 --- a/src/withHTMLSubtitles/withHTMLSubtitles.js +++ b/src/withHTMLSubtitles/withHTMLSubtitles.js @@ -410,7 +410,7 @@ function withHTMLSubtitles(Video) { .filter(function(track) { return track.local; }) .length; - tracks.push({ + var track = { id: id, url: null, buffer: commandArgs.buffer, @@ -419,9 +419,12 @@ function withHTMLSubtitles(Video) { origin: 'LOCAL', local: true, embedded: false, - }); + }; + + tracks.push(track); onPropChanged('extraSubtitlesTracks'); + events.emit('extraSubtitlesTrackAdded', track); } return true; @@ -527,7 +530,7 @@ function withHTMLSubtitles(Video) { .filter(function(value, index, array) { return array.indexOf(value) === index; }), commands: Video.manifest.commands.concat(['load', 'unload', 'destroy', 'addExtraSubtitlesTracks', 'addLocalSubtitles']) .filter(function(value, index, array) { return array.indexOf(value) === index; }), - events: Video.manifest.events.concat(['propValue', 'propChanged', 'error', 'extraSubtitlesTrackLoaded']) + events: Video.manifest.events.concat(['propValue', 'propChanged', 'error', 'extraSubtitlesTrackLoaded', 'extraSubtitlesTrackAdded']) .filter(function(value, index, array) { return array.indexOf(value) === index; }) };