Audio volume attribute
Example
Set the audio volume to 20%:
document.getElementById("myAudio").volume = 0.2;
Try it »
Definition and Usage
The volume attribute sets or returns the volume of the audio, from 0.0 (muted) to 1.0 (loudest).
Note:
Browser support





All major browsers support the volume attribute.
Note: Internet Explorer 8 or earlier browsers do not support this attribute.
Syntax
Return the volume attribute:
audioObject
.volume
Set the volume attribute:
audioObject
.volume=
number
Attribute values
| Value | Description |
|---|---|
| volumevalue |
Specifies the current volume of the audio. Must be a number between 0.0 and 1.0. Example values: |
Technical Details
| Return Value: | Numeric value representing the volume of the audio. |
|---|---|
| Default Value: | 1.0 |
Audio object