TextTrack interface—part of the API for handling WebVTT (text tracks on media presentations)—describes and controls the text track associated with a particular
This interface also inherits properties from
TextTrackCueListobject listing the currently active set of text track cues. Track cues are active if the current playback position of the media is between the cues' start and end times.
TextTrackCueListwhich contains all of the track's cues.
DOMStringwhich identifies the track, if it has one. If it doesn't have an ID, then this value is an empty string (
""). If the
TextTrackis associated with a
<track>element, then the track's ID matches the element's ID.
DOMStringwhich indicates the track's in-band metadata track dispatch type. needs details
DOMStringindicating what kind of text track the
TextTrackdescribes. The value must be one of those in the TextTrackKind enum.
DOMStringwhich contains the text track's label, if one is present; otherwise, this is an empty string (
""), in which case a custom label may need to be generated by your code using other attributes of the track, if the track's label needs to be exposed to the user.
DOMStringwhich specifies the text language in which the text track's contents is written. The value must adhere to the format specified in the Tags for Identifying Languages (BCP 47) document from the IETF, just like the HTML
langattribute. For example, this can be
"en-US"for United States English or
"pt-BR"for Brazilian Portuguese.
DOMStringspecifying the track's current mode. Changing this property's value changes the track's current mode to match. Permitted values are listed under Text track mode constants below.
EventHandlerspecifying a function to be called when a
cuechangeevent occurs. Handling these events lets you know when cues are entered and exited. A given text cue appears when the cue is entered and disappears when the cue is exited.
This interface also inherits methods from
TextTrackCueobject to the track's list of cues.
TextTrackCueobject from the track's list of cues.
|WebVTT: The Web Video Text Tracks Format||Draft|
|Feature||Chrome||Edge||Firefox (Gecko)||Internet Explorer||Opera||Safari (WebKit)|
|Feature||Android||Chrome||Firefox Mobile (Gecko)||Firefox OS||IE Phone||Opera Mobile||Safari Mobile|
|Basic support||4.4||18||31||?||No support||No support||7.1|
||?||?||47||?||No support||No support||?|
 Firefox versions before FIrefox 50 didn't display captions when playing media without one or more video tracks being played.
© 2005–2018 Mozilla Developer Network and individual contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.