-
Notifications
You must be signed in to change notification settings - Fork 7.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
hidden captions textTrack not triggering "cuechange" events #5308
Comments
Can you provide a reduced test case? Just tried the following and it's working for me. var player = videojs('myplayer');
player.on('loadedmetadata', function() {
var track = player.textTracks()[0];
track.on('cuechange', (e) => console.log(track.activeCues));
track.mode = 'hidden';
}); |
Hello, I've got the same problem. My code is pretty similar to yours player.on('loadedmetadata', function() {
const trackElement = p.addRemoteTextTrack({src: 'captions.vtt'}, false);
trackElement.addEventListener('load', function() {
const track = this.track;
track.addEventListener('cuechange', printActiveCuesContent);
track.mode = 'hidden';
});
}); but I tried your code but it threw an error because the |
@gkatsev sorry for my late reply, your code works but only with the metadata track, which is not what i'm looking for, i'm pushing a subtitles track in a live event and that's the one i need to work on, when i try to add the listener to it nothing gets triggered, it works perfectly if i manually select the CC track from the button, the problem is that i want to render it somewhere else and not on the player so i need it to be hidden or to hide it in another way (on both mobile and desktop clients of course) here's a test case: player.on('loadedmetadata', function() {
var track = player.textTracks()[1];
track.on('cuechange', (e) => console.log(track.activeCues));
track.mode = 'hidden';
}); |
OH, I see. Also, I realize what the issue is now. If you set the mode to video.js/src/js/tracks/text-track.js Lines 229 to 234 in 74bbc5d
We probably want to update that line to look more like this one: video.js/src/js/tracks/text-track.js Lines 188 to 192 in 74bbc5d
Would you be interested in making a PR for that? |
Actually, even worse, looks like we never disable the timer once set. I'll make the PR since there's more going on there. |
@gkatsev thanks so much, will test ASAP and get back to you |
We were only triggering cuechange events if a metadata track started out as not disabled or only when setting the mode to 'showing' Fixes #5308
@kalieye it's out now in 7.2.5, let us know if you still have issues. |
@gkatsev i updated and i can confirm that the issue is now fixed, thank you! |
You're welcome. Thanks for checking back in! |
We were only triggering cuechange events if a metadata track started out as not disabled or only when setting the mode to 'showing' Fixes #5308
Description
When setting a 'captions' text track to 'hidden' mode and adding a cuechange event, the events are not being fired.
Steps to reproduce
Results
Expected
cuechange event triggered with the data
Actual
event is not being triggered, but works when setting the track mode to 'showing'
Error output
no error output
Additional Information
versions
videojs
7.11
browsers
Chrome Latest
OSes
OSX
The text was updated successfully, but these errors were encountered: