The track
tag, or Embed Text Track element, designates text tracks for <audio>
or <video>
elements.
The <track>
tag provides subtitles, caption files, or others that will be visible while the associated media is playing.
<video width="600" height="400" controls>
<source src="videoname.mp4" type="video/mp4">
<source src="videoname.ogg" type="video/ogg">
<track src="subtitles_en.vtt" kind="subtitles" srclang="en" label="English">
</video>
default
Designates that the track is to be enabled when the user’s browser preferences allow it.
kind
Provides the kind of track it is. Possible values: captions
, chapters
, descriptions
, metadata
, or subtitles
.
label
Gives the title of the track.
src
Provides the URL of the track file.
srclang
If kind="subtitles"
is used, this attribute is required, and it provides the text track data’s language.
Have a code example of <track>
? Submit a codepen.io demo and we'll showcase it here ↴