Javascript DOM onseeked Event on <audio> element

Introduction

Execute a JavaScript when the user is finished moving to a new position in the audio:

This example demonstrates how to assign an "onseeked" event to an audio element.

View in separate window

<!DOCTYPE html>
<html>
<body>
<p>Move to a new position in the video.</p>

<audio controls onseeked="myFunction()">
  <source src="sound.ogg" type="audio/ogg">
  <source src="sound.mp3" type="audio/mpeg">
  Your browser does not support the audio element.
</audio>/*  ww w .ja  v  a  2s .  c om*/

<p id="demo"></p>
<script>
function myFunction() {
  document.getElementById("demo").innerHTML = "Seek operation completed!";
}
</script>

</body>
</html>



PreviousNext

Related