-
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
Can't Control Display of Text Tracks via JS anymore? #2124
Comments
We really need to update our documentation for this :/
player.textTracks()[0].mode = 'disabled'; And to re-show the track: player.textTracks()[0].mode = 'showing'; Going to close this, since hopefully, we won't need to do anything in core. But please ask questions here if you're having trouble or unsure of anything. |
Okay, thanks @gkatsev . I see that the CC now switches within the menu to reflect whether a caption is active or not, but the class 'vjs-hidden' is still attached the the 'vjs-text-track-display' and no text has been loaded into there. Is there anything else I need to do to actually have the captions displaying? Even manually clicking the caption (without use of JS) does nothing. |
Huh, that's weird. It should be showing up. Have an reduced test case? |
@gkatsev Let me whip one up.. |
@gkatsev Heres a plunkr: Loaded v4.12.5 - There are two players, one which adds a Closed Caption track dynamically (in the VideoJS ready function call using addTextTrack) and the other which loads manually (within the I added color to menu items which are selected Both of them show ClosedCaptions but neither show the captions when enabled. Upon further inspection no text shows up either within the DOM element, so it's not an issue of positioning/styline as there is nothing there anyways. This worked fine in v4.8.0, although that was a decent amount of versions ago. Can you reopen this issue? |
Ah, I think I know what the issue is. videojs('player', {
html5: {
nativeTextTracks: false
}
}); Hopefully, that makes sense. |
On our end, our Captions are open , so CORS is setup and available (this was an issue before but we fixed it) so in v4.8.5 it worked flawlessly. I added the html5 option variable into the plugin and it works for manually adding the text track, but when it is added dynamically, through the ready function, it doesn't. Any additional thoughts? :/ |
Ah, so you do have CORS headers, cool. Adding Also, if you get an error using |
Ah alright. Thanks for letting me know about the new function @gkatsev . I am noticing that there doesn't seem to be a control of styling for the captions either. >_> |
Can it be done for chapter track too ? Also can some one share an example. I'm not able to see JS in demo shared by gkatsev. |
@sgavali can you elaborate on what you mean about the chapters track? |
https://github.com/videojs/video.js/blob/stable/docs/guides/tracks.md I can dynamically create captions and chapters. But chapters can be only seen in PC chrome. On 5.x I can see chapter controls being created but they don't have any effect / chapter data, Sample code:
|
I upgraded from v4.8.0 to v4.12.5 for support of some ad plugin for VideoJS but I now have noticed I can no longer control the display (show/hide) of a text track, in this case, captions.
I used to be able to run
vjsPlayer.textTracks()[0].show()
to show a text track, orvjsPlayer.textTracks()[0].disable()
to hide a text track and then on top of that, trigger an event which updates the Closed Captions menu to reflect the change:this.player_.on(track.kind() + 'trackchange', vjs.bind(this, this.update));
All of that seems to now be missing in v4.12.5 and from looking at the changelog file I don't see why... I now see this error in the console:
this.vjsPlayer.textTracks(...)[0].show is not a function
So obviously it has been removed. Is there a new way of controlling the state of a closed caption / text track and updating the menu to reflect that change?
The text was updated successfully, but these errors were encountered: