item method
Returns a track from a list that corresponds with the given index based on track order.
![]() ![]() |
Syntax
object.item(index)Parameters
- index [in]
-
Type: number
Index of track object.
Return value
Type: object
The track object at index.
Standards information
Remarks
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.
Examples
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> } } </script>
See also
Show:

