0

I am trying to write a basic video player using html5 video tag. I used Video.js as my JavaScript. I want to play a video with its caption. Here is the code:

<!DOCTYPE html>

<link href="path/to/video-js.css" rel="stylesheet">
<script src="path/to/video.js"></script>
<script>
    videojs.options.flash.swf = "path/to/video-js.swf"
</script>


<video id="example_video_1" class="video-js vjs-default-skin vjs-big-play-centered"
controls preload="auto" width="640" height="264"
poster="http://video-js.zencoder.com/oceans-clip.png"
<source src="m.mp4" type='video/mp4' />

<p class="vjs-no-js">To view this video please enable JavaScript, and consider upgrading to a web browser that <a href="http://videojs.com/html5-video-support/" target="_blank">supports HTML5 video</a></p>


<track src="m.srt" kind="subtitles"  srclang="en" label="English" default>
<track src="m.vtt" kind="subtitles"  srclang="en" label="English" >
<track src="m.srt" kind="captions"  srclang="en" label="English"  >
<track src="m.vtt" kind="captions"  srclang="en" label="English"  >

</video>

When I open this file in my browser, I see a "cc" label that must enable/disable captions; but it doesn't work at all. VLC media palyer can play the video and caption well; so there is no error in source files. Can any body help me?

user3974637
  • 25
  • 1
  • 8
  • Could be a first hint why it isn't playing – Drifter Feb 11 '15 at 22:18
  • Lose the srt, you should use WebVTT only. It's worth posting the URL to the actual files, the contents and how they're delivered (e.g. headers) may be relevant. – misterben Feb 16 '15 at 14:08

0 Answers0