Last active
August 2, 2019 20:42
-
-
Save LFSCamargo/1f968600746ea611752181fe3e1a342b to your computer and use it in GitHub Desktop.
creating the offer
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Peer 1 | |
pc.createOffer( | |
offer => { | |
pc.setLocalDescription( | |
offer, | |
() => { | |
// send the offer sdp to the other peer | |
}, | |
e => console.log(e), | |
) | |
}, | |
e => console.log(e), | |
) | |
..... | |
// Peer 2 | |
// Other peer receives the offer sdp from the other peer and generates | |
// the answer sdp and send back | |
pc.setRemoteDescription(offer, () => { | |
pc.createAnswer(answer => { | |
pc.setLocalDescription(answer, () => { | |
// send back the answer for the other peer | |
}) | |
}) | |
}) | |
.... | |
// Peer 1 | |
// Other peer receives the answer sdp and store as the remote description | |
pc.setRemoteDescription(answer, () => { | |
// update call status | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment