HTML <track> tag
When writing in HTML, the <track> tag is used to designate text tracks for both the <audio> and <video> tags. It is useful for when you want to add captions, subtitles, or other forms of text that display as the media plays. The following sections contain information about this tag, including an example of its code, as well as related attributes and browser compatibility.
Example of <track> code
Your browser does not support the <video> tag. <source src="../m/computer-hope.mp4" /> <source src="../m/computer-hope.ogg" /> <track src="english-subtitles.vtt" kind="subtitles" srclang="en" label="English">
<track src="spanish-subtitles.vtt" kind="subtitles" srclang="sp" label="Spanish">
Within an HTML tag, an attribute dictates certain aspects of an HTML element. Attributes are made up of a name and value pair; all tags support standard attributes. The following table shows all of the current unique HTML attributes for the <track> tag, as well as a description of each.
|default||Designates that the track should be enabled unless the user's preferences suggest another.|
|kind||Designates the kind of text track in use.|
|label||Designates a label for the text track.|
|src||Designates the URL of the text track (required).|
|srclang||Designates the language of the text track.|