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:
- Start the text file with WEBVTT
- Remove the cue markers at the start of each subtitle, or replace them with Cue - prefixes.
- Optionally, remove the 00: hour marker at the start of each timestamp.
- Convert the comma before the millisecond mark in every timestamp to a decimal point (easy enough with a find-replace: ,7 to .7, for example).
- Optionally, add styling markup to the subtitle text.
- Save the file with a .vtt extension and link to it from a element in an HTML5 page.
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!
- The second part of the answer was taken from a post by Dudley Storey.