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

HTML DOM Video volume Property

Video volume property

Video Object Reference The Video object

Example

Set the video volume to 20%:

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

Try it »


Definition and Usage

The volume property sets or returns the current volume of the video, from 0.0 (muted) to 1.0 (maximum).

Note:


Browser support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support the volume attribute.

Note: Internet Explorer 8 and earlier IE versions do not support


Syntax

Return the volume attribute:

videoObject

.volume

Set the volume attribute:

videoObject

.volume=

number

Attribute values

Value Description
number Specifies the current volume of the video. Must be a number between 0.0 and 1.0.
 实例 :     
  • 1.0 is the highest volume (default)
  • 0.5 is half volume (50%)
  • 0.0 is muted
  • |

    Technical Details

    Return Value: A number representing the volume of the video
    Default value: 1.0

    Video Object Reference The Video object