The HTMLTrackElement interface provides access to the properties of <track> elements, as well as methods to manipulate them.


Inherits properties from its parent, HTMLElement.

Is a DOMString that reflects the kind HTML attribute, indicating how the text track is meant to be used. Possible values are: subtitles, captions, descriptions, chapters, metadata.
Is a DOMString that reflects the src HTML attribute, indicating the address of the text track data.
Is a DOMString that reflects the srclang HTML attribute, indicating the language of the text track data.
Is a DOMString that reflects the label HTML attribute, indicating a user-readable title for the track.
Is a Boolean reflects the default HTML attribute, indicating that the track is to be enabled if the user's preferences do not indicate that another track would be more appropriate.
HTMLTrackElement.readyState Read only
Returns  an unsigned short that show the readiness state of the track:
Constant Value Description
NONE 0 Indicates that the text track's cues have not been obtained.
LOADING 1 Indicates that the text track is loading and there have been no fatal errors encountered so far. Further cues might still be added to the track by the parser.
LOADED 2 Indicates that the text track has been loaded with no fatal errors.
ERROR 3 Indicates that the text track was enabled, but when the user agent attempted to obtain it, this failed in some way. Some or all of the cues are likely missing and will not be obtained.
HTMLTrackElement.track Read only
Returns TextTrack is the track element's text track data.
track Read only TextTrack The track element's text track data.


No specific method; inherits methods from its parent, HTMLElement.


Specification Status Comment
WHATWG HTML Living Standard
The definition of 'HTMLTrackElement' in that specification.
Living Standard No change from HTML5.
The definition of 'HTMLTrackElement' in that specification.
Recommendation Initial definition.

Browser compatibility

Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari (WebKit)
Basic support ? 24 (24)[1] ? ? ?
src attribute settable ? 50 (50)[2][3] ? ? ?
Feature Android Firefox Mobile (Gecko) IE Phone Opera Mobile Safari Mobile
Basic support ? 24.0 (24)[1] ? ? ?
src attribute settable ? 50.0 (50)[2][3] ? ? ?

[1] The HTMLTrackElement interface was added in Firefox 24, but was disabled by default behind the preference media.webvtt.enabled. The interface is enabled by default (along with all other WebVTT features) in Firefox 31.

[2] Until Firefox 50, the src attribute is settable, but the change does not get handled properly. Starting in Firefox 50, existing track data is properly disposed of, new track data is loaded and put into effect, and so forth.

[3] Prior to Firefox 50, text tracks would only load if the <track> is in a document. Starting in Firefox 50, this incorrect requirement is lifted.

See also

  • The HTML element implementing this interface: <track>.


© 2016 Mozilla Contributors
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.

API HTML DOM HTMLTrackElement Interface NeedsNewLayout Reference