1

Unable to show up subtitles in the video, i have used the following track element as shown in the code.

<!doctype html>
<head>
<link href="http://vjs.zencdn.net/4.12/video-js.css" rel="stylesheet">
<script src="http://vjs.zencdn.net/4.12/video.js">
</script>
<style type="text/css">
 .vjs-default-skin { color: #fdfdfd; }
 .vjs-default-skin .vjs-play-progress,
 .vjs-default-skin .vjs-volume-level { background-color: #1880b8 }
 .vjs-default-skin .vjs-control-bar { font-size: 100% }
</style>
</head>
<body>
<video id="MY_VIDEO_1" class="video-js vjs-default-skin vjs-big-play-    centered" controls
 preload="auto" width="640" height="264" data-setup='{"controls": true,    "autoplay": false, "preload": "auto" }'>
<source src="Game.of.Thrones.S05E10.HDTV.x264-KILLERS.mp4" type='video/mp4'>
<track label="English subtitles" kind="subtitles" srclang="en"         src="http://mcpocketeditionforapt.altervista.org/sub.vtt"></track>

</video>
</body>
</html>
2
  • Probably a CORS issue. What errors do you see in the console?
    – misterben
    Aug 25, 2015 at 13:43
  • it is showing CORS error , and unable to find any solution for CORS @misterben Aug 26, 2015 at 9:31

1 Answer 1

2

There are two ays to resolve this.

  1. Configure the server hosting the captions to send CORS headers (documented at enable-cors.org and on various questions on SO) and add a crossdomain attribute to the video element (<video crossdomain id="MY_VIDEO_1" …).
  2. Host the captions on the same domain as your page so CORS headers are not needed.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.