Skip to content

Instantly share code, notes, and snippets.

@LFSCamargo
Last active August 2, 2019 20:42
Show Gist options
  • Save LFSCamargo/1f968600746ea611752181fe3e1a342b to your computer and use it in GitHub Desktop.
Save LFSCamargo/1f968600746ea611752181fe3e1a342b to your computer and use it in GitHub Desktop.
creating the offer
// 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