samuelayo / pusher_webrtc

Build a video call app using webRTC and Pusher for signalling
21 stars 27 forks source link

How to add Stun/Turn server #8

Open BaBaSwan opened 5 years ago

BaBaSwan commented 5 years ago

How to add the Stun/Turn server to this program?

I still have problem in showing the videos of both sides and I get these two errors:

1) InvalidStateError: Cannot add ICE candidate in state stable

2) ICE failed, add a STUN server and see about:webrtc for more details

ghost commented 4 years ago

Hi, function prepareCaller() { const configuration = { 'iceServers': [{ 'urls': 'stun:stun.l.google.com:19302' }] }; //Initializing a peer connection caller = new window.RTCPeerConnection(configuration); //Listen for ICE Candidates and send them to remote peers caller.onicecandidate = function(evt) { if (!evt.candidate) return; console.log("onicecandidate called"); onIceCandidate(caller, evt); }; Good Luck:)