HTMLMediaElement.volume

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015.

HTMLMediaElement.volume 属性可设置媒体播放时的音量。

语法

var volume = video.volume; //1

取值为 0 到 1 的双精度值。0 为静音,1 为音量最大时的值。

示例

var obj = document.createElement('audio');
console.log(obj.volume); // 1
obj.volume = 0.75;

规范

Specification
HTML Standard
# dom-media-volume-dev

浏览器兼容性

BCD tables only load in the browser

更多