HTML DOM Video seekable 属性
HTML DOM Video seekable 属性返回一个 TimeRanges 对象,其中包含有关视频的可寻址范围的长度及其开始和结束位置的信息。
语法
以下是语法 −
返回 TimeRanges 对象
mediaObject.seekable
让我们看一个 Video seekable 属性的示例 −
示例
<!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://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>
输出
在单击 ‘How much free view time is left?’ 按钮之前−
在单击 ‘How much free view time is left?’ 按钮之后 −
广告