此页面由社区从英文翻译而来。了解更多并加入 MDN Web Docs 社区。
HTMLMediaElement.seekable
Baseline
Widely available
This feature is well established and works across many devices and browser versions. It’s been available across browsers since 2015年7月.
HTMLMediaElement的只读属性 seekable 返回一个包含了用户可以跳转到的时刻的区域(如果有)的TimeRanges对象。
Syntax
var seekable = audioOrVideo.seekable;
值
一个TimeRanges对象。
示例
js
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
| Specification |
|---|
| HTML> # dom-media-seekable-dev> |
| Media Source ExtensionsTM> # htmlmediaelement-extensions-seekable> |
Browser compatibility
Enable JavaScript to view this browser compatibility table.
See also
- The interface defining it,
HTMLMediaElement. - Media Source Extensions API