HTML Track Tag
In HTML, the
<track> tag is used as a child of
<track>tag allows us to specify timed tracks Like for example, it allows you to automatically handle subtitles.
Whenever we play a video then we see subtitles or captions on video these are possible with the help of this
It is an empty element.
<track> Tag Syntax and Usage
<track> is an empty element; so it requires start tag only and it does not require an end tag.
Following is the syntax for using the track tag in your HTML code:
<track attribute_name=" ">
HTML <track> tag Attributes
<track> tag supports both global and event attributes and some of the common attributes are given below.
The default attribute is used to indicate that the track should be enabled until and unless the user's preference indicate that the track is more important.
The label attribute of the title track is a user-readable title of text track which is used at the time of listing the available text tracks by the browser
The src attribute is used to specify the URL and the origin of the document and URL should be the same.
This attribute specifies the language of the track text data.
This attribute is used to specify the kind of text track.Its possible values are:- descriptions ,captions,chapters ,metadata.
<track> Tag Basic Example
Below we have a basic example showing how we use the HTML track tag
<video controls width="250" src="/media/examples/abc.mp4"> <track default kind="captions" srclang="en" src="/media/examples/abc.vtt"/> Sorry, your browser doesn't support embedded videos. </video>
Browser Support for HTML
Following browsers support this attribute:
Google Chrome 23.0+
Internet Explorer 10.0