HTML <track> Element

The <track> element adds timed text information to an <audio> or <video> element. Tracks can provide captions, subtitles, descriptions, chapter titles, or metadata that is synchronized with the media.

Syntax

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

Attributes

The <track> element supports the global HTML attributes and the following element-specific attributes:

Attribute Description
default Specifies that the track should be enabled by default when the user's preferences do not indicate that another track would be more appropriate.
kind Specifies the type of timed text track. Values include subtitles, captions, descriptions, chapters, and metadata.
label Provides a user-readable title for the track that browsers can display when users choose between available tracks.
src Specifies the URL of the timed text track file. The track resource is commonly provided in WebVTT format.
srclang Specifies the language of the track text using a valid language tag. It is required when kind="subtitles" is used.

Example

This example adds an English caption track to a video. The browser can display the captions in synchronization with the video when the supplied WebVTT file contains the corresponding timed cues.

<video controls width="500">
  <source src="example-video.mp4" type="video/mp4">
  <track src="captions-en.vtt" kind="captions" srclang="en" label="English" default>
  Your browser does not support the video element.
</video>

Usage Notes

The <track> element is a void element, so it does not use a closing </track> tag. It is placed inside an <audio> or <video> element after any <source> elements and before fallback content.

The kind attribute describes the purpose of the track. Captions can include dialogue and other important audio information, while subtitles generally provide translated or transcribed dialogue for users who can otherwise hear the audio.

Multiple <track> elements can be included for different languages or purposes, allowing users to select the track that best meets their needs.

Accessibility

Caption tracks are an important accessibility feature for video content containing speech or other meaningful audio. Captions should accurately represent spoken dialogue and relevant sounds so users who cannot hear the audio can understand the content. When visual information is necessary to understand a video, appropriate audio descriptions or another accessible alternative may also be needed.

Browser Support

Baseline: Widely available indicates a feature has been supported by core browsers for at least 30 months. At this stage, the feature is considered stable and safe for most websites to use without needing to worry about compatibility issues or fallbacks, as it is supported by the vast majority of users' devices and browser versions.

For detailed browser compatibility information, see Can I Use: HTML <track> Element .

The <track> element is used with media elements, including <video>, <audio>, and <source>.

Specifications

The <track> element is defined in the WHATWG HTML Living Standard .