The seekable
read-only property of the HTMLMediaElement
returns a TimeRanges
object that contains the time ranges that the user is able to seek to, if any.
SyntaxEdit
var seekable = audioOrVideo.seekable;
Value
A TimeRanges
object.
ExamplesEdit
This example will listen for audio data to be loaded for the element `example`. It will then check if at least the current playback position has been loaded. If it has, the audio will play.
<audio id="example" preload="auto">
<source src="sound.ogg" type="audio/ogg" />
</audio>
var obj = document.getElementById('example');
obj.addEventListener('loadeddata', function() {
if(obj.readyState >= 2) {
obj.play();
}
});
SpecificationsEdit
Specification | Status | Comment |
---|---|---|
WHATWG HTML Living Standard The definition of 'HTMLMediaElement' in that specification. |
Living Standard | No change from HTML5 |
HTML5 The definition of 'HTMLMediaElement' in that specification. |
Recommendation | Initial definition. |
Media Source Extensions The definition of 'HTMLMediaElement extensions, like for seekable' in that specification. |
Candidate Recommendation | Specifies a new algorithm for returning the seekable time range of a media element whose source is a MediaSource object. |
Browser compatibilityEdit
[1] Available after switching the about:config
preference media.mediasource.enabled
to true
. In addition, support was limited to a whitelist of sites, for example YouTube, Netflix, and other popular streaming sites. The whitelist was removed and Media Source Extensions was enabled by default in 42+ for all sites.
[2] Only works on Windows 8+.
See alsoEdit
- The interface defining it,
HTMLMediaElement
. - Media Source Extensions API
Document Tags and Contributors
Tags:
Contributors to this page:
jpmedley,
chrisdavidmills
Last updated by:
jpmedley,