Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

HTML Audio/Video DOM volume Property

HTML Audio/Video DOM volume Property

HTML audio/video Tag Reference HTML Audio/Video DOM Reference

Example

Set the video volume to 20%:

myVid=document.getElementById("video1");

myVid.volume=0.2;

Try it »


Definition and Usage

The volume property sets or returns the current volume of the audio/video.


Browser support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support the volume attribute.

**Note:** Internet Explorer 8 and earlier versions do not support this property.


Syntax

Set the volume attribute:

audio|video

.volume=

volumevalue

Return the volume attribute:

audio|video

.volume

Attribute values

Value Description
volumevalue Specifies the current volume of the audio/video. Must be a number between 0.0 and 1.0.
 例值:     
  • 1.0 Highest volume (default)
  • 0.5 Half volume (50%)
  • 0.0 Mute
  • |

    Technical Details

    Return Value: A numeric value indicating the current volume.
    Default value: 1.0

    HTML audio/video Tag Reference HTML Audio/Video DOM Reference