Skip to content

Instantly share code, notes, and snippets.

@Vatsalya-singhi
Created August 3, 2020 07:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Vatsalya-singhi/b4a2fa19c2227d68b1ab7f00070190c2 to your computer and use it in GitHub Desktop.
Save Vatsalya-singhi/b4a2fa19c2227d68b1ab7f00070190c2 to your computer and use it in GitHub Desktop.
public candidateListen() {
this.socket.candidateListen()
.pipe(takeWhile(() => this.alive))
.subscribe((data) => {
let id: string = data.id;
let candidate: RTCIceCandidate = new RTCIceCandidate(data.candidate);
if (!this.peerConnections[id] || this.peerConnections[id] == null) {
this.peerConnections[id] = new RTCPeerConnection(this.connectionConfig);
}
this.peerConnections[id].addIceCandidate(candidate).then(() => {
console.log('addIceCandidate success');
}).catch((err) => {
// console.log('err=>', err);
});
}, (err) => {
console.log('err=>', err);
})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment