From db1970526ad1941b1847de745ac8e21e169b9d66 Mon Sep 17 00:00:00 2001 From: "Glitch (peerjs-video)" Date: Sat, 12 Sep 2020 21:26:50 +0000 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=8F=F0=9F=8D=AA=20Checkpoint=20./publi?= =?UTF-8?q?c/main.js:5975361/514?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/main.js | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/public/main.js b/public/main.js index 996d2c5..caabb0b 100644 --- a/public/main.js +++ b/public/main.js @@ -128,11 +128,12 @@ var app = new Vue({ }); this.calls.push(call); console.log('Call', call); - call.peerConnection.onaddstream = (a,b) => { - console.log('stream add', a, b) + call.peerConnection.onaddstream = (stream) => { + console.log('stream add', stream); + // stream. }; - call.peerConnection.onremovestream =(a,b) => { - console.log('stream remove', a, b) + call.peerConnection.onremovestream = (stream) => { + console.log('stream remove', stream); }; }, gotDevices: function gotDevices(deviceInfos) { @@ -202,6 +203,13 @@ var app = new Vue({ // call.peerConnection.addStream(stream); // console.log('local streams',call.peerConnection.getLocalStreams()); console.log(call.peerConnection, stream.getTracks()) + const target = call.peerConnection.getLocalStreams()[0]; + target.getTracks().forEach((track) => { + target.removeTrack(track); + }); + stream.getTracks().forEach((track) => { + target.addTrack(track); + }); }); } this.stream = stream; // make stream available to console