English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
muted indicates whether the media element is muted.
HTML Audio/Video DOM Reference Manual
Turn off the video sound:
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>HTML Audio/Video muted attribute usage-Basic Tutorial(oldtoolbag.com)</<title> </<head> <body> <button onclick="enableMute()" type="button">Mute</button> <button onclick="disableMute()" type="button">Enable Sound</button> <button onclick="checkMute()" type="button">Check Mute Status</button> <br> <video id="video1" controls="controls"> <source src="movie.mp4" type="video/mp4"> <source src="movie.ogg" type="video/ogg"> Your browser does not support HTML5 video tag. </video> <script> myVid=document.getElementById("video1"); function enableMute() { myVid.muted=true; } function disableMute() { myVid.muted=false; } function checkMute() { alert(myVid.muted); } </script> </body> </html>Test to see ‹/›
Mute attribute sets or returns whether the audio should be/Video mute (sound is off).
IEFirefoxOperaChromeSafari
All major browsers support the muted attribute.
Note:Internet Explorer 8 and earlier versions do not support this attribute.
Set the muted attribute:
audio|video.muted=true|false
Return the muted attribute:
audio|video.muted
Value | Description |
---|---|
true | Indicates that the audio should be muted/The sound of the video. |
false | Default. Indicates that the audio should be played/The sound of the video. |
Return value: | Boolean value, true|false |
---|---|
Default value: | false |