This reverts commit 33e78060d4
.
This commit is contained in:
parent
15a0a2d1eb
commit
539a273263
@ -125,6 +125,7 @@ export class SimplePeer {
|
|||||||
if (!peerConnexionDeleted) {
|
if (!peerConnexionDeleted) {
|
||||||
throw new Error("Error to delete peer connection");
|
throw new Error("Error to delete peer connection");
|
||||||
}
|
}
|
||||||
|
//return this.createPeerConnection(user, localStream);
|
||||||
} else {
|
} else {
|
||||||
peerConnection.toClose = false;
|
peerConnection.toClose = false;
|
||||||
return null;
|
return null;
|
||||||
@ -170,7 +171,6 @@ export class SimplePeer {
|
|||||||
stream: MediaStream | null
|
stream: MediaStream | null
|
||||||
): ScreenSharingPeer | null {
|
): ScreenSharingPeer | null {
|
||||||
const peerConnection = this.PeerScreenSharingConnectionArray.get(user.userId);
|
const peerConnection = this.PeerScreenSharingConnectionArray.get(user.userId);
|
||||||
|
|
||||||
if (peerConnection) {
|
if (peerConnection) {
|
||||||
if (peerConnection.destroyed) {
|
if (peerConnection.destroyed) {
|
||||||
peerConnection.toClose = true;
|
peerConnection.toClose = true;
|
||||||
@ -182,8 +182,8 @@ export class SimplePeer {
|
|||||||
this.createPeerConnection(user);
|
this.createPeerConnection(user);
|
||||||
} else {
|
} else {
|
||||||
peerConnection.toClose = false;
|
peerConnection.toClose = false;
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Enrich the user with last known credentials (if they are not set in the user object, which happens when a user triggers the screen sharing)
|
// Enrich the user with last known credentials (if they are not set in the user object, which happens when a user triggers the screen sharing)
|
||||||
@ -201,9 +201,6 @@ export class SimplePeer {
|
|||||||
this.Connection,
|
this.Connection,
|
||||||
stream
|
stream
|
||||||
);
|
);
|
||||||
|
|
||||||
peer.toClose = false;
|
|
||||||
|
|
||||||
this.PeerScreenSharingConnectionArray.set(user.userId, peer);
|
this.PeerScreenSharingConnectionArray.set(user.userId, peer);
|
||||||
|
|
||||||
screenSharingPeerStore.pushNewPeer(peer);
|
screenSharingPeerStore.pushNewPeer(peer);
|
||||||
@ -268,13 +265,10 @@ export class SimplePeer {
|
|||||||
}
|
}
|
||||||
// FIXME: I don't understand why "Closing connection with" message is displayed TWICE before "Nb users in peerConnectionArray"
|
// FIXME: I don't understand why "Closing connection with" message is displayed TWICE before "Nb users in peerConnectionArray"
|
||||||
// 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.
|
||||||
peer.toClose = true;
|
|
||||||
peer.destroy();
|
peer.destroy();
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error("closeConnection", err);
|
console.error("closeConnection", err);
|
||||||
}
|
}
|
||||||
|
|
||||||
screenSharingPeerStore.removePeer(userId);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public closeAllConnections() {
|
public closeAllConnections() {
|
||||||
@ -382,6 +376,11 @@ export class SimplePeer {
|
|||||||
private sendLocalScreenSharingStreamToUser(userId: number, localScreenCapture: MediaStream): void {
|
private sendLocalScreenSharingStreamToUser(userId: number, localScreenCapture: MediaStream): void {
|
||||||
const uuid = playersStore.getPlayerById(userId)?.userUuid || "";
|
const uuid = playersStore.getPlayerById(userId)?.userUuid || "";
|
||||||
if (blackListManager.isBlackListed(uuid)) return;
|
if (blackListManager.isBlackListed(uuid)) return;
|
||||||
|
// If a connection already exists with user (because it is already sharing a screen with us... let's use this connection)
|
||||||
|
if (this.PeerScreenSharingConnectionArray.has(userId)) {
|
||||||
|
this.pushScreenSharingToRemoteUser(userId, localScreenCapture);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const screenSharingUser: UserSimplePeerInterface = {
|
const screenSharingUser: UserSimplePeerInterface = {
|
||||||
userId,
|
userId,
|
||||||
|
Loading…
Reference in New Issue
Block a user