Open In App

HTML <track> Tag

The HTML <track> tag specifies text tracks for media components audio and video This part is employed to specify subtitles, caption files, or different files containing text, that ought to be visible once the media is taking part in. 

Note:



Syntax:

<track Attribute>

Attributes:

Attribute Values

Description

default

Specifies that, the track to enabled if the user wants to change the track.

kind

Specifies the kind of text track

label

The title of the text track

src

It is for the URL of the track file

srclang

It tells the language of the track text data (required if kind=”subtitles”)

Example 1: In this example, we will see the implementation of <track> tag.




<html>
  
<head>
</head>
  
<body style="text-align: center">
    <h1 style="color: green">
        GeeksforGeeks
    </h1>
    <h2>HTML Track srclang Attribute</h2>
  
    <video width="600" height="400" controls>
  
        <track src=
               kind="subtitles" srclang="en" 
               label="English">
  
        <source id="myTrack" src=
                type="video/mp4">
    </video>
</body>
  
</html>

Output:



Example 2:  




<html>
  
<head>
</head>
  
<body style="text-align: center">
    <h1 style="color: green">
        GeeksforGeeks
    </h1>
    <h2>HTML Track srclang Attribute</h2>
  
    <video width="700" height="500" controls>
  
        <track
            src=
            id="myTrack1" kind="subtitles" 
            srclang="en" label="English">
  
        <source id="myTrack"
            src=
            type="video/mp4">
    </video>
</body>
  
</html>

Output:

Supported Browsers:


Article Tags :