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. Subtitle formats include WebVTT format (.vtt file format) — Web Video Text Tracks format, as well as Time-based Text Label Language (TTML) format.
The type of data added to media elements by 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 the browser makes available when the user requests additional data.
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 10and Chrome browsers support 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 a difference between HTML5 New tags 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 type of text in the text track. |
labelHTML5 | text | Specifies the label 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 HTML Event Attributes.