From 00a28e743d64383ad63f2abdf4121362452371a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=A0imon=20Brandner?= Date: Mon, 10 May 2021 19:18:39 +0200 Subject: [PATCH] Move track.stop() to deleteFeedByStream() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Šimon Brandner --- src/webrtc/call.ts | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/webrtc/call.ts b/src/webrtc/call.ts index f9e1924de..a03572375 100644 --- a/src/webrtc/call.ts +++ b/src/webrtc/call.ts @@ -546,6 +546,10 @@ export class MatrixCall extends EventEmitter { this.feeds.splice(this.feeds.indexOf(feed), 1); this.emit(CallEvent.FeedsChanged, this.feeds); + + for (const track of stream.getTracks()) { + track.stop(); + } } // The typescript definitions have this type as 'any' :( @@ -807,9 +811,6 @@ export class MatrixCall extends EventEmitter { for (const sender of this.screensharingSenders) { this.peerConn.removeTrack(sender); } - for (const track of this.screenSharingStream.getTracks()) { - track.stop(); - } this.deleteFeedByStream(this.screenSharingStream); this.screenSharingStream = null; return false; @@ -859,9 +860,6 @@ export class MatrixCall extends EventEmitter { }); sender.replaceTrack(track); - for (const track of this.screenSharingStream.getTracks()) { - track.stop(); - } this.deleteFeedByStream(this.screenSharingStream); this.screenSharingStream = null;