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. |
候选推荐 | 初始定义。 |
| 桌面 | 移动 | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
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 |
完整支持
不支持
MediaStreamTrack
AudioStreamTrack
BlobEvent
CanvasCaptureMediaStream
ConstrainBoolean
ConstrainDOMString
ConstrainDouble
ConstrainLong
DoubleRange
HTMLCanvasElement.captureStream()
LongRange
MediaDevices
MediaStream
MediaStreamTrackEvent
MediaTrackCapabilities
MediaTrackConstraints
MediaTrackSettings
MediaTrackSupportedConstraints
Navigator.mediaDevices
NavigatorUserMedia
NavigatorUserMediaError
VideoStreamTrack
navigator.mediaDevices.getUserMedia()