Add caption tracks to your videos
A track element with kind=captions attaches a caption file to an HTML video, and the browser handles display and switching. W3C lists H95 as sufficient for 1.2.2 Captions in combination with the general technique of providing closed captions, so the pair is what passes. Captions and subtitles are not the same thing. Captions carry dialogue plus the sounds you need to follow the video, a door slamming, a phone buzzing. Subtitles carry dialogue only. W3C leaves one door open that trips teams up. A track marked kind=subtitles, in the language of the audio, that does include the important sounds still meets the rule, even though it is not the label anybody would recommend. srclang and label are what let a player offer more than one language. And the element is the boundary. An embedded YouTube or Vimeo player is not an HTML video element, so it sits outside H95 and inside the general technique instead.
How we find it in an audit
A video element with no caption track is a solid automated first pass, though it stops at the edge of any iframe, which is where most embedded players live. The rest is watching. We play the video and check the captions against what the audio actually says, because auto-generated tracks drift out of sync and mishear names, and burned-in captions cannot be resized or restyled by the person watching.
How affected users experience it
This one serves deaf and hard-of-hearing viewers. Without captions a product demo is a silent film with mouths moving, and the moment where the presenter says the one thing that mattered is simply gone. With a real track, the dialogue and the meaningful sounds arrive as text the viewer controls. Everybody else borrows the benefit, in open offices, on trains, and in any language that is not the video's.
Passes vs. fails
Passes
<video src="demo.mp4" controls>
<track kind="captions" src="demo.en.vtt" srclang="en" label="English">
</video>Fails
<video src="demo.mp4" controls></video>How this gets tested
The W3C publishes test rules that define what a checker looks for here.
- Video element auditory content has accessible alternativeA tool finds candidates, you decide
Other ways to satisfy this rule
8 guides on this site are filed under 1.2.2 Captions (Prerecorded). W3C lists this one as sufficient for that rule only alongside G87, so the pair is what passes and neither half does on its own.
- G87sufficientAdd captions to every video with speech
- G93sufficientProvide open captions burned into the video
- SM11sufficientAdd caption text streams in SMIL 1.0
- SM12sufficientAdd caption text streams in SMIL 2.0
- F8failureDo not publish captions that skip dialogue
- F74failureDo not leave a media alternative unlabeled
This guide is our interpretation of W3C technique H95: Using the track element to provide captions. W3C publishes its techniques as guidance rather than as the standard, and says so on every one of them. The success criterion is what conformance is measured against, and a technique is one documented way to meet it.