Get the first seekable range (part) of the video in seconds:
Click the button to get the first seekable range of the video in seconds.
<!DOCTYPE html> <html> <body> <video id="myVideo" width="100" height="100" controls> <source src="video.mp4" type="video/mp4"> <source src="video.ogg" type="video/ogg"> Your browser does not support the video tag. </video>//from w w w . j a v a2s . c om <button onclick="myFunction()">Test</button> <p id="demo"></p> <script> function myFunction() { var x = document.getElementById("myVideo"); document.getElementById("demo").innerHTML = "Start: " + x.seekable.start(0) + " End: " + x.seekable.end(0); } </script> </body> </html>
The seekable property returns a TimeRanges object.
The TimeRanges object represents ranges of the video that are available for seeking for user.
This property is read-only.
Return Value
Type | Description |
---|---|
TimeRanges Object | Represents the seekable parts of the video. TimeRanges Object Properties: length - get the number of seekable ranges in the video start(index) - get the start position of a seekable range end(index) - get the end position of a seekable range Note: The first seekable range is index 0 |