VTTCue() constructor creates and returns a new VTTCue 对象。

句法

 vttCue = new VTTCue(startTime, endTime, text);
					

参数

startTime
这是 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 a one minute, five and a half seconds in the media's playback, startTime will be 50.0.
endTime
这是 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 ,值对于 endTime would be 65.5.
text
DOMString providing the text that will be shown during the time span indicated by startTime and endTime .

返回值

新的 VTTCue object representing a cue which will be presented during the time span given.

范例

// Create a cue that is shown from 2 to 3 seconds and uses the given text.
var cue = new VTTCue(2, 3, 'Cool text to be displayed');
					

规范

规范 状态 注释
WebVTT: The Web Video Text Tracks Format
The definition of 'VTTCue()' in that specification.
候选推荐

浏览器兼容性

The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. 更新 GitHub 上的兼容性数据
桌面 移动
Chrome Edge Firefox Internet Explorer Opera Safari Android webview Chrome for Android Firefox for Android Opera for Android Safari on iOS Samsung Internet
VTTCue() 构造函数 Chrome Yes Edge ≤79 Firefox Yes IE ? Opera Yes Safari ? WebView Android Yes Chrome Android Yes Firefox Android Yes Opera Android Yes Safari iOS ? Samsung Internet Android Yes

图例

完整支持

完整支持

兼容性未知 ?

兼容性未知

元数据

  • 最后修改: