English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
The HTML <track> element is used as a child element of media elements - <audio> and <video>. It allows specifying timed text subtitles (or time-based data), such as automatic subtitle processing. The subtitle formats include WebVTT format (.vtt file format) - Web Video Text Tracks format, as well as Time Text Label Language (TTML) format.
The type of data added to the media element by the track is set in the kind attribute, which can be subtitles, captions, descriptions, chapters, or metadata. This element points to a source file containing timed text that is made available by the browser when the user requests additional data. The subtitle formats include WebVTT format (.vtt file format) - Web Video Text Tracks format, as well as Time Text Label Language (TTML) format.
Two track child elements of any media element cannot have the same kind, srclang, and label attributes.
A video with two subtitle tracks:
<video width="320" height="240" controls> <source src="track.mp4" type="video/mp4"> <source src="track.ogg" type="video/ogg"> <track src="track_en.vtt" kind="track" srclang="en" label="English"> <track src="track_no.vtt" kind="track" srclang="no" label="Norwegian"> </video>
IEFirefoxOperaChromeSafari
IE 10Supports the <track> tag.
The <track> tag specifies external text tracks for media elements (such as <audio> and <video>).
This element is used to specify subtitle files or other text-containing files that are visible when the media is played.
<track> tag is HTML5 New tag in
New: HTML5 New attribute in
Attribute | Value | Description |
---|---|---|
defaultHTML5 | default | Specifies that the track is the default. If the user does not select any track, the default track is used. |
kindHTML5 | captions chapters descriptions metadata subtitles | Specifies the text type of the text track. |
labelHTML5 | text | Specifies the tag and title of the text track. |
srcHTML5 | URL | Required. Specifies the URL of the track file. |
srclangHTML5 | language_code | Specifies the language of the track text data. If the value of the kind attribute is "subtitles", this attribute is required. |
Support for <track> tag Global attributes of HTML.
Support for <track> tag Event attributes of HTML.