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 July 2015.
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 Extensions™ # htmlmediaelement-extensions-seekable |
Browser compatibility
Report problems with this compatibility data on GitHubdesktop | mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
seekable |
Legend
Tip: you can click/tap on a cell for more information.
- Full support
- Full support
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.
See also
- The interface defining it,
HTMLMediaElement
. - Media Source Extensions API