RTCMultiConnection Docs

RTCMultiConnection API Reference / "renegotiate" method

"renegotiate" method is useful to retry/renegotiate with or without adding additional streams!
connection.renegotiate(optional_Custom_MediaStream);

This method renegotiates among all users in the same session. To renegotiate between two unique users; try "peers" object:

connection.peers['user-id'].renegotiate(optional_Custom_MediaStream);

For Renegotiation,

// when renegotiating streams,
// it is preferred to always set OfferToReceive Audio/Video
// to make sure renegotiation NEVER fails!
connection.sdpConstraints.mandatory = {
    OfferToReceiveAudio: true,
    OfferToReceiveVideo: true
};

connection.addStream({
    screen: true,
    oneway: true
});

What is Renegotiation?



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

Renegotiation means re-exchanging offer/answer SDP among peers.

Renegotiation means you want to use same peer-connections to append dynamic streams at runtime.

// 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
});

Remember, renegotiation means: use existing peer connections to negotiate session descriptions.

Useful Resources

  1. How to switch streams?
  2. Renegotiation in RTCMultiConnection
  3. connection.peers (hold/unhold/drop/etc.)
  4. connection.addStream
  5. connection.renegotiate

Want to ask a Question?

You can include your email for private conversation!

Latest Updates