The HTML DOM Video seekable property returns a TimeRanges object containing information about the video’s seekable range length and its start, end position.
Syntax
Following is the syntax −
Returning TimeRanges Object
mediaObject.seekable
Let us see an example of Video seekable property −
Example
<!DOCTYPE html> <html> <head> <title>HTML DOM Video seekable</title> <style> * { padding: 2px; margin:5px; } form { width:70%; margin: 0 auto; text-align: center; } input[type="button"] { border-radius: 10px; } </style> </head> <body> <form> <fieldset> <legend>HTML-DOM-Video-seekable</legend> <video id="demo" width="320" controls><source src="https://www.tutorialspoint.com/html5/foo.mp4" type="video/mp4"></video><br> <input type="button" onclick="getTrackDetails()" value="How much free view time is left?"> <div id="divDisplay"></div> </fieldset> </form> <script> var divDisplay = document.getElementById("divDisplay"); var demo = document.getElementById("demo"); function getTrackDetails() { divDisplay.textContent = 'You are a premium viewer, so '+demo.seekable.start(0)+' - '+demo.seekable.end(0)+' are seekable'; } </script> </body> </html>
Output
Before Clicking ‘How much free view time is left?’ button −
After Clicking ‘How much free view time is left?’ button −