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;
规范
Specification |
---|
HTML # dom-media-volume-dev |
浏览器兼容性
Report problems with this compatibility data on GitHubdesktop | mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
volume |
Legend
Tip: you can click/tap on a cell for more information.
- Full support
- Full support
- Partial support
- Partial support
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