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 => {