summaryrefslogtreecommitdiff
path: root/example/index.js
diff options
context:
space:
mode:
authorChris Hiszpanski <chris.hiszpanski@verkada.com>2022-05-22 01:36:30 -0700
committerChris Hiszpanski <chris.hiszpanski@verkada.com>2022-05-22 01:36:30 -0700
commit8a4e7fabafd8d42b0b2cbdbd766bea49a62bfae1 (patch)
treec432758df4318d4370dd874b185888af67084655 /example/index.js
parent97261b79b20e4e53ef3a5b7a37d1ffb0b5665bcb (diff)
Added tcp host candidate
Diffstat (limited to 'example/index.js')
-rw-r--r--example/index.js6
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);
}