HTMLMediaElement:defaultMuted 属性

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.defaultMuted 属性反映了 HTML 属性 muted。该属性用于表明媒体元素的音频输出是否默认为静音。此属性没有动态效果,使用 muted 属性来静音和取消静音。

返回值

布尔值。true 值表明音频输出默认为静音。

示例

js
const videoEle = document.createElement("video");
videoEle.defaultMuted = true;
console.log(videoEle.outerHTML); // <video muted=""></video>

规范

Specification
HTML Standard
# dom-media-defaultmuted

浏览器兼容性

BCD tables only load in the browser

参见