summaryrefslogtreecommitdiff
path: root/example/index.js
diff options
context:
space:
mode:
authorChris Hiszpanski <chris.hiszpanski@verkada.com>2022-05-21 15:25:35 -0700
committerChris Hiszpanski <chris.hiszpanski@verkada.com>2022-05-21 15:45:26 -0700
commit97261b79b20e4e53ef3a5b7a37d1ffb0b5665bcb (patch)
tree809099efc2ac9ccfb440776eda5c63b6a1970931 /example/index.js
parent12df87e791ee6e468df31a6c468595b8c124a2b4 (diff)
* Added trtc_ prefixes
* Split into tinyrtc.c/h * Sending answer * Answer validates
Diffstat (limited to 'example/index.js')
-rw-r--r--example/index.js7
1 files changed, 5 insertions, 2 deletions
diff --git a/example/index.js b/example/index.js
index 35fdbba..a161a10 100644
--- a/example/index.js
+++ b/example/index.js
@@ -26,10 +26,13 @@ window.onload = function demo() {
let d = JSON.parse(event.data);
if ('candidate' in d) {
if (d.candidate) {
- console.log("remote candidate:\n%c%s", "color: blue;", event.data);
+ console.log("remote candidate:\n%c%s", "color: blue;", d.candidate);
}
} else if ('sdp' in d) {
- console.log("remote answer:\n%c%s", "color: blue;", event.data);
+ pc.setRemoteDescription(d).catch((e) => {
+ console.log("local error:\n%c%s", "color: red;", e);
+ });
+ console.log("remote answer:\n%c%s", "color: blue;", d.sdp);
}
} catch(e) {
console.log("remote error:\n%c%s", "color: red;", event.data);