Audio muted attribute

Definition and usage

muted The attribute sets or returns whether the audio output should be muted (sound off).

This attribute reflects <audio> muted attribute.

When set, it specifies that the audio output should be muted.

Example

Example 1

Turn off the sound:

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

Try it yourself

Example 2

Check if the sound is off:

var x = document.getElementById("myAudio").muted;

Try it yourself

Syntax

Return the muted attribute:

audioObject.muted

Set the muted attribute:

audioObject.muted = true|false

attribute value

value description
true|false

Définit si l'audio devrait être muet ou non.

  • true - indique que l'audio devrait être fermé
  • false - par défaut. Indique que l'audio devrait être ouvert

Détails techniques

Valeur de retour : Valeur booléenne, retourne true si la sortie audio est muette, sinon retourne false.
Valeur par défaut : false

Support du navigateur

Chrome Edge Firefox Safari Opera
Chrome Edge Firefox Safari Opera
Support Support Support Support Support

Pages associées

Manuel de référence HTML :Attribut muted de l'élément <audio> HTML