HTML DOM
HTMLMediaElement的只读属性 seekable 返回一个包含了用户可以跳转到的时刻的区域(如果有)的TimeRanges对象。
Syntax
var seekable = audioOrVideo.seekable;
值
一个TimeRanges对象。
示例
var video = document.querySelector("video");
var timeRangesObject = video.seekable;
var timeRanges = [];
//遍历所有时间区域并输出数组
for (let count = 0; count < timeRangesObject.length; count++) {
timeRanges.push([timeRangesObject.start(count), timeRangesObject.end(count)]);
}
Specifications
Browser compatibility
See also
- The interface defining it, HTMLMediaElement.
- Media Source Extensions API
来源:MDN Web Docs / Mozilla 贡献者 · 作者与贡献记录 · CC BY-SA 2.5。离线整理了版式、链接和媒体显示。
