Skip to content
Related Articles
Open in App
Not now

Related Articles

HTML Audio/Video DOM addTextTrack() Method

Improve Article
Save Article
Like Article
  • Last Updated : 31 Jul, 2019
Improve Article
Save Article
Like Article

The HTML Video DOM addTextTrack() Method is used to creating or returning the new TextTrack of a video Element. The new TextTrack is added to the list of all TextTracks of a Video Element.


audio/video.addTextTrack(kind, label, language)

Parameter Values:

  • Kind: It specify the Kind of the TextTrack
      Possible values are:

    1. “subtitles”
    2. “caption”
    3. “descriptions”
    4. “chapters”
    5. “metadata”
  • label: It contains a string value which specify the label of a TextTrack
  • language: It contains a two-letter language code which specifying a language of the Texttrack.

Return value: It returns a TextTrack Object which represents a new TextTrack of a Video Element.


<!DOCTYPE html>
        HTML DOM addTextTrack() Method
        <h1 style="color:green;">  
          HTML DOM Video addTextTrack() Method
        <video id="gfg"
            <source src=
        <button type="button" 
            New Text Track
            var GFG = document.getElementById("gfg");
            function myGeeks() {
                var sudo = GFG.addTextTrack("caption");
                sudo.addCue(new TextTrackCue(
                  "Test text", 01.000, 04.000, "", "", "", true));


My Personal Notes arrow_drop_up
Like Article
Save Article
Related Articles

Start Your Coding Journey Now!