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.
Syntax
var seekable = audioOrVideo.seekable;
Value
A TimeRanges
object.
Examples
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(); } });
Specifications
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 compatibility
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari (WebKit) |
---|---|---|---|---|---|
Basic support | (Yes) | 8.0 (8.0) | 9 | ? | ? |
Using seekable along with MSE |
23 | 25.0 (25.0)[1] 42.0 (42.0) |
11[2] | 15 | 8 |
Feature | Android | Firefox Mobile (Gecko) | Firefox OS (Gecko) | IE Phone | Opera Mobile | Safari Mobile |
---|---|---|---|---|---|---|
Basic support | (Yes) | 8.0 (8.0) | (Yes) | ? | ? | ? |
Using seekable along with MSE |
4.4.4 |
Not supported |
Not supported | 11 | 30 | Not supported |
[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 also
- The interface defining it,
HTMLMediaElement
. - Media Source Extensions API
Document Tags and Contributors
Tags:
Contributors to this page:
jpmedley,
chrisdavidmills
Last updated by:
jpmedley,