Reference · Intermediate

The track element

Use track with audio or video to provide timed captions, subtitles, descriptions, chapters, or metadata in WebVTT.

Published
Last checked

Definition

track attaches timed text data to video or audio. Common kinds include captions, subtitles, descriptions, chapters, and metadata. The referenced file normally uses WebVTT and must be served with an appropriate response.

Minimal syntax

<video controls src="lesson.mp4">
  <track
    kind="captions"
    src="lesson.en.vtt"
    srclang="en"
    label="English"
    default
  />
</video>

Captions include dialogue and meaningful non-speech audio. Subtitles primarily translate dialogue and are not a replacement for captions in the source language.

Track selection

Use srclang for language-dependent kinds and a concise label when users can choose among tracks. Only one track in an appropriate group should carry default. A metadata track can support scripts but is not displayed as ordinary captions.

Browser and accessibility behavior

The browser exposes available tracks through native media controls and its text track API. Control appearance and selection behavior vary by platform. A valid file can still be unusable when cues are late, cover important visuals, omit speakers, or fail to identify meaningful sounds.

Common failures

  • Automatically generated captions are published without human correction.
  • The VTT response has the wrong MIME type or is blocked across origins.
  • Captions omit non-speech information needed to understand the scene.
  • A page autoplays media while the caption control is hard to find.

Verification checklist

Play the entire media item with sound off and confirm the same information and timing remain available. Test cue overlap, long lines, speaker changes, music, and narrow screens. Use keyboard and screen-reader controls in more than one browser. Request the VTT URL directly and verify its status, content type, encoding, caching, and cross-origin policy.

Review captions after the final media edit. Changing a cut, playback speed, or audio mix can invalidate otherwise correct cues. Confirm the default track and language labels match the page language and that users can select alternatives without losing playback position. Test the no-track fallback as well.