English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

HTML Reference Manual

HTML Tag大全

HTML Audio/Video DOM defaultMuted attribute

The defaultMuted attribute reflects the silent state of the HTML attribute, indicating whether the audio output of the media element should be muted by default. This attribute has no dynamic effect. To mute and unmute the audio output, please use the mute attribute.

 HTML Audio/Video DOM Reference Manual

Online Example

Set video to default muted:

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>HTML Audio/video defaultMuted attribute usage-Basic Tutorial(oldtoolbag.com)</<title>
</<head>
<body>
<button onclick="getMuted()" type="button">Is the video muted by default?</button>
<button onclick="setToMuted()" type="button">Set video to default muted state and reload video</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("video"1);
function getMuted()
{ 
  alert(myVid.defaultMuted);
} 
function setToMuted()
{ 
  myVid.defaultMuted=true;
  myVid.load()
} 
</script>  
</body>
</html>
Test to see ‹/›

Definition and Usage

The defaultMuted attribute sets or returns whether audio should be muted by default/video.


Setting this attribute will only change the default muted state, not the current muted state. To change the current muted state, please use muted (Muted)attribute.

Browser Compatibility

IEFirefoxOperaChromeSafari

Only Chrome and Safari 6 Supports defaultMuted attribute.

Syntax

Set defaultMuted attribute:

audio|video.defaultMuted=true|false

Return defaultMuted attribute:

audio|video.defaultMuted

Attribute value

ValueDescription
trueIndicates audio/The video is muted by default.
falseDefault. Indicates audio/The video is not muted by default.

Technical Details

Return value:Boolean value, true|false
Default value:false
 HTML Audio/Video DOM Reference Manual