RTCMultiConnection Docs

RTCMultiConnection API Reference / "detachStreams"

  1. When renegotiating; a common scenario is to remove existing media streams; and renegotiate new ones.
  2. detachStreams array allows you detach multiple media streams:
    // remove multiple media-streams
    connection.detachStreams.push('first-stream-id', 'second-stream-id');
    
  3. You can remove single media stream using removeStream method:
    // remove a media-stream by id
    connection.removeStream('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. // DTLS/SRTP must be false for renegotiation on chrome
    connection.disableDtlsSrtp = true;
    
    // 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?

Want to ask a Question?

You can include your email for private conversation!