From e4478beda256bc80c29e98769c0a0a8c29a38adf Mon Sep 17 00:00:00 2001 From: Pierre HUBERT Date: Mon, 13 Apr 2020 18:22:18 +0200 Subject: [PATCH] Keep track of remote streams --- assets/js/components/calls/window.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/assets/js/components/calls/window.js b/assets/js/components/calls/window.js index 492e1aac..0dc86a92 100644 --- a/assets/js/components/calls/window.js +++ b/assets/js/components/calls/window.js @@ -23,6 +23,9 @@ class CallWindow extends CustomEvents { /** @type {Map} */ this.peersEls = new Map() + /** @type {Map} */ + this.streamsEls = new Map() + /** @type {Map} */ this.videoEls = new Map() @@ -524,6 +527,11 @@ class CallWindow extends CustomEvents { this.peersEls.delete(userID) } + // Remove associated stream + if(this.streamsEls.has(userID)) { + this.streamsEls.delete(userID) + } + } /** @@ -844,6 +852,7 @@ class CallWindow extends CustomEvents { peer.on("stream", stream => { console.log("Got remote peer stream", stream) + this.streamsEls.set(peerID, stream) this.applyStream(peerID, false, stream) });