TextTrackCueList: length 属性
基线 广泛可用
此功能已建立良好,可在许多设备和浏览器版本上运行。自 2015 年 7 月.
报告反馈
值
length
是 TextTrackCueList
接口的只读属性,它返回列表中提示的数量。
示例
一个 unsigned long
,表示列表中提示的数量。
WEBVTT first 00:00:00.000 --> 00:00:00.999 line:80% Hildy! second 00:00:01.000 --> 00:00:01.499 line:80% How are you? third 00:00:01.500 --> 00:00:02.999 line:80% Tell me, is the ruler of the universe in? fourth 00:00:03.000 --> 00:00:04.299 line:80% Yes, they're in - in a bad humor fifth 00:00:04.300 --> 00:00:06.000 line:80% Somebody must've stolen the crown jewels
TextTrack.cues
属性返回一个 TextTrackCueList
,其中包含该特定音轨的当前提示。调用 cues.length
将返回列表中提示的数量。使用下面的 WebVTT 音轨,length
的值为 5。const video = document.getElementById("video");
video.onplay = () => {
console.log(video.textTracks[0].cues.length); // 5
};
规范
js |
---|
规范 # HTML 标准 |
浏览器兼容性
dom-texttrackcuelist-length