Name is required.
Email address is required.
Invalid email address
Answer is required.
Exceeding max length of 5KB

Loading vtt file through API


Is it possible to tell the player about the existence of a VTT file using the API? I have two videos on my web page, each with a separate vtt file, and I'd like to pass the name of the vtt file to the player when the user chooses a video to play.

Thanks

Peter

5 Community Answers

Andrew

JW Player Support Agent  
0 rated :

You should be able to simply use multiple VTT files within your player embed. We have an example here:
support.jwplayer.com/customer/portal/articles/1407438-adding-closed-captions

Is there specific functionality that you’re looking for that requires API work?

pce

User  
0 rated :

Hm - I just wrote to the support address, so I hope this isn't going to lead to a lot of confusion!

The situation is that I have one instance of the player on my page, but multiple videos on the page. I tell the player which video to play, using the API. I would also like to tell it which VTT file to use while playing the chosen video.

Thanks

Peter

Andrew

JW Player Support Agent  
0 rated :

Hi,

You should be able to do this with the load() API call. You can add tracks to this as well.

pce

User  
0 rated :

Right - all I had to do was add a tracks object to the load call, like this:

jwplayer().load([{file:fName, tracks[{file:chapfName,label:"English",kind:"chapters"}]}]);

Works just great.

Thanks!

Andrew

JW Player Support Agent  
0 rated :

Awesome! Glad it’s working. :)

This question has received the maximum number of answers.