TimeRanges: length 属性
TimeRanges.length 只读属性返回对象中范围的数量。
值
一个数字。
示例
给出一个 ID 为 "myVideo" 的视频元素
js
const v = document.getElementById("myVideo");
const buf = v.buffered;
const numRanges = buf.length;
if (buf.length === 1) {
// Only one range
if (buf.start(0) === 0 && buf.end(0) === v.duration) {
// The one range starts at the beginning and ends at
// the end of the video, so the whole thing is loaded
}
}
此示例查看时间范围,并检查是否已加载整个视频。
规范
| 规范 |
|---|
| HTML # dom-timeranges-length-dev |
浏览器兼容性
加载中…