YouTip LogoYouTip

Prop Audio Played

HTML DOM Audio played Property

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

Try it yourself Β»


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:
  • length - Gets the number of played ranges in the audio
  • start(index) - Gets the start position of a played range
  • end(index) - Gets the end position of a played range
Note: The index of the first played range is 0.

Audio Object

← Prop Audio PreloadProp Audio Playbackrate β†’