English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
HTML Audio/Video DOM Reference Manual
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 ‹/›
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
IEFirefoxOperaChromeSafari
All major browsers support the played property.
Note:Internet Explorer 8 and earlier versions do not support this property.
audio|video.played
Type | Description |
---|---|
TimeRanges object | Represents audio/The played range of the video. Properties of TimeRanges object:
Note:The index of the first played range index Is 0. |