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:
src – (required) URL of the text track file (a .vtt file).kind – specifies the type of text track. Available values:
subtitles – (default) subtitles for spoken dialogue, useful for translations.captions – transcription of dialogue and sound effects for the hard of hearing.chapters – chapter titles to facilitate navigation through media content.descriptions – text descriptions of video content intended for speech synthesizers.metadata – data for JavaScript scripts, not displayed to the user.srclang – language of the text track in a two-letter language code format (e.g., pl, en). Required if the kind attribute is set to subtitles.label – a user-readable title of the track displayed in the subtitle selection menu in the player (e.g., "English").default – indicates that the given track should be enabled by default when the player starts.class, id, and style are also supported.In the example below, the <track> tag attaches English subtitles (when available) to the video player:
Code:
The browser will interpret this code as follows (a video player element with a subtitle track):