Audio seekableProperty

Audio 对象参考手册Audio Object

Examples

Get the first addressable range of the audio in seconds (partial):

var x = document.getElementById("myAudio");
document.getElementById("demo").innerHTML = "Start: " + x.seekable.start(0)
+ " End: " + x.seekable.end(0);

xThe output value is:

Start: 0 End: 12.612

Try it yourself »

Definition and Usage

The seekable property returns a TimeRanges object.

The TimeRanges object represents the ranges of the audio that the user can seek.

An addressable range refers to the time range in which the user can seek (move the playback position) within the audio.

For streaming audio, you can usually seek to any position in the audio, even if it has not finished buffering.

Note:This property is read-only.


Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support the seekable property.

Note:Internet Explorer 8 or earlier browsers do not support this property.


Syntax

audioObject.seekable

Return Value

Type Description
TimeRanges object

Represents the addressable parts of the audio.

Properties of the TimeRanges object:

  • length - Gets the number of addressable ranges in the audio
  • start(indexstart(index) - Gets the start position of the addressable range
  • end(indexend(index) - Gets the end position of the addressable range

Note:The index of the first addressable range is 0.



Audio 对象参考手册Audio Object Other Extensions