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

Unable to show captions from Youtube


Hi Im trying to retrieve captions from Youtube. I've managed to retrieve the actual file and converted it into .vtt format.
http://video.google.com/timedtext?lang=sv&v=jFRj5uH3Jhc&fmt=vtt

The file is still hosted on Youtubes domain, along with the video.

How do i implement it in my JW player on MY domain?

Here's my code:


jwplayer.key = "myKey";
jwplayer('div-id').setup({
playlist: [{
'file': 'https://www.youtube.com/watch?v=jFRj5uH3Jhc',
'image': '/myimagefile',
'width': '100%',
'controlbar': 'bottom',
'primary': 'flash',
tracks: [
{
file: 'http://video.google.com/timedtext?lang=sv&v=jFRj5uH3Jhc&fmt=vtt',
label: 'Swedish',
kind: 'captions',
"default": true
}
],
'aspectratio': '16:9',
wmode: 'transparent'
}]
});

I've tried without the surrounding playlist {[ ]} option, also tried without both 'controlbar': 'bottom',
& 'primary': 'flash',. Havent got it to work once. What am i doing wrong?

Thanks in advance /Carl

4 Community Answers

Cooper Reid

JW Player Support Agent  
0 rated :

Hi Carl,

Your captions are working fine for me in HTML5 mode, but not in flash. Can you try a few things:
1) Removing these lines:
Kind: captions
Language: sv
2) Can you try removing characters like these: öä and see if this was the cause of the issue?

Best Regards,
Cooper

MisterNeutron

User  
0 rated :

Just a wild hunch, but could this be a cross-domain problem?

carl.eriksson

User  
0 rated :

Tried your suggestions Cooper, it still wont work in flash. And since i cant figure out to enable the html5 player in chrome, the captions doesnt show up at all. HOw do i enable html5 by default?

MisterNeutron, this is how the crossdomain.xml file provided by youtube looks like in chrome devtools:

<?xml version="1.0"?>
<!DOCTYPE cross-domain-policy SYSTEM "policyfile">
<cross-domain-policy>
<allow-access-from domain="s.ytimg.com" />
<allow-access-from domain="*.youtube.com" />
</cross-domain-policy>

carl.eriksson

User  
0 rated :

I'm getting no crossdomain errors whatsoever, so i suppose the problem isnt a crossdomain related one :/

This question has received the maximum number of answers.