From e4771ef3610b48c454d160b0791fc5da88d4b6f3 Mon Sep 17 00:00:00 2001 From: Pierre HUBERT Date: Sat, 11 Apr 2020 16:34:05 +0200 Subject: [PATCH] First stream works --- assets/js/components/calls/window.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/assets/js/components/calls/window.js b/assets/js/components/calls/window.js index 33e25477..3aebe2a0 100644 --- a/assets/js/components/calls/window.js +++ b/assets/js/components/calls/window.js @@ -360,8 +360,10 @@ class CallWindow extends CustomEvents { const peer = new SimplePeer({ initiator: true, trickle: true, // Allow exchange of multiple ice candidates - config: this.callConfig() + config: this.callConfig(), + stream: await navigator.mediaDevices.getUserMedia({audio: true, video: true}) // TODO : find a way to use fake strem }) + this.peersEls.set(peerID, peer) peer.on("signal", data => this.SendSignal(peerID, data)) @@ -379,7 +381,7 @@ class CallWindow extends CustomEvents { }); peer.on("stream", stream => { - console.log("mainPeer stream", stream) + console.log("go remote peer stream", stream) alert("Stream on remote peer!!!") }); } @@ -392,10 +394,10 @@ class CallWindow extends CustomEvents { */ NewSignal(peerID, data) { - if(peerID == userID()) + if(peerID == userID()) { if(this.mainPeer) this.mainPeer.signal(data) - + } else if(this.peersEls.has(peerID)) { this.peersEls.get(peerID).signal(data) }