<track> tag in HTML5
The <track> tag used to define external timed text tracks for media elements (<audio> and <video>).
Important Description
- The <track> tag is new in HTML5.
- The text tracks specified with the <track> tag could include subtitles, captions, descriptions, chapters, and metadata.
- There must not be more than one track element with the same parent node with the default attribute specified.
Syntax Example
<video width="320" height="240" controls>
<source src="abcd.mp4" type="video/mp4">
<track src="subtitles_en.vtt" kind="subtitles" srclang="en" label="English">
</video>
<track> Tag Browser Support
Element |
Chrome |
Edge |
Firefox |
Safari |
Opera |
<track> |
Yes |
Yes |
Yes |
Yes |
Yes |
Version |
18.0 |
10.0 |
31.0 |
6.0 |
15.0 |
Global Attributes
Event Attributes
Attributes
Attribute |
Value |
Description |
default |
default |
Use to define that the track is to be enabled if the user's preferences do not indicate that another track would be more appropriate |
kind |
captions, chapters, descriptions, metadata, subtitles |
Specifies the kind of text track |
lable |
text |
Provides a user-readable title for the track. |
src |
URL |
Specifies the URL of the track file |
srclang |
language_code |
Defines the language of the track text data |