Creating an offer in the caller's browser
As the caller, you are the person initiating the call. You visit the web page first and get call_token
that you then share with the person to which you want to connect. But then your browser has to wait until the callee connects.
Once they do connect, their browser sends a signal to the signaling server letting it know that they have arrived, and this signal is then sent to your browser. Once your browser receives this callee_arrived
signal, you can then initiate the JSEP offer/answer process by calling peer_connection.createOffer()
:
// handle signals as a caller function caller_signal_handler(event) { var signal = JSON.parse(event.data); if (signal.type === "callee_arrived") { peer_connection.createOffer( new_description_created, log_error ); } else … }
If the offer is created successfully, then the resulting description is passed to the new_description_created()
function. This calls peer_connection.setLocalDescription()
to...