HTML | DOM Audio muted Property

The Audio muted property is used to set or return whether the audio output should be muted or not.

Syntax:

  • It returns the muted property.
    audioObject.muted
  • It sets the muted property.
    audioObject.muted = true|false

Property Values: This property accept values true|false which is used to specify whether the audio output should be muted, or not.
Returns: The Audio muted property returns a Boolean value true if the audio is muted, otherwise, it returns false.
Below program illustrates the Audio muted Property in HTML DOM:



Example: This example turn off the audio sound.

filter_none

edit
close

play_arrow

link
brightness_4
code

<!DOCTYPE html>
<html>
      
<head>     
    <title>
        HTML DOM Audio muted Property
    </title>
</head>
  
<body style="text-align:center;">
  
    <h1 style="color:green;">
        GeeksforGeeks
    </h1
      
    <h2 style="font-family: impact;">
        Audio muted Property
    </h2><br>
      
    <audio id="Test_Audio" controls>
        <source src="gfg.ogg" type="audio/ogg">
        <source src="gfg.mp3" type="audio/mpeg">
    </audio>
      
    <p>
        For muting the audio, double click
        the "Enable Mute" button.
    </p>
    <br>
      
    <button ondblclick="MyAudio()" type="button">
        Enable Mute
    </button>
      
    <script>
        var a = document.getElementById("Test_Audio");
          
        function MyAudio() { 
            a.muted = true;
            alert(a.muted);
        
    </script>
</body>
  
</html>                                                       

chevron_right


Output:

  • Before Clicking on the button:
  • After clicking on the button:

Supported Browsers: The browsers supported by DOM Audio muted property are listed below:

  • Google Chrome
  • Internet Explorer
  • Firefox
  • Apple Safari
  • Opera


My Personal Notes arrow_drop_up

I am a technology enthusiast who has a keen interest in programming I am pursuing Engineering in Computer Science from GEU, Dehradun I like to unwind by watching movies and English sitcomsI have a keen interest in music

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.




Article Tags :
Practice Tags :


Be the First to upvote.


Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.