Audio played attribute
Example
Get the first played range of the audio, in seconds (part):
var x = document.getElementById("myAudio");
document.getElementById("demo").innerHTML = "Start: " + x.played.start(0)
- " End: " + x.played.end(0)
x Output:
Start: 0 End: 2.162583
Try it »
Definition and Usage
The played attribute returns a TimeRanges object.
The TimeRanges object represents the ranges of the audio that the user has played or viewed.
A played range refers to the time range of the played audio. If the user jumps within the audio, multiple played ranges are obtained.
Note: This property is read-only.
Browser support





All major browsers support the played attribute.
Note: Internet Explorer 8 and earlier IE versions do not support this attribute.
Syntax
audioObject
.played
Return Value
| Type | Description |
|---|---|
| TimeRanges Object |
Represents the played range of the audio. TimeRanges object properties: |
Note:The index of the first played range is 0.
|
Audio object