HTML Audio/Video DOM played attribute

Example

Obtain the range of the first segment played in the video in seconds (partial):

myVid=document.getElementById("video1");
alert("Start: " + myVid.played.start(0) + " End: " + myVid.played.end(0));

Try It Yourself

Definition and Usage

The played property returns a TimeRanges object.

The TimeRanges object represents the audio/video range that the user has played or seen.

The played range refers to the time range of the played audio/video. If the user jumps in the audio/video, multiple played ranges will be obtained.

Browser Support

Chrome, Safari, and Internet Explorer support the played property.

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

Syntax

audio|video.played

Return value

Type Description
TimeRanges object

Represents the played range of audio/video.

Properties of TimeRanges object:

  • length - Get the number of played ranges in audio/video
  • 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.