大网数据广告活动
Web 标准与前端开发

VTTCue: VTTCue() constructor

· 52CE 我爱测

The **`VTTCue()`** constructor creates and returns a new VTTCue object.

WebVTT

The VTTCue() constructor creates and returns a new VTTCue object.

Syntax

new VTTCue(startTime, endTime, text)

Parameters

  • startTime
    • : This is a double representing 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, startTime will be 50.0.
  • endTime
    • : This is a double 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 in seconds and fractions thereof. Given the example cue mentioned under startTime, the value of endTime would be 65.5.
  • text
    • : A string providing the text that will be shown during the time span indicated by startTime and endTime.

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。离线整理了版式、链接和媒体显示。

资料来源与适用范围

资料来源
MDN Web Docs / Mozilla 贡献者
适用范围
请按文中版本与环境说明核对
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 2.5

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。