admin管理员组文章数量:1426042
I'm doing a website and I need to show a player and I came out with video.js but I have a question how can I put my subtitles showing up without the user needing to click on anything?
This is my code:
<video id="filme" class="video-js vjs-default-skin" controls preload="auto" width="100%" height="640" data-setup='{}'>
<source src="./video.mp4" type='video/mp4' />
<track kind="subtitles" src="./subs/subtitles.srt" srclang="pt" label="Português" default>
</video>
I hope you can help me.
Thanks in advance.
I'm doing a website and I need to show a player and I came out with video.js but I have a question how can I put my subtitles showing up without the user needing to click on anything?
This is my code:
<video id="filme" class="video-js vjs-default-skin" controls preload="auto" width="100%" height="640" data-setup='{}'>
<source src="./video.mp4" type='video/mp4' />
<track kind="subtitles" src="./subs/subtitles.srt" srclang="pt" label="Português" default>
</video>
I hope you can help me.
Thanks in advance.
Share Improve this question asked Sep 30, 2013 at 21:07 user2832704user2832704 411 silver badge8 bronze badges2 Answers
Reset to default 3I got the solution. You can check it at github, https://github./videojs/video.js/issues/656
This is the code that you should update on line 6666 and after. Add this code:
if(track.dflt()) {
this.player_.showTextTrack(this.track.id_, this.track.kind());
}
After this: (line 6676, as of v4.3)
this.player_.on(track.kind() + 'trackchange', vjs.bind(this, this.update));
I hope this helps someone.
According to the Video.js documentation...
Timed text requires a text file in WebVTT format.
Your current track
is referencing an .srt
file.
Try changing it to a WebVTT
.
There is a builder here: http://ie.microsoft./testdrive/Graphics/CaptionMaker/
Documentation
http://www.videojs./docs/tracks/
本文标签: javascriptVideojs Auto loading subtitlescaptionsStack Overflow
版权声明:本文标题:javascript - Video.js Auto loading subtitlescaptions - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745389506a2656531.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论