0

I just downloaded the opensource video player Video.js and opend up the demo in Chrome and IE and with both the subtitles won't play.

Source files: http://www.videojs.com/

I haven't changed anything and this is the error i get while reading the console in Chrome:

Text track from origin 'file://' has been blocked from loading: Not at same origin as the document, and parent of track element does not have a 'crossorigin' attribute. Origin 'null' is therefore not allowed access.

aaespaul
  • 3
  • 4
  • Hello, do you know what "Same origin policy" is ? – laruiss Jun 30 '15 at 11:37
  • I understand it a littlebit, it has to do something with sercurity. but this shoudn't be importend if I just downloaded the demo files right? – aaespaul Jul 01 '15 at 14:23
  • It seems to be important, could you edit your question to add all the HTML code, so that we could help better? – laruiss Jul 01 '15 at 14:25
  • I just downloaded the video player from http://www.videojs.com/ and opend up the demo file without editing anything – aaespaul Jul 02 '15 at 07:22

1 Answers1

0

This happens in Chrome, but not in Firefox, this is due to Same origin policy:

you must have double-clicked on the demo file, leading to opening the demo.html file in your default browser (which seems to be Chrome) with the file:// protocol. Since the browser is given the order to get the subtitles with the http:// protocol, the browser refuses to get them.

So you can either:

  • put all the files in a webserver (really easy with node and browser-sync on live-server, but you can just as easily use apache or nginx) and you are done
  • download the subtitles, put the files in the same directory as the rest, and change the HTML to point to its relative path from demo.html
laruiss
  • 3,780
  • 1
  • 18
  • 29
  • Thanks for the information, I tested it on mozilla and it worked indeed. I will try it on the server later! – aaespaul Jul 03 '15 at 11:10