Movatterモバイル変換


[0]ホーム

URL:


  1. Web
  2. Web APIs
  3. VTTCue
  4. VTTCue()

VTTCue: VTTCue() constructor

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since January 2020.

TheVTTCue() constructor creates and returns a newVTTCue object.

Syntax

js
new VTTCue(startTime, endTime, text)

Parameters

startTime

This is adouble representing the initial text track cue start time.This is the time, given in seconds and fractions of a second, denoting the beginningof the range of the media data to which this cue applies. For example, if a cue is tobe visible from 50 seconds to a one minute, five and a half seconds in the media'splayback,startTime will be 50.0.

endTime

This is adouble representing the ending time for this text track cue.This is the time at which the cue should stop being presented to the user, given inseconds and fractions thereof. Given the example cue mentioned understartTime, the value ofendTime would be 65.5.

text

A string providing the text that will be shown during the timespan indicated bystartTime andendTime.

Return value

A newVTTCue object representing a cue which will be presented duringthe time span given.

Examples

js
// 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

Specification
WebVTT: The Web Video Text Tracks Format
# dom-vttcue-vttcue

Browser compatibility

Help improve MDN

Learn how to contribute

This page was last modified on byMDN contributors.


[8]ページ先頭

©2009-2026 Movatter.jp