Using the track element to provide captions
Status
- New technique.
This technique would be listed as one of the technology-specific techniques implementing G87, listed in the third bullet of sufficient techniques in Understanding 1.2.2.
- Added to XML as H95
Applicability
- HTML5
This technique relates to:
- media-equiv-captions: SC 1.2.2 Captions(Prerecorded) (sufficient)
User Agent and Assistive Technology Support Notes
- March 2012: Internet Explorer 10 Platform Preview 4 includes TTML and WebVTT
track
caption support. - Per discussion at the Foundations of Open Media Standards and Software developer workshop in November 2013, WebVTT captions as HTML5 video tracks are supported in all major browsers (Webkit/Safari, Blink/Chrome/Opera, Internet Explorer, Firefox (not yet released, but in nightly build), Android).
- As of November 2013, TTML captions as HTML5 video tracks are support in Internet Explorer.
- Captionator is a JavaScript polyfill designed to provide support for the <track> element. As of Jan 2014, it supports subtitles in SUB, SRT, Youtube's SBV, WebVTT, and WebVTT with Google's proposed timestamp syntax. It plans support for LRC, DFXP/TTML and the WebVTT v2 proposed features.
Description
The objective of this technique is to use the HTML5 track
element to specify a captions
timed text track for a video
element. Caption timed text tracks contain transcription or translation of the dialogue, sound effects, relevant musical cues, and other relevant audio information, suitable for when sound is unavailable or not clearly audible.
The src
attribute of the track
element is a URL that is the address of the text track data.
The kind
attribute of the track
element indicates the kind of information in the timed text. captions
text tracks provide a text version of dialogue and other sounds important to understanding the video. subtitles
contain only the dialogue. If other audio information is important to understanding the video, a subtitle track will not be sufficient to meet the success criteria.
Note: Some regions use the term "subtitle" for any visible text representation of the audio track. An author may mark up a timed text track in the language of the audio track as kind=subtitles
, instead of kind=captions
, and may include additional relevant audio information. It is not best practice to use subtitles
in this situation, since it may confuse users who are trying to find captions. But such a timed text track would meet the requirements of Success Criterion 1.2.2.
Examples
Example 1
A video element for a video in the English language with an English caption track. The captions are provided in the WebVTT format.
<video poster="myvideo.png" controls> <source src="myvideo.mp4" srclang="en" type="video/mp4"> <track src="myvideo_en.vtt" kind="captions" srclang="en" label="English"> </video>
See live example
Example 2
A video element for a video with both an English and French language source element, and with an English caption track and a French captions track. WebVTT (vtt) and Timed Text Markup Language (ttml) are different caption file formats.
<video poster="myvideo.png" controls> <source src="myvideo.mp4" srclang="en" type="video/mp4"> <source src="myvideo.webm" srclang="fr" type="video/webm"> <track src="myvideo_en.vtt" kind="captions" srclang="en" label="English"> <track src="myvideo_fr.ttml" kind="captions" srclang="fr" label="French"> </video>
Resources
- HTML 5, the track element
- Timed Text Markup Language 1
- WebVTT: The Web Video Text Tracks Format
- Captionator Polyfill
Related Techniques
Tests
Procedure
For the video
element used to play a video:
- Check that the video contains a
track
element of kindcaptions
in the language of the video.
Expected Results
- Check that #1 is true