Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

id property

Returns the TextTrackCue, VideoTrack, or AudioTrack identifier.

This property is read-only.

HTML5 A vocabulary and associated APIs for HTML and XHTMLInternet Explorer 10



id = object.id


Property values

Type: string

Text track ID

Standards information


This property is not implemented for the AudioTrack object.

The following example displays startTimeand endTime, pauseOnExit,id, and cue text for all cues in a track.

Note  To create timed text files in both Web Video Text Track (WebVTT) and Timed Text Markup Language (TTML) formats, see HTML5 Video Caption Maker on the Windows Internet Explorer test drive site.


    <script type="text/javascript">
      function getCues() {
        var myTrack = document.getElementById("entrack").track; // get text track from track element          
        var myCues = myTrack.cues;   // get list of cues                              
        var statusFlags = "<table><tr><th>startTime</th><th>endTime</th>";
        statusFlags += "<th>pauseOnExit</th><th>id</th>";
        statusFlags += "<th>cue text</th></tr>";

        for (var i = 0; i < myCues.length; i++) {
          statusFlags += "<tr><td>" + myCues[i].startTime + "</td><td>" + myCues[i].endTime + "</td>";
          statusFlags += "</td><td>" + +myCues[i].pauseOnExit + "</td><td>\"" + myCues[i].id + "\"</td>";
          statusFlags += "</td><td>" + myCues[i].getCueAsHTML().textContent + "</td></tr>";
          statusFlags += "</table>";
          document.getElementById("display").innerHTML = statusFlags;  //append track label
    <video id="video1" controls  >
      <source src="video.mp4">    
      <track id="entrack" label="English subtitles" kind="captions" src="entrack.vtt" srclang="en" default>
    <p><button onclick="getCues();">Show tracks</button></p>
    <div style="display:block; overflow:auto; height:200px; width:auto"  id="display"></div>

See also

Make your videos accessible with Timed Text Tracks



© 2015 Microsoft