RTCMultiConnection Docs

RTCMultiConnection API Reference / "onmute" event

  1. "onmute" and "onunmute" will be auto fired:
  2. // 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');
    };
    
  3. You can mute/unmute/stop a single track; or both audio/video tracks.
  4. // mute
    connection.streams['stream-id'].mute({
        audio: true,
        video: true
    });
    
    // unmute
    connection.streams['stream-id'].unmute({
        audio: true
    });
    
    // stop a stream
    connection.streams['stream-id'].stop();
    
  5. You can mute all streams too:
  6. connection.streams.mute();
    
  7. You can mute all "remote" or "local" media streams too:
  8. connection.streams.mute({
        audio: true,
        video: true,
        type: 'remote'
    });
    

Want to ask a Question?

You can include your email for private conversation!