English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

HTML Reference Manual

HTML Tag Reference

HTML Audio/Video DOM played property

 HTML Audio/Video DOM Reference Manual

Online Example

Get the first played range of the video in seconds (part):

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>HTML Audio/Video played property usage-Basic Tutorial(oldtoolbag.com)</title>
</head>
<body>
<button onclick="getFirstPlayedRange()" type="button">Get the first played range in seconds of the video</button>
<br> 
<video id="video1" controls="controls">
  <source src="movie.mp4" type="video/mp4">
  <source src="movie.ogg" type="video/ogg">
  Your browser does not support HTML5 video  tag.
</video>
<script>
myVid=document.getElementById("video1");
function getFirstPlayedRange()
{ 
  alert("Start: " + myVid.played.start(0) + " End: "  + myVid.played.end(0));
} 
</script> 
</body>
</html>
Test and see ‹/›

Definition and Usage

The played property returns a TimeRanges object.
TimeRanges object represents the audio played (seen) by the user/video range.
The play range is the audio played/The time range of the video. If the user skips the audio/If the video is played, multiple play ranges will be obtained.
Note: This property is read-only

Browser Compatibility

IEFirefoxOperaChromeSafari

All major browsers support the played property.

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

Syntax

audio|video.played

Return value

TypeDescription
TimeRanges objectRepresents audio/The played range of the video.

Properties of TimeRanges object:

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

 HTML Audio/Video DOM Reference Manual