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 |
浏览器兼容性
BCD tables only load in the browser
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.
更多
- 定义该属性的接口
HTMLMediaElement
. HTMLMediaElement.muted