Using Video Object currentTime property to get current playtime position when moving/skipping to a new position: - Javascript DOM Event

Javascript examples for DOM Event:onseeked

Description

Using Video Object currentTime property to get current playtime position when moving/skipping to a new position:

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  w  w.j  a  v a  2s .  c  om

<p>Seeked to position: <span id="demo"></span></p>

<script>
var x = document.getElementById("myVideo");

x.addEventListener("seeked", myFunction);

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

</body>
</html>

Related Tutorials