webrtcp2psdpvideochatgroupchat

WebRTC: Group video chat - create offer and send answer


I have a problem with WebRTC group chatting. [I have achived this on my code]

  1. client-1 create's offerSDP for client-2
  2. client-2 accepts the offerSDP and replay answerSDP to the client-1 (the creator)
  3. client-1 accept and set it as remoteDescription. Now video chat happening.

fine,

Now client-3 comes in.

In my code client-3 receives client-1's offerSDP and emit's answerSDP to all the client's present in the server.

  1. Now Both client-1 and client-2 will get the answerSDP from client-3 and both will recevies client-3's video.

Problem:

  1. client-1 has [localvideo, client-2_video, client-3_video]
  2. client-2 has [localvideo, client-1_video, client-3_video]
  3. client-3 has [localvideo, client-1_video]. Here this client not knowing about client-2

why? what i have to do here? Helo me please.


Solution

  • You need to exchange a unique offer/answer pair for each connection. It's not possible to re-use them for different connections.

    In your example client-3 would need to receive an offer from client-1 AND client-2. And it would need to send a unique answer to both of those other clients as well.