Latest web development tutorials

HTML DOM Audio volume property

Audio Object Reference Audio Object

Examples

The audio volume set to 20%:

document.getElementById("myAudio").volume = 0.2;

try it"

Definition and Usage

volume property sets or returns the volume of the audio from 0.0 (silence) to 1.0 (loudest).

Note: <audio> elements in HTML5 is new.


Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support volume attributes.

Note: Internet Explorer 8 or earlier browser does not support this property.


grammar

Returns volume attributes:

audioObject .volume

Setting volume attributes:

audioObject .volume = number

Property Value

value description
volumevalue

The current provisions of the audio volume. It must be a number between 0.0 and 1.0.

Example value:

  • 1.0 is the highest volume (default)
  • 0.5 is half the volume (50%)
  • 0.0 Mute

technical details

return value: Numeric value that represents the volume of the audio.
Default Value: 1.0


Audio Object Reference Audio Object