Javascript examples for DOM HTML Element:Video
The buffered property returns a TimeRanges object, which represents the user's buffered ranges of the video.
This property is read-only.
Type | Description |
---|---|
TimeRanges Object | Represents the buffered parts of the video. |
TimeRanges Object Properties:
The first buffered range is index 0
The following code shows how to get the first buffered range of the video in seconds:
<!DOCTYPE html> <html> <body> <video id="myVideo" width="320" height="240" controls> <source src="your.mp4" type="video/mp4"> <source src="your.ogg" type="video/ogg"> Your browser does not support the video tag. </video>/* w w w. ja v a2s .c o m*/ <button onclick="myFunction()">Test</button> <p id="demo"></p> <script> function myFunction() { var x = document.getElementById("myVideo"); document.getElementById("demo").innerHTML = "Start: " + x.buffered.start(0) + " End: " + x.buffered.end(0); } </script> </body> </html>