Javascript examples for DOM Event:addEventListener
The ontimeupdate event occurs when the playing position of an audio/video has changed.
Bubbles | No |
---|---|
Cancelable | No |
Supported HTML tags: | <audio> and <video> |
<!DOCTYPE html> <html> <body> <video id="myVideo" controls> <source src="your.mp4" type="video/mp4"> <source src="your.ogg" type="video/ogg"> Your browser does not support HTML5 video. </video>//from w w w. j ava 2 s . co m <p>Playback position: <span id="demo"></span></p> <script> var x = document.getElementById("myVideo"); x.addEventListener("timeupdate", myFunction); function myFunction() { document.getElementById("demo").innerHTML = x.currentTime; } </script> </body> </html>