Javascript examples for DOM Event:Element Event Attribute
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 ww .j a v a2 s . c o m <p>Playback position: <span id="demo"></span></p> <script> var x = document.getElementById("myVideo"); x.ontimeupdate = function() {myFunction()}; function myFunction() { document.getElementById("demo").innerHTML = x.currentTime; } </script> </body> </html>