Which TextTrack API #8858
-
Hi, Is there supposed to be a difference between using player.addTextTrack(kind, label, language); Is one approach recommended over another? When experimenting with generating text tracks on the fly, I was having trouble with getting them to display when using the second method, and they seem to result in different objects being created in the list of text tracks. Is there a reason the player.addTextTrack doesn't receive a TextTrack object, or is it a historical curiosity? Thanks |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
You should use the player API. It's designed to look like the native API on the video element. You also may want to use |
Beta Was this translation helpful? Give feedback.
-
I was using the player.addTextTrack() method, but I had to change to the other approach, as I need to set the .id on the track object, which doesn't seem to be possible when using the first method. ` // ... const playerTrack = new TextTrack({ player.textTracks().addTrack(playerTrack); ` This seems to work well for kind : "chapters", but "captions" tracks don't seem to be displayed in the player. |
Beta Was this translation helpful? Give feedback.
Your code example is using vidstack not Video.js. If you're actually using vidstack, you should take a look at their documentation for API usage.