HTML Audio/Video DOM volume attribute
Example
Set the video volume to 20%:
myVid=document.getElementById("video1"); myVid.volume=0.2;
Definition and Usage
The volume attribute sets or returns the current volume of audio/video.
Browser Support
All major browsers support the volume attribute.
Note:Internet Explorer 8 and earlier browsers do not support this attribute.
Syntax
Sets the volume attribute:
audio|video.volume=volumevalue
Returns the volume attribute:
audio|video.volume
Attribute value
Value | Description |
---|---|
volumevalue |
Specifies the current volume of audio/video. It must be a number between 0.0 and 1.0. Example value:
|
Return value
Type | Description |
---|---|
Numeric value | Indicates the current volume. Default value: 1.0. |