Export (0) Print
Expand All

item method

Returns a track from a list that corresponds with the given index based on track order.

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



object.item(index, oCue)


index [in]

Type: number

Index of track in a TextTrackCueList, AudioTrackList, or TextTrackList object.

Standards information


Track order for TextTrackCue objects in a TextTrackCueList arranges them first by their start time with earliest first, then by end time with earliest first. If cues have identical end times, they are sorted in the order in which they were created.

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.


The following example gets a TextTrackList and gets each track's label property. Each track is retrieved using object.item(index) syntax.

  <script type="text/javascript">
    function getTracks() {
      var mytracks = document.getElementById("video1").textTracks;  //  get the textTrackList
      for (var i = 0; i < mytracks.length; i++) {
        document.getElementById("display").innerHTML += (mytracks.item(i).label + "<br/>");  //append track label to inner text of <div>

See also




© 2014 Microsoft