muted 只读特性在 MediaStreamTrack interface returns a 布尔 value indicating whether or not the track is currently unable to provide media output.

To implement a way for users to mute and unmute a track, use the enabled property. When a track is disabled by setting enabled to false , it generates only empty frames (audio frames in which every sample is 0, or video frames in which every pixel is black).

句法

const mutedFlag = track.muted
					

A 布尔 which is true if the track is currently muted, or false if the track is currently unmuted.

When possible, avoid polling muted to monitor the track's muting status. Instead, add event listeners for the mute and unmute 事件。

范例

This example counts the number of tracks in an array of MediaStreamTrack objects which are currently muted.

let mutedCount = 0;
trackList.forEach((track) => {
  if (track.muted) {
    mutedCount += 1;
  }
});
					

规范

规范 状态 注释
媒体捕获和流
The definition of 'muted' in that specification.
候选推荐 初始定义。

浏览器兼容性

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. 更新 GitHub 上的兼容性数据
桌面 移动
Chrome Edge Firefox Internet Explorer Opera Safari Android webview Chrome for Android Firefox for Android Opera for Android Safari on iOS Samsung Internet
muted Chrome Yes Edge 12 Firefox 59 IE No Opera Yes Safari Yes WebView Android Yes Chrome Android Yes Firefox Android 59 Opera Android Yes Safari iOS Yes Samsung Internet Android Yes

图例

完整支持

完整支持

不支持

不支持

元数据

  • 最后修改: