HTMLMediaElement.volume

翻译不完整。 请帮助我们翻译这篇文章!

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;

规范

规范 状态 备注
HTML Living Standard
HTMLMediaElement.volume
Living Standard
HTML5
HTMLMediaElement.volume
Recommendation

浏览器兼容性

Update compatibility data on GitHub
DesktopMobile
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung Internet
volumeChrome Full support 43Edge Full support 12Firefox Full support 3.5IE Full support 9Opera Full support YesSafari Full support 6WebView Android Full support YesChrome Android Full support YesFirefox Android Full support YesOpera Android Full support YesSafari iOS Full support YesSamsung Internet Android Full support Yes

Legend

Full support  
Full support

更多