Audio mutedProperty

Audio 对象参考手册Audio Object

Examples

Mute audio:

document.getElementById("myAudio").muted = true;

Try it Yourself »

Definition and Usage

The muted property sets or returns whether the audio should be muted (sound turned off).

This property reflects the <audio> muted attribute.

This attribute specifies that the audio is muted.

Note:The <audio> element is new in HTML5.


Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support the muted property.

Note:Internet Explorer 8 and earlier IE versions do not support the <audio> element.


Syntax

Return the muted property:

audioObject.muted

Set the muted property:

audioObject.muted=true|false

Property Values

Value Description
true|false Specifies whether the output audio should be muted:
  • true - Indicates that the audio sound should be turned off.
  • false - Default. Indicates that the audio sound is turned on.

Technical Details

Return Value: A Boolean, returning true if the audio output is muted, otherwise false.
Default Value: false


More Examples

Example

Detect if the sound is turned off:

var x = document.getElementById("myAudio").muted;
xThe result is:
true

Try it Yourself »


Related Pages

HTML Reference:HTML <audio> muted Attribute


Audio 对象参考手册Audio Object Other Extensions