Javascript DOM HTML Audio paused Property get

Introduction

Find out if the audio is paused:

var x = document.getElementById("myAudio").paused;

Click the button to find out if the audio is paused.

View in separate window

<!DOCTYPE html>
<html>
<body>

<audio id="myAudio" controls>
  <source src="sound.ogg" type="audio/ogg">
  <source src="sound.mp3" type="audio/mpeg">
  Your browser does not support the audio element.
</audio>/*from  www.  j av a  2  s .  co  m*/
<button onclick="myFunction()">Test</button>

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

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

</body>
</html>

The paused property returns whether the audio is paused.

This property is read-only.

It returns a boolean.

It returns true if the audio is paused. Otherwise it returns false




PreviousNext

Related