summaryrefslogtreecommitdiff
path: root/example/index.js
diff options
context:
space:
mode:
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);