<video ontimeupdate="myFunction(this)"> - Javascript DOM Event

Javascript examples for DOM Event:ontimeupdate

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 controls ontimeupdate="myFunction(this)">
  <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 .  ja v a 2 s  . co  m*/

<p>Playback position: <span id="demo"></span></p>

<script>
function myFunction(event) {
    document.getElementById("demo").innerHTML = event.currentTime;
}
</script>

</body>
</html>

Related Tutorials