RTCMultiConnection Docs

RTCMultiConnection API Reference / "removeStream" method

v2.0.* updates:

// remove all screen streams.
// you can use "remove all video streams" by passing "video"
// or "remove all audio streams" by passing "audio"
connection.removeStream('screen');

// remove-all but multiple streams
// i.e. remove all audio and video streams
// or remove all audio and screen streams
connection.removeStream({
    screen: true,
    audio: true
});
  1. When renegotiating; a common scenario is to remove existing media streams; and renegotiate new ones.
  2. // remove a media-stream by id
    connection.removeStream('stream-id');
    
  3. You can use detachStreams array to remove multiple media streams:
    // remove multiple media-streams
    connection.detachStreams.push('first-stream-id', 'second-stream-id');
    

Renegotiation:

  1. Renegotiation is a process allows you modify pre-created peer connections when you want to:
    1. append additional streams
    2. remove existing streams
    3. modify SDP for peers direction or something else
  2. Renegotiation means re-exchanging offer/answer SDP among peers.
  3. Renegotiation means you want to use same peer-connections to append dynamic streams at runtime.
  4. // runtime sharing of audio/video among all users
    connection.addStream({
        audio: true,
        video: true
    });
    
    // runtime sharing of screen among two unique users
    // one is you; and other is person whose id is given below
    connection.peers['user-id'].addStream({
        screen: true,
        oneway: true
    });
    
  5. Remember, renegotiation means: use existing peer connections to negotiate session descriptions.

Useful Resources

  1. How to switch streams?
  2. Renegotiation in RTCMultiConnection
  3. addStream
  4. sendCustomMessage

Want to ask a Question?

You can include your email for private conversation!