1. 面向开发者的 Web 技术
  2. Web API
  3. HTMLMediaElement
  4. HTMLMediaElement.volume

此页面由社区从英文翻译而来。了解更多并加入 MDN Web Docs 社区。

View in English Always switch to English

HTMLMediaElement.volume

Limited availability

This feature is not Baseline because it does not work in some of the most widely-used browsers.

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

浏览器兼容性

更多

Help improve MDN

Learn how to contribute

This page was last modified on by MDN contributors.

AltStyle によって変換されたページ (->オリジナル) /