From bdfc9215df352b147a921d138401a3a775b154c6 Mon Sep 17 00:00:00 2001 From: "Glitch (peerjs-video)" Date: Sat, 12 Sep 2020 22:23:41 +0000 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9E=F0=9F=97=83=20Checkpoint=20./publi?= =?UTF-8?q?c/main.js:5975361/118?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/main.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/public/main.js b/public/main.js index 2e5a8af..c44db60 100644 --- a/public/main.js +++ b/public/main.js @@ -35,6 +35,7 @@ var app = new Vue({ document.querySelector(selector).srcObject = stream; }, connectToPeer: function(peerId) { + if (!peerId) return; if (peerId === this.peer.id) { this.logMessage(`You played yourself! Can't connect to yourself.`); return; @@ -67,6 +68,7 @@ var app = new Vue({ this.handleCall(call); }, connectToPeer2: async function(peerId) { + if (!peerId) return; if (peerId === this.peer.id) { this.logMessage(`You played yourself! Can't connect to yourself.`); return; @@ -97,12 +99,11 @@ var app = new Vue({ const audioStream = await this.getAudioStream(); let audioCall = this.peer.call(peerId, audioStream); console.log('Started audioCall', audioCall); - this.calls.push(audioCall); + this.handleCall(audioCall); const videoStream = await this.getVideoStream(); let videoCall = this.peer.call(peerId, videoStream); console.log('Started videoCall', videoCall); - this.calls.push(videoCall); - // this.handleCall(call); + this.handleCall(videoCall); }, hangUp: function() { this.calls.forEach(c => {