RTCMultiConnection Docs

RTCMultiConnection.mute "method"

HOME © Muaz Khan . @WebRTCWeb . Github . Latest issues . What's New?

RTCMultiConnection.mute method allows you mute any audio/video/screen stream.

Mute stream using v3

// you can pass: 'audio' || 'video' || 'both
connection.streamEvents['stream-id'].stream.mute('both');

connection.attachStreams.forEach(function(stream) {
  stream.mute(); // mute all tracks
});
You can pass "audio" or "video" or "both" or NULL.

Mute stream using v2

connection.streams['stream-id'].stream.mute({
  audio: true,
  video: true,
  type: 'remote' // all remote streams
});
You can pass following values:
  1. "Null": To mute all streams.
  2. "{audio:true}": To mute only audio streams.
  3. "{video:true}": To mute only video/screen streams.
  4. "{type:'remote'}": To mute only remote streams.
  5. "{type:'local'}": To mute only local streams.

onMute/OnUnMute events

// if local or remote stream is muted
connection.onmute = function(e) {
  e.mediaElement.setAttribute('poster', 'photo.jpg');
};

// if local or remote stream is unmuted
connection.onunmute = function(e) {
  e.mediaElement.removeAttribute('poster');
};

Latest Issues

Want to ask a Question?

You can include your email for private conversation!

Latest Updates