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

Track list as javascript variable


Hi All,

Firstly, I am using JW6, and trying to build a player using all JS variables. I am able to pass the stream url and placeholder image successfully, but I cannot get subtitles to work.

I am able to generate the JSON string correctly, this is the content of the variable "substring":

[{"file":"http://server.com/subtitles/english.srt","label":"English","kind":"captions"}]

And I generate the player like so:

jwplayer('player').setup({
file: durl,
tracks: substring,
image: bgurl,
width: '100%',
aspectratio: "16:9",
androidhls: 'true',
stretching: 'uniform',
autostart: 'true',
skin: 'glow'

});

But, when playback starts, there is no "CC" button

If I paste the actual string into the "tracks" line, all works fine, the CC button shows up and the subtitle files are loaded correctly

Is this possible at all, or am I missing something?

7 Community Answers

Todd

JW Player Support Agent  
0 rated :

First of all, why are you using JW6? We last updated JW6 almost exactly two years ago. My suggestion would be to use JW7 for everything.

The tracks needs to be added to a playlist: [] block along with your video source. Please see the code example at the bottom of https://support.jwplayer.com/customer/en/portal/articles/1407438-adding-closed-captions for more details.

e...

User  
0 rated :

Can't afford JW7 just yet sadly

Actually I figured it out, I was using JSON.stringify on the array I created, this broke it. If I pass the array itself, no problem :)

Todd

JW Player Support Agent  
0 rated :

Glad to hear you figured it out, but I was curious about how you said you cannot afford JW7 yet.

We have a free version of JW7 that provides for 10,000 plays per month and 5 GB of video hosting and 25 GB of streaming. The Premium license of JW7 is $299 per year and includes HLS playback, technical support via e-mail, 10x more plays, hosting, and streaming per month.

And if you need more plays, etc than that, we have other licenses of our player that enable Ads playback so you can monetize your views!

Please see https://www.jwplayer.com/pricing/ and https://www.jwplayer.com/tos/ for more details.

e...

User  
0 rated :

We don't need the CDN/hosting services, but we do need HLS support. And, as JW6 already does 99% of what we need, it's hard to justify the extra expense :)

Todd

JW Player Support Agent  
0 rated :

Understood, thanks for responding.

You already have access to JW7 players in your JW Player account dashboard. What player version do you see if you create a new player from your dashboard?

e...

User  
0 rated :

I believe it's JW7, I've not used the dashboard in a very long time, already have all the embed codes and self-hosted files :)

Todd

JW Player Support Agent  
0 rated :

That would also work.

I will mark this support case as closed, but certainly contact us again if you have any other support questions or concerns.

This question has received the maximum number of answers.