I have used WebRTC to make p2p audio and video connection. With only two peers I get the order of invocation.
Peer1-caller sends SDP offer and ICE candidates. Peer2-callee receives SDP offer and ICE candidates generates SDP answer and it's ICE candidates send it back to the caller which adds them.
Now let's say I want Peer3 to join the session with two existing peers. What would be the process?
Basically I am confused how to add third peer, which method to use peerConnection.createOffer()
than wait for SDP answers from all other peers including the initiator or wait for SDP offer(s) and use peerConnection.createAnswer()
?
Any help would be appreciated.
Thanks.
RTCPeerConnection is just that, a connection talking to a single endpoint. If you want to more than one, you'll need a separate peerconnection for each, complete with its own independent offer-answer exchange.
https://webrtc.github.io/samples/src/content/peerconnection/multiple/ is a minimal demo.