TextTrack - Web APIs 编辑

The TextTrack interface—part of the API for handling WebVTT (text tracks on media presentations)—describes and controls the text track associated with a particular <track> element.

Properties

This interface also inherits properties from EventTarget.

TextTrack.activeCues Read only
A TextTrackCueList object listing the currently active set of text track cues. Track cues are active if the current playback position of the media is between the cues' start and end times. Thus, for displayed cues such as captions or subtitles, the active cues are currently being displayed.
TextTrack.cues Read only
A TextTrackCueList which contains all of the track's cues.
TextTrack.id Read only
A DOMString which identifies the track, if it has one. If it doesn't have an ID, then this value is an empty string (""). If the TextTrack is associated with a <track> element, then the track's ID matches the element's ID.
TextTrack.inBandMetadataTrackDispatchType Read only
Returns a DOMString which indicates the track's in-band metadata track dispatch type. needs details
TextTrack.kind Read only
Returns a DOMString indicating what kind of text track the TextTrack describes. The value must be one of those in the TextTrackKind enum.
TextTrack.label Read only
A human-readable DOMString which contains the text track's label, if one is present; otherwise, this is an empty string (""), in which case a custom label may need to be generated by your code using other attributes of the track, if the track's label needs to be exposed to the user.
TextTrack.language Read only
A DOMString which specifies the text language in which the text track's contents is written. The value must adhere to the format specified in the Tags for Identifying Languages (BCP 47) document from the IETF, just like the HTML lang attribute. For example, this can be "en-US" for United States English or "pt-BR" for Brazilian Portuguese.
TextTrack.mode
A DOMString specifying the track's current mode. Changing this property's value changes the track's current mode to match. Permitted values are listed under Text track mode constants. The default is disabled, unless the <track> element's default Boolean attribute is specified, in which case the default mode is started.

Events

cuechange
Fired when cues are entered and exited. A given text cue appears when the cue is entered and disappears when the cue is exited.
Also available via the oncuechange property.

Methods

This interface also inherits methods from EventTarget.

TextTrack.addCue()
Adds a cue (specified as a TextTrackCue object to the track's list of cues.
TextTrack.removeCue()
Removes a cue (specified as a TextTrackCue object from the track's list of cues.

Example

tbd

Specifications

SpecificationStatusComment
HTML Living Standard
The definition of 'TextTrack' in that specification.
Living Standard

Browser compatibility

BCD tables only load in the browser

See also

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据

词条统计

浏览:106 次

字数:8586

最后编辑:7 年前

编辑次数:0 次

    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文