HTML: track

The <track> element adds a text track, such as captions or subtitles, to a video or audio element.

What you will learn

Caption example

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

The src points to a WebVTT text file. kind describes the track, srclang identifies its language, and label is shown to users when choosing a track.

Choose the track kind

Choose the kind that matches the purpose. A transcript outside the player can still be useful and searchable.

Common mistakes