ontimeupdate = myFunction(); - Javascript DOM Event

Javascript examples for DOM Event:Element Event Attribute

Description

The ontimeupdate event occurs when the playing position of an audio/video has changed.

Summary

Bubbles No
Cancelable No
Supported HTML tags: <audio> and <video>

Demo Code

ResultView the demo in separate window

<!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>

Related Tutorials