diff --git a/front/src/WebRtc/SimplePeer.ts b/front/src/WebRtc/SimplePeer.ts index 08ae99fe..90d260ee 100644 --- a/front/src/WebRtc/SimplePeer.ts +++ b/front/src/WebRtc/SimplePeer.ts @@ -229,6 +229,14 @@ export class SimplePeer { } catch (err) { console.error("closeConnection", err) } + + //if user left discussion, clear array peer connection of sharing + if(this.Users.length === 0) { + for (const userId of this.PeerScreenSharingConnectionArray.keys()) { + this.closeScreenSharingConnection(userId); + this.PeerScreenSharingConnectionArray.delete(userId); + } + } } /**