打开HTML5视频的隐藏字幕

时间:2015-08-11 14:55:44

标签: javascript html html5 web

如何为HTML5视频启用默认隐藏式字幕

我试过这个

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

1 个答案:

答案 0 :(得分:1)

您需要使用<source>元素,否则<video>元素的内部将被忽略:

<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>