Im trying to set up a multi party video conference using WebRTC and just need a little clarification on something:
Q) Do I need to have an RTCPeerConnection
object for each member of the conference or just one?
For example, I am currently doing this for two way communication which works well...
var pc; // single peer connection instance (see startPeerConnection)
startLocalVideo(function (stream) {
//Offer Local video to Remote Server
if (stream) {
if (!pc) {
startPeerConnection();
}
if (pc) {
pc.addStream(stream);
pc.onaddstream = addRemoteStream;
pc.createOffer(function (description) {
pc.setLocalDescription(description, function () {
signal('offer', {
extension: extension,
call: currentcall,
description: description
});
}, failure);
}, function (error) {
console.log("createOffer error: " + error);
});
}
}
});
function startPeerConnection() {
pc = new RTCPeerConnection({
iceServers: [{
url: "stun:stun.l.google.com:19302"
}]
});
pc.onicecandidate = gotLocalIceCandidate;
}
If you are planning to create a multiparty call using a mesh network, where all participants send their media to all the rest of the participants. You will need to create a peer connection object for every endpoint in the call.