Skip to content

Commit

Permalink
feat: add extraSubtitlesTrackAdded event for withHTMLSubtitles
Browse files Browse the repository at this point in the history
  • Loading branch information
tymmesyde committed Jan 20, 2025
1 parent 1537a0e commit 436fe5a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
3 changes: 3 additions & 0 deletions src/StremioVideo/StremioVideo.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
9 changes: 6 additions & 3 deletions src/withHTMLSubtitles/withHTMLSubtitles.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -419,9 +419,12 @@ function withHTMLSubtitles(Video) {
origin: 'LOCAL',
local: true,
embedded: false,
});
};

tracks.push(track);

onPropChanged('extraSubtitlesTracks');
events.emit('extraSubtitlesTrackAdded', track);
}

return true;
Expand Down Expand Up @@ -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; })
};

Expand Down

0 comments on commit 436fe5a

Please sign in to comment.