Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

HTML DOM Audio played attribute

Audio played attribute

Audio Object Reference Audio object

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)

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

Internet ExplorerFirefoxOperaGoogle ChromeSafari

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:

  • length - get the number of played ranges in the audio
  • start(index) - get the start position of a played range
  • end(index) - get the end position of a played range
  • Note:The index of the first played range is 0.

    |

    Audio Object Reference Audio object