The muted read-only property of the MediaStreamTrack interface returns a Boolean 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).
mutedFlag = MediaStreamTrack.muted;
A Boolean 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 events.
This example counts the number of tracks in an array of MediaStreamTrack objects which are currently muted.
var mutedCount = 0;
trackList.forEach(function(track) {
if (track.muted) {
mutedCount += 1;
}
}); | Specification | Status | Comment |
|---|---|---|
| Media Capture and Streams The definition of 'muted' in that specification. | Candidate Recommendation | Initial definition. |
| Desktop | ||||||
|---|---|---|---|---|---|---|
| Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | |
| Basic support | Yes | 12 | 59 | No | Yes | ? |
| Mobile | |||||||
|---|---|---|---|---|---|---|---|
| Android webview | Chrome for Android | Edge Mobile | Firefox for Android | Opera for Android | iOS Safari | Samsung Internet | |
| Basic support | Yes | Yes | Yes | 59 | ? | ? | Yes |
© 2005–2018 Mozilla Developer Network and individual contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/MediaStreamTrack/muted