Javascript DOM HTML Audio seeking Property get

Introduction

Display if the user is seeking in the audio:

View in separate window

<!DOCTYPE html>
<html>
<body>

<audio id="myAudio" controls onseeking="myFunction()" 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>//from ww  w . j a va 2s . c om

<p id="demo"></p>

<script>
function myFunction() {
  var x = document.getElementById("myAudio");
  document.getElementById("demo").innerHTML= "Seeking: " + x.seeking;
}
</script>

</body>
</html>

The seeking property returns if the user is currently seeking in the audio.

Seeking action is moving or skipping to a new position in the audio.

This property is read-only.

It returns true if the user is currently seeking, otherwise it returns false.




PreviousNext

Related