In JavaScript, using the addEventListener()
method:
object.addEventListener("seeking",
myScript);
This example uses the addEventListener()
method to attach a "seeking" event to a video element.
<!DOCTYPE html> <html> <body> <p>Move to a new position in the video.</p> <video controls id="myVideo"> <source src="video.mp4" type="video/mp4"> <source src="video.ogg" type="video/ogg"> Your browser does not support HTML5 video. </video>/*from w w w .j a v a 2 s. c om*/ <p id="demo"></p> <script> document.getElementById("myVideo").addEventListener("seeking", myFunction); function myFunction() { document.getElementById("demo").innerHTML = "Seek operation began!"; } </script> </body> </html>
Bubbles: | No |
---|---|
Cancelable: | No |
Event type: | Event |
Supported HTML tags: | <audio> and <video> |