Created
March 27, 2020 20:06
-
-
Save shriyaRam/b5f3a2b8f06369c5450a68ab11b10d12 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
const configuration = getSelectedSdpSemantics(); | |
console.log('RTCPeerConnection configuration:', configuration); | |
pc1 = new RTCPeerConnection(configuration); | |
console.log('Created local peer connection object pc1'); | |
pc1.addEventListener('icecandidate', e => onIceCandidate(pc1, e)); | |
pc2 = new RTCPeerConnection(configuration); | |
console.log('Created remote peer connection object pc2'); | |
pc2.addEventListener('icecandidate', e => onIceCandidate(pc2, e)); | |
pc1.addEventListener('iceconnectionstatechange', e => onIceStateChange(pc1, e)); | |
pc2.addEventListener('iceconnectionstatechange', e => onIceStateChange(pc2, e)); | |
pc2.addEventListener('track', gotRemoteStream); | |
pc1.addEventListener('track', gotRemoteStream); | |
localStream.getTracks().forEach(track => {pc1.addTrack(track, localStream);pc2.addTrack(track, localStream);}); | |
console.log('Added local stream to pc1'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment