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).
Syntax
const mutedFlag = track.muted
Value
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.
Example
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;
}
});
Specifications
Specification | Status | Comment |
Media Capture and StreamsThe definition of 'muted' in that specification. | Candidate Recommendation | Initial definition. |
Browser compatibility
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.
Update compatibility data on GitHub
Desktop | Mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
muted
|
Chrome
Full support Yes |
Edge
Full support 12 |
Firefox
Full support 59 |
IE
No support No |
Opera
Full support Yes |
Safari
Full support Yes |
WebView Android
Full support Yes |
Chrome Android
Full support Yes |
Firefox Android
Full support 59 |
Opera Android
Full support Yes |
Safari iOS
Full support Yes |
Samsung Internet Android
Full support Yes |
Legend
- Full support
- Full support
- No support
- No support
MediaStreamTrack.muted by Mozilla Contributors is licensed under CC-BY-SA 2.5.