Computer >> บทช่วยสอนคอมพิวเตอร์ >  >> การเขียนโปรแกรม >> HTML

คุณสมบัติ seeking ของ Video ใน HTML DOM

คุณสมบัติ seeking ของ HTML DOM Video ใช้สำหรับคืนค่า boolean (true/false) ที่บ่งชี้ว่าผู้ใช้กำลังเลื่อน (seeking) ตำแหน่งการเล่นวิดีโอไปตำแหน่งใหม่หรือไม่

ไวยากรณ์ (Syntax)

การคืนค่า Boolean

mediaObject.seeking

ตัวอย่างการใช้งาน

ตัวอย่างต่อไปนี้แสดงการใช้งานคุณสมบัติ HTML DOM Video seeking:

<!DOCTYPE html> <html> <head> <title>HTML DOM Video seeking</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-seeking</legend>          <video id="demo" width="320" onseeking="getTrackDetails()" onseeked="getTrackDetails()"          controls><source src="https://www.tutorialspoint.com/html5/foo.mp4"          type="video/mp4"></video><br>          <div id="divDisplay"></div>         </fieldset>    </form>    <script>       var divDisplay = document.getElementById("divDisplay");       var demo = document.getElementById("demo");       demo.autoplay =true;       function getTrackDetails() {          if(demo.seeking)             divDisplay.textContent = 'To understand the concept watch full video';       }    </script> </body> </html>

ผลลัพธ์

ก่อนและหลังการเลื่อนวิดีโอ:

คุณสมบัติ seeking ของ Video ใน HTML DOM

ระหว่างการเลื่อนวิดีโอ:

คุณสมบัติ seeking ของ Video ใน HTML DOM