Track kind 属性

定义和用法

kind 属性设置或返回轨道的 kind 属性值。

HTML kind 属性规定文本轨道的种类。

另请参阅:

HTML 参考手册:HTML <track> kind attribute

实例

例子 1

获取文本轨道的种类:

var x = document.getElementById("myTrack").kind;

x 的结果可能是:

subtitles

例子 2

设置文本轨道的种类:

document.getElementById("myTrack").kind = "chapters";

语法

返回 kind 属性:

trackObject.kind

设置 kind 属性:

trackObject.kind = "captions|chapters|descriptions|metadata|subtitles"

属性值

描述
captions 轨道定义对话和音效的翻译(适合聋人用户)。
chapters 轨道定义章节标题(适合导航媒体资源)。
descriptions Track defines the text description of video content (suitable for blind users).
metadata Track defines the content used by the script. Not visible to users.
subtitles Track defines subtitles, used to display subtitles in videos.

Technical details

Return value: String value, indicating the type of text track.

Browser support

Chrome Edge Firefox Safari Opera
Chrome Edge Firefox Safari Opera
Supported 10.0 Not supported Not supported Supported