Tryit Editor v2.3

Edit This Code:
<!DOCTYPE html> <html> <body> <p>In this example, we attach a "seeking" event to the video element. The currentTime property returns the current position (in seconds) of the video playback.</p> <p>Move to a new position in the video.</p> <video id="myVideo" width="320" height="176" controls> <source src="mov_bbb.mp4" type="video/mp4"> <source src="mov_bbb.ogg" type="video/ogg"> Your browser does not support HTML5 video. </video> <p>Seeked to position: <span id="demo"></span></p> <p>Video courtesy of <a href="http://www.bigbuckbunny.org/" target="_blank">Big Buck Bunny</a>.</p> <script> // Get the video element with id="myVideo" var vid = document.getElementById("myVideo"); // Attach a seeking event to the video element, and execute a function if a seek operation begins vid.addEventListener("seeking", myFunction); function myFunction() { // Display the current position of the video in a p element with id="demo" document.getElementById("demo").innerHTML = vid.currentTime; } </script> </body> <!-- Mirrored from www.w3schools.com/tags/tryit.asp?filename=tryhtml5_av_event_seeking_currenttime by HTTrack Website Copier/3.x [XR&CO'2014], Fri, 23 Jan 2015 08:10:22 GMT --> </html>
Result:
Try it Yourself - © w3schools.com