<track>

HTML4 HTML5

The <track> tag defines external text tracks for media elements such as <video> and <audio>. It is used to add subtitles, captions for the deaf or hard of hearing, chapters, or text descriptions.

It is an empty element (self-closing) – it has no closing tag or text content. Text tracks must reference files in WebVTT format (with a .vtt extension).

Attributes:

Example

In the example below, the <track> tag attaches English subtitles (when available) to the video player:

Code:

<video controls width="360" height="200"> <source src="https://interactive-examples.mdn.mozilla.net/media/cc0-videos/friday.mp4" type="video/mp4"> <track src="https://interactive-examples.mdn.mozilla.net/media/examples/friday.vtt" kind="subtitles" srclang="en" label="English" default> Your browser does not support the video element. </video>

The browser will interpret this code as follows (a video player element with a subtitle track):