Created
August 3, 2020 07:23
-
-
Save Vatsalya-singhi/6cb9e2277318789862b47efbf903ad6e to your computer and use it in GitHub Desktop.
This file contains 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
public createAndSendOffer(id: string) { | |
this.peerConnections[id] | |
.createOffer(this.offerOptions) | |
.then(async (offer: RTCSessionDescriptionInit) => { | |
if (this.peerConnections[id].signalingState != "stable") { | |
console.log("-- The connection isn't stable yet; postponing...") | |
return; | |
} | |
this.peerConnections[id].setLocalDescription(offer).then(() => { | |
console.log('sending Offer'); | |
this.socket.sendOffer(id, this.peerConnections[id].localDescription); | |
}).catch((err) => { | |
console.log('local desc was not set & offer not sent'); | |
}); | |
}, (err) => { | |
console.log('offer not created=>', err); | |
}) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment