WebVTT
The VTTCue() constructor creates and returns a new
VTTCue object.
Syntax
new VTTCue(startTime, endTime, text)
Parameters
startTime- : This is a
doublerepresenting the initial text track cue start time. This is the time, given in seconds and fractions of a second, denoting the beginning of the range of the media data to which this cue applies. For example, if a cue is to be visible from 50 seconds to one minute, five and a half seconds in the media's playback,startTimewill be 50.0.
- : This is a
endTime- : This is a
doublerepresenting the ending time for this text track cue. This is the time at which the cue should stop being presented to the user, given in seconds and fractions thereof. Given the example cue mentioned understartTime, the value ofendTimewould be 65.5.
- : This is a
text- : A string providing the text that will be shown during the time
span indicated by
startTimeandendTime.
- : A string providing the text that will be shown during the time
span indicated by
Return value
A new VTTCue object representing a cue which will be presented during the time span given.
Examples
// Create a cue that is shown from 2 to 3 seconds and uses the given text.
let cue = new VTTCue(2, 3, "Cool text to be displayed");
Specifications
Browser compatibility
来源:MDN Web Docs / Mozilla 贡献者 · 作者与贡献记录 · CC BY-SA 2.5。离线整理了版式、链接和媒体显示。
