I tried using the track
element, but it didn't work..could you please tell me if there's something I am doing wrong?
<video controls="controls" id="video1" width="450">
<source src="A taste of TED.mp4" type="video/mp4">
<track src="TED.vtt" kind="subtitles" srclang="en" label="English">
</video>
The subtitle file (TED.vtt
) looks like this:
WEBVTT
1
00:00:01.000 --> 00:00:10.000
This is the first line of text, displaying from 1-10 seconds
2
00:00:15.000 --> 00:00:20.000
And the second line of text
separated over two lines
The code:
<video controls="controls" id="video1" width="450">
<source src="A taste of TED.mp4" type="video/mp4" />
<track src="TED.vtt" kind="subtitles" srclang="en" label="English" />
</video>
Works. What you may be doing wrong is that you are using .srt
subtitles instead of .vtt
srt:
1
00:01:21,700 --> 00:01:24,675
Life on the road is something
I was raised to embrace.
vtt:
WEBVTT
01:21.700 --> 01:24.675
Life on the road is something
I was <i>raised</i> to embrace.
What you need to do is:
Also it may be possible that your web bowser does not support the video tag, I know for example that some cellphones do not play videos with this tag!