Skip to content
This repository has been archived by the owner on Mar 1, 2024. It is now read-only.

Commit

Permalink
Merge pull request #144 from EpicGames/master
Browse files Browse the repository at this point in the history
Improve input unregistering
  • Loading branch information
lukehb committed Mar 9, 2023
2 parents 7a9ed96 + 2476233 commit 9de209d
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Frontend/library/src/AFK/AFKController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ export class AFKController {
stopAfkWarningTimer() {
this.active = false;
this.countdownActive = false;
clearInterval(this.warnTimer);
clearTimeout(this.warnTimer);
clearInterval(this.countDownTimer);
}

Expand Down
9 changes: 9 additions & 0 deletions Frontend/library/src/Inputs/MouseController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,15 @@ export class MouseController {
this.mouseEventListenerTracker.addUnregisterCallback(
() => lockedMouseEvents.unregisterMouseEvents()
);
this.mouseEventListenerTracker.addUnregisterCallback(() => {
if (
document.exitPointerLock &&
(document.pointerLockElement === videoElementParent ||
document.mozPointerLockElement === videoElementParent)
) {
document.exitPointerLock();
}
});
}

/**
Expand Down
10 changes: 8 additions & 2 deletions Frontend/library/src/WebRtcPlayer/WebRtcPlayerController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,12 @@ export class WebRtcPlayerController {
if (this.statsTimerHandle && this.statsTimerHandle !== undefined) {
window.clearInterval(this.statsTimerHandle);
}

// unregister all input device event handlers on disconnect
this.setTouchInputEnabled(false);
this.setMouseInputEnabled(false);
this.setKeyboardInputEnabled(false);
this.setGamePadInputEnabled(false);
});

// set up the final webRtc player controller methods from within our application so a connection can be activated
Expand Down Expand Up @@ -1514,14 +1520,14 @@ export class WebRtcPlayerController {
* Close the Connection to the signaling server
*/
closeSignalingServer() {
this.webSocketController.close();
this.webSocketController?.close();
}

/**
* Close the peer connection
*/
closePeerConnection() {
this.peerConnectionController.close();
this.peerConnectionController?.close();
}

/**
Expand Down
2 changes: 1 addition & 1 deletion Frontend/library/src/WebSockets/WebSocketController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ export class WebSocketController {
* Closes the Websocket connection
*/
close() {
this.webSocket.close();
this.webSocket?.close();
}

/** Event used for Displaying websocket closed messages */
Expand Down

0 comments on commit 9de209d

Please sign in to comment.