From 8a4e7fabafd8d42b0b2cbdbd766bea49a62bfae1 Mon Sep 17 00:00:00 2001 From: Chris Hiszpanski Date: Sun, 22 May 2022 01:36:30 -0700 Subject: Added tcp host candidate --- example/index.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'example/index.js') 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); } -- cgit v1.2.3