Skip to content

Connecting the two sides

Course: WebRTC Basic implementation, advance discussion - chapter 3

The steps to create a webrtc connection between 2 sides includes -

  1. Browser 1 creates an RTCPeerConnection
  2. Browser 1 creates an offer
  3. Browser 1 sets the local description to the offer
  4. Browser 1 sends the offer to the other side through the signaling server
  5. Browser 2 receives the offer from the signaling server
  6. Browser 2 sets the remote description to the offer
  7. Browser 2 creates an answer
  8. Browser 2 sets the local description to be the answer
  9. Browser 2 sends the answer to the other side through the signaling server
  10. Browser 1 receives the answer and sets the remote description

This is just to establish the p2p connection b/w the two parties

To actually send media, we have to

  1. Ask for camera /mic permissions
  2. Get the audio and video streams
  3. Call addTrack on the pc
  4. This would trigger a onTrack callback on the other side