HTML - <track> tag


Description

The HTML <track> tag is used for defining captions, subtitles, and other content for <audio> and <video> tags

Example

<!Doctype html>
<html>

   <head>
      <title>HTML source Tag</title>
   </head>

   <body>
      <audio controls>
         <source src = "yourfile.mp3">
         <track src = "subtitles.vtt" kind = "subtitles" srclang = "en" label =" English">
         <p>:The browser doesnot support the file</p>
      </audio>
   </body>

</html>

This will produce the following result −

Global Attributes

This tag supports all the global attributes described in − HTML Attribute Reference

Specific Attributes

The HTML <track> tag also supports the following additional attributes −

Attribute Value Description
default HTML-5 default uses the default track
kind HTML-5

captions

chapters

descriptions

metadata

subtitles

kind of track to be used
label HTML-5 text displays title of text track
src HTML-5 URL URL of track file
srclang class = "inline" HTML-5 language_code specifies language of the text

Event Attributes

This tag supports all the event attributes described in − HTML Events Reference

Browser Support

Chrome Firefox IE Opera Safari Android
Yes Yes Yes Yes Yes Yes
html_tags_reference.htm
Advertisements