Javascript DOM HTML Video muted Property get

Introduction

Find out if the sound is turned off:

var x = document.getElementById("myVideo").muted;

Click the button to find out if the audio output of the video is muted.

View in separate window

<!DOCTYPE html>
<html>
<body>

<video id="myVideo" width="100" height="100" controls muted>
  <source src="video.mp4" type="video/mp4">
  <source src="video.ogg" type="video/ogg">
  Your browser does not support the video tag.
</video>//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("myVideo").muted;
  document.getElementById("demo").innerHTML = x;
}
</script>

</body>
</html>



PreviousNext

Related