HTML DOM Audio played Property
Example
Get the first played range (part) of the audio in seconds:
var x = document.getElementById("myAudio");
document.getElementById("demo").innerHTML = "Start: " + x.played.start(0)
+ " End: " + x.played.end(0)
x output will be:
Start: 0 End: 2.162583
Definition and Usage
The played property returns a TimeRanges object.
The TimeRanges object represents the ranges of the audio that the user has played or seen.
A played range is a time range of the audio that has been played. If the user jumps around in the audio, you will get multiple played ranges.
Note: This property is read-only.
Browser Support
All major browsers support the played property.
Note: Internet Explorer 8 and earlier versions do not support this property.
Syntax
audioObject.played
Return Value
| Type | Description |
|---|---|
| TimeRanges Object | Represents the played ranges of the audio. The properties of the TimeRanges object are:
|
YouTip