Summary -

In this topic, we described about the <track> tag along with detailed example.

The <track> tag is new in HTML5. Timed text track for media elements. The <track> tag represents external timed text tracks for media elements.

The media elements can be audio or video elements. The <track> tag specifies subtitles, caption files or other files containing text. The <track> tag is empty tag so no end tag required.

Syntax -

<track>.... </track>

Required Attributes -

srcSpecifies the location of text trackURL.

Optional Attributes -

defaultSpecify automatically enables trackingDefault
kindSpecifies the text track kindsubtitles (default) captionsdescriptionschaptersmetadata
labelSpecifies the text track titleText.
srclangSpecifies the text track languageLanguage_code

Example -

<!DOCTYPE html>
	<title>Track tag example.. </title>
	<video width="360" height="240" controls>
	   <source src="video/light.mp4" type="video/mp4">
	   <track src="subtitles.vtt" kind="subtitles" label="English">

Output -