DEV Community

Discussion on: Let’s Build a Video Chat App with JavaScript and WebRTC

Collapse
 
nilmadhabmondal profile image
Nil Madhab • Edited

You have asked me two things:-

  1. How is the offer created?
    The Offer is created using pc.createOffer(setLocalAndSendMessage, handleCreateOfferError); where pc is an object of RTCPeerConnection .

  2. How handleIceCandidate function works?
    Browser starts creating candidates as soon as we create an object of RTCPeerConnection. To handle these candidates, we must pass a handler function to this RTCPeerConnection Object as follows
    pc.onicecandidate = handleIceCandidate; , where pc is an object of RTCPeerConnection .
    Whenever a candidate is created by the browser, the handleIceCandidate function will be called