This page is Ready to Use

Notice: The WebPlatform project, supported by various stewards between 2012 and 2015, has been discontinued. This site is now available on github.

TextTrackCue

Summary

A text track cue is the unit of time-sensitive data in a text track corresponding, for instance, for subtitles and captions to the text that appear at a particular time and disappear at another time.

Properties

align
A string representing the text track cue alignment, as follows. If it is start alignment: the string "start". If it is middle alignment: the string "middle". If it is end alignment: the string "end". If it is left alignment: the string "left". If it is right alignment: the string "right". Default is "middle".
endTime
The text track cue end time, in seconds.
id
Gets or sets a text track cue identifier.
line
The text track cue line position. In the case of the value being auto, the string “auto” is returned.
pauseOnExit
Returns the pause-on-exit flag on a TextTrackCue. When the flag is true, playback will pause when it reaches the cue’s endTime.
position
The text track cue text position.
size
The text track cue size.
snapToLines
Returns the text track cue snap-to-lines flag setting.
startTime
The text track cue start time, in seconds.
text
The text track cue text in raw, unparsed form.
track
Returns the TextTrack object to which this text track cue belongs, if any, or null otherwise.
vertical
A string representing the text track cue writing direction, as follows. If it is horizontal: The empty string. If it is vertical growing left: The string "rl". If it is vertical growing right: The string "lr".

Methods

getCueAsHTML
Returns the text track cue text as a DocumentFragment of HTML elements and other DOM nodes.

Events

No events.

Notes

Individual cues are returned from a TextTrackCueList object (collection of cues). Cues can also be created and added to a track.

Related specifications

W3C HTML5 Specification
W3C Editor’s Draft

Attributions