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/