HTMLMediaElement.seekable

您正在阅读此内容的英文版本,因为该语系尚未翻译。 帮助我们翻译此文章吧!

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

Specification Status Comment
HTML Living Standard
HTMLMediaElement
Living Standard No change from HTML5
HTML5
HTMLMediaElement
Recommendation Initial definition.
Media Source Extensions
HTMLMediaElement extensions, like for seekable
Recommendation Specifies a new algorithm for returning the seekable time range of a media element whose source is a MediaSource object.

Browser compatibility

Update compatibility data on GitHub
DesktopMobile
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung Internet
seekableChrome Full support 43Edge Full support 12Firefox Full support 8IE Full support 9Opera Full support YesSafari Full support YesWebView Android Full support YesChrome Android Full support YesFirefox Android Full support 8Opera Android ? Safari iOS ? Samsung Internet Android ?

Legend

Full support  
Full support
Compatibility unknown  
Compatibility unknown

See also