<track>
Adds subtitles or chapters to a video.
Syntax
<track kind="subtitles" src="subs.vtt" srclang="en" label="English">Attributes
| Parameter | Type | Description |
|---|---|---|
| src | URL | A subtitle file in WebVTT format (`.vtt`). |
| kind | subtitles | captions | chapters | The kind of track. |
| srclang | language code | The language of the track. |
| label | text | The name in the player menu. |
| default | — | Optional. Turn the track on by default. |
Examples
A video with two subtitle tracks:
<video controls width="320">
<source src="/media/flower.mp4" type="video/mp4">
<track kind="subtitles" src="/media/flower-en.vtt" srclang="en" label="English" default>
<track kind="subtitles" src="/media/flower-de.vtt" srclang="de" label="Deutsch">
</video>Notes
Subtitles are a .vtt file with timecodes and text. It must be served from the same site as the page, otherwise the browser will not load it. captions differ from subtitles in that they also describe sounds — important for deaf viewers.
See also
Related recipes
In the tutorial
- Audio and video — The video and audio tags, the controls panel, autoplay, looping, several formats with source and subtitles.