The muted
property turns on and off audio sound.
This property mirrors the <audio> muted
attribute.
If present, the <audio> muted
attribute can turn on/off that the audio sound.
Property Values
Value | Description |
---|---|
true | turned OFF the audio |
false | Default. turn ON the audio |
It returns a boolean.
It returns true if the audio output is muted, otherwise it returns false.
Find out if the sound is turned off:
var x = document.getElementById("myAudio").muted;
Click the button to find out if the sound is on mute.
<!DOCTYPE html> <html> <body> <audio id="myAudio" controls muted> <source src="sound.ogg" type="audio/ogg"> <source src="sound.mp3" type="audio/mpeg"> Your browser does not support the audio element. </audio><br> <button onclick="myFunction()">Test</button> <p id="demo"></p> <script> function myFunction() {/* w w w . j a v a 2 s. c o m*/ var x = document.getElementById("myAudio").muted; document.getElementById("demo").innerHTML = x; } </script> </body> </html>