diff options
Diffstat (limited to 'example/index.js')
-rw-r--r-- | example/index.js | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/example/index.js b/example/index.js index a161a10..6eae9b3 100644 --- a/example/index.js +++ b/example/index.js @@ -1,4 +1,5 @@ window.onload = function demo() { + // create peer connection let pc = new RTCPeerConnection({ iceCandidatePoolSize: 4 @@ -27,10 +28,13 @@ window.onload = function demo() { if ('candidate' in d) { if (d.candidate) { console.log("remote candidate:\n%c%s", "color: blue;", d.candidate); + pc.addIceCandidate(d).catch((e) => { + console.log("addIceCandidate:\n%c%s", "color: red;", e); + }); } } else if ('sdp' in d) { pc.setRemoteDescription(d).catch((e) => { - console.log("local error:\n%c%s", "color: red;", e); + console.log("setRemoteDescription:\n%c%s", "color: red;", e); }); console.log("remote answer:\n%c%s", "color: blue;", d.sdp); } |