Fix screen sharing

Foce screan sharing to create new peer connexion and share it
This commit is contained in:
Gregoire Parant 2020-10-20 14:48:59 +02:00
parent 54d4a1b1f8
commit 336742b8b3

View File

@ -235,7 +235,9 @@ export class SimplePeer {
// I do understand the method closeConnection is called twice, but I don't understand how they manage to run in parallel. // I do understand the method closeConnection is called twice, but I don't understand how they manage to run in parallel.
//console.log('Closing connection with '+userId); //console.log('Closing connection with '+userId);
peer.destroy(); peer.destroy();
this.PeerScreenSharingConnectionArray.delete(userId) if(!this.PeerScreenSharingConnectionArray.delete(userId)){
throw 'Couln\'t delete peer screen sharing connexion';
}
//console.log('Nb users in peerConnectionArray '+this.PeerConnectionArray.size); //console.log('Nb users in peerConnectionArray '+this.PeerConnectionArray.size);
} catch (err) { } catch (err) {
console.error("closeConnection", err) console.error("closeConnection", err)
@ -292,6 +294,9 @@ export class SimplePeer {
} }
} catch (e) { } catch (e) {
console.error(`receiveWebrtcSignal => ${data.userId}`, e); console.error(`receiveWebrtcSignal => ${data.userId}`, e);
//force delete and reconnect peer connexion
this.PeerScreenSharingConnectionArray.delete(data.userId);
this.receiveWebrtcScreenSharingSignal(data);
} }
} }