Open In App

HTML <track> Tag

Improve
Improve
Like Article
Like
Save
Share
Report

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




<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:

aws

Example 2:  

HTML




<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:

swg

Supported Browsers:

  • Google Chrome 23
  • Edge 12 and above
  • Firefox 31 and above
  • Opera 12.1 and above
  • Safari 6 and above


Last Updated : 22 Dec, 2023
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads