Connecting the two sides
Course: WebRTC Basic implementation, advance discussion - chapter 3
The steps to create a webrtc connection between 2 sides includes -
- Browser 1 creates an
RTCPeerConnection - Browser 1 creates an
offer - Browser 1 sets the
local descriptionto the offer - Browser 1 sends the offer to the other side through the
signaling server - Browser 2 receives the
offerfrom thesignaling server - Browser 2 sets the
remote descriptionto theoffer - Browser 2 creates an
answer - Browser 2 sets the
local descriptionto be theanswer - Browser 2 sends the
answerto the other side through thesignaling server - Browser 1 receives the
answerand sets theremote description
This is just to establish the p2p connection b/w the two parties
To actually send media, we have to
- Ask for camera /mic permissions
- Get the
audioandvideostreams - Call
addTrackon thepc - This would trigger a
onTrackcallback on the other side