Egglabs
Egglabs

Reputation: 3186

Turn on close caption for HTML5 Video

How to enable default close caption for HTML5 Video

I tried this

<video id="video" src="abc.mp4">
<track src="web.vtt" srclang="en" label="English" kind="subtitles" default=""></track>
</video>

Upvotes: 1

Views: 1670

Answers (1)

Kaiido
Kaiido

Reputation: 136678

You need to use a <source> element or the inner of your <video> element will be ignored :

<video controls>
  <source type="video/mp4" src="http://vjs.zencdn.net/v/oceans.mp4" />
  <track src="http://www.videojs.com/vtt/captions.vtt" srclang="en" label="English" kind="subtitles" default=""></track>
</video>
Video and captions taken from <a href="http://www.videojs.com/">video.js</a>

Upvotes: 1

Related Questions