@epicgames-ps/lib-pixelstreamingfrontend-ue5.5 0.3.0 → 0.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (169) hide show
  1. package/dist/commonjs/AFK/AFKController.js +109 -109
  2. package/dist/commonjs/Config/Config.js +559 -559
  3. package/dist/commonjs/Config/SettingBase.js +98 -98
  4. package/dist/commonjs/Config/SettingFlag.js +49 -49
  5. package/dist/commonjs/Config/SettingNumber.js +83 -83
  6. package/dist/commonjs/Config/SettingOption.js +84 -84
  7. package/dist/commonjs/Config/SettingText.js +42 -42
  8. package/dist/commonjs/DataChannel/DataChannelController.js +106 -106
  9. package/dist/commonjs/DataChannel/DataChannelLatencyTestController.js +94 -94
  10. package/dist/commonjs/DataChannel/DataChannelLatencyTestResults.js +18 -18
  11. package/dist/commonjs/DataChannel/DataChannelSender.js +43 -43
  12. package/dist/commonjs/DataChannel/InitialSettings.js +41 -41
  13. package/dist/commonjs/DataChannel/LatencyTestResults.js +60 -60
  14. package/dist/commonjs/FreezeFrame/FreezeFrame.js +93 -93
  15. package/dist/commonjs/FreezeFrame/FreezeFrameController.js +95 -95
  16. package/dist/commonjs/Inputs/GamepadController.js +188 -188
  17. package/dist/commonjs/Inputs/GamepadTypes.js +21 -21
  18. package/dist/commonjs/Inputs/IInputController.js +2 -2
  19. package/dist/commonjs/Inputs/InputClassesFactory.js +96 -96
  20. package/dist/commonjs/Inputs/KeyCodes.js +112 -112
  21. package/dist/commonjs/Inputs/KeyboardController.js +137 -137
  22. package/dist/commonjs/Inputs/MouseButtons.js +28 -28
  23. package/dist/commonjs/Inputs/MouseController.js +97 -97
  24. package/dist/commonjs/Inputs/MouseControllerHovering.js +93 -93
  25. package/dist/commonjs/Inputs/MouseControllerLocked.js +153 -153
  26. package/dist/commonjs/Inputs/SpecialKeyCodes.js +19 -19
  27. package/dist/commonjs/Inputs/TouchController.js +123 -123
  28. package/dist/commonjs/Inputs/TouchControllerFake.js +91 -91
  29. package/dist/commonjs/Inputs/XRGamepadController.js +124 -124
  30. package/dist/commonjs/PeerConnectionController/AggregatedStats.js +252 -252
  31. package/dist/commonjs/PeerConnectionController/CandidatePairStats.js +10 -10
  32. package/dist/commonjs/PeerConnectionController/CandidateStat.js +10 -10
  33. package/dist/commonjs/PeerConnectionController/CodecStats.js +10 -10
  34. package/dist/commonjs/PeerConnectionController/DataChannelStats.js +10 -10
  35. package/dist/commonjs/PeerConnectionController/InboundRTPStats.js +22 -22
  36. package/dist/commonjs/PeerConnectionController/InboundTrackStats.js +10 -10
  37. package/dist/commonjs/PeerConnectionController/OutBoundRTPStats.js +16 -16
  38. package/dist/commonjs/PeerConnectionController/PeerConnectionController.js +584 -584
  39. package/dist/commonjs/PeerConnectionController/SessionStats.js +10 -10
  40. package/dist/commonjs/PeerConnectionController/StreamStats.js +10 -10
  41. package/dist/commonjs/PixelStreaming/PixelStreaming.js +607 -607
  42. package/dist/commonjs/UI/OnScreenKeyboard.js +82 -82
  43. package/dist/commonjs/UeInstanceMessage/ResponseController.js +38 -38
  44. package/dist/commonjs/UeInstanceMessage/SendMessageController.js +120 -120
  45. package/dist/commonjs/UeInstanceMessage/StreamMessageController.js +210 -210
  46. package/dist/commonjs/UeInstanceMessage/ToStreamerMessagesController.js +49 -49
  47. package/dist/commonjs/Util/EventEmitter.js +386 -386
  48. package/dist/commonjs/Util/FileUtil.js +108 -108
  49. package/dist/commonjs/Util/IURLSearchParams.js +25 -25
  50. package/dist/commonjs/Util/InputCoordTranslator.js +49 -49
  51. package/dist/commonjs/Util/RTCUtils.js +40 -40
  52. package/dist/commonjs/VideoPlayer/StreamController.js +67 -67
  53. package/dist/commonjs/VideoPlayer/VideoPlayer.js +177 -177
  54. package/dist/commonjs/WebRtcPlayer/WebRtcPlayerController.js +1221 -1221
  55. package/dist/commonjs/WebXR/WebXRController.js +335 -335
  56. package/dist/commonjs/pixelstreamingfrontend.js +70 -70
  57. package/dist/esm/AFK/AFKController.js +105 -105
  58. package/dist/esm/Config/Config.js +551 -551
  59. package/dist/esm/Config/SettingBase.js +94 -94
  60. package/dist/esm/Config/SettingFlag.js +45 -45
  61. package/dist/esm/Config/SettingNumber.js +79 -79
  62. package/dist/esm/Config/SettingOption.js +80 -80
  63. package/dist/esm/Config/SettingText.js +38 -38
  64. package/dist/esm/DataChannel/DataChannelController.js +102 -102
  65. package/dist/esm/DataChannel/DataChannelLatencyTestController.js +90 -90
  66. package/dist/esm/DataChannel/DataChannelLatencyTestResults.js +14 -14
  67. package/dist/esm/DataChannel/DataChannelSender.js +39 -39
  68. package/dist/esm/DataChannel/InitialSettings.js +34 -34
  69. package/dist/esm/DataChannel/LatencyTestResults.js +56 -56
  70. package/dist/esm/FreezeFrame/FreezeFrame.js +89 -89
  71. package/dist/esm/FreezeFrame/FreezeFrameController.js +91 -91
  72. package/dist/esm/Inputs/GamepadController.js +184 -184
  73. package/dist/esm/Inputs/GamepadTypes.js +17 -17
  74. package/dist/esm/Inputs/IInputController.js +1 -1
  75. package/dist/esm/Inputs/InputClassesFactory.js +91 -91
  76. package/dist/esm/Inputs/KeyCodes.js +109 -109
  77. package/dist/esm/Inputs/KeyboardController.js +133 -133
  78. package/dist/esm/Inputs/MouseButtons.js +23 -23
  79. package/dist/esm/Inputs/MouseController.js +93 -93
  80. package/dist/esm/Inputs/MouseControllerHovering.js +89 -89
  81. package/dist/esm/Inputs/MouseControllerLocked.js +149 -149
  82. package/dist/esm/Inputs/SpecialKeyCodes.js +15 -15
  83. package/dist/esm/Inputs/TouchController.js +119 -119
  84. package/dist/esm/Inputs/TouchControllerFake.js +87 -87
  85. package/dist/esm/Inputs/XRGamepadController.js +120 -120
  86. package/dist/esm/PeerConnectionController/AggregatedStats.js +248 -248
  87. package/dist/esm/PeerConnectionController/CandidatePairStats.js +6 -6
  88. package/dist/esm/PeerConnectionController/CandidateStat.js +6 -6
  89. package/dist/esm/PeerConnectionController/CodecStats.js +6 -6
  90. package/dist/esm/PeerConnectionController/DataChannelStats.js +6 -6
  91. package/dist/esm/PeerConnectionController/InboundRTPStats.js +16 -16
  92. package/dist/esm/PeerConnectionController/InboundTrackStats.js +6 -6
  93. package/dist/esm/PeerConnectionController/OutBoundRTPStats.js +11 -11
  94. package/dist/esm/PeerConnectionController/PeerConnectionController.js +580 -580
  95. package/dist/esm/PeerConnectionController/SessionStats.js +6 -6
  96. package/dist/esm/PeerConnectionController/StreamStats.js +6 -6
  97. package/dist/esm/PixelStreaming/PixelStreaming.js +603 -603
  98. package/dist/esm/UI/OnScreenKeyboard.js +78 -78
  99. package/dist/esm/UeInstanceMessage/ResponseController.js +34 -34
  100. package/dist/esm/UeInstanceMessage/SendMessageController.js +116 -116
  101. package/dist/esm/UeInstanceMessage/StreamMessageController.js +205 -205
  102. package/dist/esm/UeInstanceMessage/ToStreamerMessagesController.js +45 -45
  103. package/dist/esm/Util/EventEmitter.js +345 -345
  104. package/dist/esm/Util/FileUtil.js +103 -103
  105. package/dist/esm/Util/IURLSearchParams.js +21 -21
  106. package/dist/esm/Util/InputCoordTranslator.js +45 -45
  107. package/dist/esm/Util/RTCUtils.js +36 -36
  108. package/dist/esm/VideoPlayer/StreamController.js +63 -63
  109. package/dist/esm/VideoPlayer/VideoPlayer.js +173 -173
  110. package/dist/esm/WebRtcPlayer/WebRtcPlayerController.js +1217 -1217
  111. package/dist/esm/WebXR/WebXRController.js +331 -331
  112. package/dist/esm/pixelstreamingfrontend.js +24 -24
  113. package/dist/types/AFK/AFKController.d.ts +38 -38
  114. package/dist/types/Config/Config.d.ts +220 -220
  115. package/dist/types/Config/SettingBase.d.ts +43 -43
  116. package/dist/types/Config/SettingFlag.d.ts +24 -24
  117. package/dist/types/Config/SettingNumber.d.ts +41 -41
  118. package/dist/types/Config/SettingOption.d.ts +41 -41
  119. package/dist/types/Config/SettingText.d.ts +21 -21
  120. package/dist/types/DataChannel/DataChannelController.d.ts +59 -59
  121. package/dist/types/DataChannel/DataChannelLatencyTestController.d.ts +25 -25
  122. package/dist/types/DataChannel/DataChannelLatencyTestResults.d.ts +46 -46
  123. package/dist/types/DataChannel/DataChannelSender.d.ts +21 -21
  124. package/dist/types/DataChannel/InitialSettings.d.ts +44 -44
  125. package/dist/types/DataChannel/LatencyTestResults.d.ts +31 -31
  126. package/dist/types/FreezeFrame/FreezeFrame.d.ts +36 -36
  127. package/dist/types/FreezeFrame/FreezeFrameController.d.ts +37 -37
  128. package/dist/types/Inputs/GamepadController.d.ts +61 -61
  129. package/dist/types/Inputs/GamepadTypes.d.ts +15 -15
  130. package/dist/types/Inputs/IInputController.d.ts +16 -16
  131. package/dist/types/Inputs/InputClassesFactory.d.ts +53 -53
  132. package/dist/types/Inputs/KeyCodes.d.ts +5 -5
  133. package/dist/types/Inputs/KeyboardController.d.ts +34 -34
  134. package/dist/types/Inputs/MouseButtons.d.ts +22 -22
  135. package/dist/types/Inputs/MouseController.d.ts +40 -40
  136. package/dist/types/Inputs/MouseControllerHovering.d.ts +26 -26
  137. package/dist/types/Inputs/MouseControllerLocked.d.ts +31 -31
  138. package/dist/types/Inputs/SpecialKeyCodes.d.ts +14 -14
  139. package/dist/types/Inputs/TouchController.d.ts +28 -28
  140. package/dist/types/Inputs/TouchControllerFake.d.ts +29 -29
  141. package/dist/types/Inputs/XRGamepadController.d.ts +15 -15
  142. package/dist/types/PeerConnectionController/AggregatedStats.d.ts +82 -82
  143. package/dist/types/PeerConnectionController/CandidatePairStats.d.ts +22 -22
  144. package/dist/types/PeerConnectionController/CandidateStat.d.ts +13 -13
  145. package/dist/types/PeerConnectionController/CodecStats.d.ts +14 -14
  146. package/dist/types/PeerConnectionController/DataChannelStats.d.ts +15 -15
  147. package/dist/types/PeerConnectionController/InboundRTPStats.d.ts +141 -141
  148. package/dist/types/PeerConnectionController/InboundTrackStats.d.ts +32 -32
  149. package/dist/types/PeerConnectionController/OutBoundRTPStats.d.ts +23 -23
  150. package/dist/types/PeerConnectionController/PeerConnectionController.d.ts +143 -143
  151. package/dist/types/PeerConnectionController/SessionStats.d.ts +8 -8
  152. package/dist/types/PeerConnectionController/StreamStats.d.ts +9 -9
  153. package/dist/types/PixelStreaming/PixelStreaming.d.ts +271 -271
  154. package/dist/types/UI/OnScreenKeyboard.d.ts +30 -30
  155. package/dist/types/UeInstanceMessage/ResponseController.d.ts +19 -19
  156. package/dist/types/UeInstanceMessage/SendMessageController.d.ts +18 -18
  157. package/dist/types/UeInstanceMessage/StreamMessageController.d.ts +29 -29
  158. package/dist/types/UeInstanceMessage/ToStreamerMessagesController.d.ts +32 -32
  159. package/dist/types/Util/EventEmitter.d.ts +429 -429
  160. package/dist/types/Util/FileUtil.d.ts +32 -32
  161. package/dist/types/Util/IURLSearchParams.d.ts +9 -9
  162. package/dist/types/Util/InputCoordTranslator.d.ts +29 -29
  163. package/dist/types/Util/RTCUtils.d.ts +8 -8
  164. package/dist/types/VideoPlayer/StreamController.d.ts +22 -22
  165. package/dist/types/VideoPlayer/VideoPlayer.d.ts +78 -78
  166. package/dist/types/WebRtcPlayer/WebRtcPlayerController.d.ts +379 -379
  167. package/dist/types/WebXR/WebXRController.d.ts +42 -42
  168. package/dist/types/pixelstreamingfrontend.d.ts +23 -23
  169. package/package.json +45 -45
@@ -1,154 +1,154 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.MouseControllerLocked = void 0;
4
- const lib_pixelstreamingcommon_ue5_5_1 = require("@epicgames-ps/lib-pixelstreamingcommon-ue5.5");
5
- const MouseController_1 = require("./MouseController");
6
- /**
7
- * A mouse controller that locks the mouse to the video document and prevents it from leaving the window
8
- */
9
- class MouseControllerLocked extends MouseController_1.MouseController {
10
- constructor(streamMessageController, videoPlayer, coordinateConverter, activeKeys) {
11
- super(streamMessageController, videoPlayer, coordinateConverter, activeKeys);
12
- this.videoElementParent = videoPlayer.getVideoParentElement();
13
- this.x = this.videoElementParent.getBoundingClientRect().width / 2;
14
- this.y = this.videoElementParent.getBoundingClientRect().height / 2;
15
- this.normalizedCoord = this.coordinateConverter.translateUnsigned(this.x, this.y);
16
- this.onRequestLockListener = this.onRequestLock.bind(this);
17
- this.onLockStateChangeListener = this.onLockStateChange.bind(this);
18
- this.onMouseUpListener = this.onMouseUp.bind(this);
19
- this.onMouseDownListener = this.onMouseDown.bind(this);
20
- this.onMouseDblClickListener = this.onMouseDblClick.bind(this);
21
- this.onMouseWheelListener = this.onMouseWheel.bind(this);
22
- this.onMouseMoveListener = this.onMouseMove.bind(this);
23
- }
24
- register() {
25
- super.register();
26
- this.videoElementParent.requestPointerLock =
27
- this.videoElementParent.requestPointerLock || this.videoElementParent.mozRequestPointerLock;
28
- document.exitPointerLock = document.exitPointerLock || document.mozExitPointerLock;
29
- if (this.videoElementParent.requestPointerLock) {
30
- this.videoElementParent.addEventListener('click', this.onRequestLockListener);
31
- }
32
- document.addEventListener('pointerlockchange', this.onLockStateChangeListener);
33
- document.addEventListener('mozpointerlockchange', this.onLockStateChangeListener);
34
- this.videoElementParent.addEventListener('mousedown', this.onMouseDownListener);
35
- this.videoElementParent.addEventListener('mouseup', this.onMouseUpListener);
36
- this.videoElementParent.addEventListener('wheel', this.onMouseWheelListener);
37
- this.videoElementParent.addEventListener('dblclick', this.onMouseDblClickListener);
38
- }
39
- unregister() {
40
- const pointerLockElement = document.pointerLockElement || document.mozPointerLockElement;
41
- if (document.exitPointerLock && pointerLockElement === this.videoElementParent) {
42
- document.exitPointerLock();
43
- }
44
- this.videoElementParent.removeEventListener('click', this.onRequestLockListener);
45
- document.removeEventListener('pointerlockchange', this.onLockStateChangeListener);
46
- document.removeEventListener('mozpointerlockchange', this.onLockStateChangeListener);
47
- document.removeEventListener('mousemove', this.onMouseMoveListener);
48
- this.videoElementParent.removeEventListener('mousedown', this.onMouseDownListener);
49
- this.videoElementParent.removeEventListener('mouseup', this.onMouseUpListener);
50
- this.videoElementParent.removeEventListener('wheel', this.onMouseWheelListener);
51
- this.videoElementParent.removeEventListener('dblclick', this.onMouseDblClickListener);
52
- super.unregister();
53
- }
54
- onRequestLock() {
55
- this.videoElementParent.requestPointerLock();
56
- }
57
- onLockStateChange() {
58
- const pointerLockElement = document.pointerLockElement || document.mozPointerLockElement;
59
- if (pointerLockElement === this.videoElementParent) {
60
- lib_pixelstreamingcommon_ue5_5_1.Logger.Info('Pointer locked');
61
- document.addEventListener('mousemove', this.onMouseMoveListener);
62
- }
63
- else {
64
- lib_pixelstreamingcommon_ue5_5_1.Logger.Info('The pointer lock status is now unlocked');
65
- document.removeEventListener('mousemove', this.onMouseMoveListener);
66
- // If mouse loses focus, send a key up for all of the currently held-down keys
67
- // This is necessary as when the mouse loses focus, the windows stops listening for events and as such
68
- // the keyup listener won't get fired
69
- const activeKeys = this.activeKeys.getActiveKeys();
70
- activeKeys.forEach((key) => {
71
- this.streamMessageController.toStreamerHandlers.get('KeyUp')([key]);
72
- });
73
- }
74
- }
75
- onMouseDown(event) {
76
- if (!this.videoPlayer.isVideoReady()) {
77
- return;
78
- }
79
- this.streamMessageController.toStreamerHandlers.get('MouseDown')([
80
- event.button,
81
- // We use the store value of this.coord as opposed to the mouseEvent.x/y as the mouseEvent location
82
- // uses the system cursor location which hasn't moved
83
- this.normalizedCoord.x,
84
- this.normalizedCoord.y
85
- ]);
86
- }
87
- onMouseUp(event) {
88
- if (!this.videoPlayer.isVideoReady()) {
89
- return;
90
- }
91
- this.streamMessageController.toStreamerHandlers.get('MouseUp')([
92
- event.button,
93
- // We use the store value of this.coord as opposed to the mouseEvent.x/y as the mouseEvent location
94
- // uses the system cursor location which hasn't moved
95
- this.normalizedCoord.x,
96
- this.normalizedCoord.y
97
- ]);
98
- }
99
- onMouseMove(event) {
100
- if (!this.videoPlayer.isVideoReady()) {
101
- return;
102
- }
103
- const styleWidth = this.videoPlayer.getVideoParentElement().clientWidth;
104
- const styleHeight = this.videoPlayer.getVideoParentElement().clientHeight;
105
- this.x += event.movementX;
106
- this.y += event.movementY;
107
- while (this.x > styleWidth) {
108
- this.x -= styleWidth;
109
- }
110
- while (this.y > styleHeight) {
111
- this.y -= styleHeight;
112
- }
113
- while (this.x < 0) {
114
- this.x += styleWidth;
115
- }
116
- while (this.y < 0) {
117
- this.y += styleHeight;
118
- }
119
- this.normalizedCoord = this.coordinateConverter.translateUnsigned(this.x, this.y);
120
- const delta = this.coordinateConverter.translateSigned(event.movementX, event.movementY);
121
- this.streamMessageController.toStreamerHandlers.get('MouseMove')([
122
- this.normalizedCoord.x,
123
- this.normalizedCoord.y,
124
- delta.x,
125
- delta.y
126
- ]);
127
- }
128
- onMouseWheel(event) {
129
- if (!this.videoPlayer.isVideoReady()) {
130
- return;
131
- }
132
- this.streamMessageController.toStreamerHandlers.get('MouseWheel')([
133
- event.wheelDelta,
134
- // We use the store value of this.coord as opposed to the mouseEvent.x/y as the mouseEvent location
135
- // uses the system cursor location which hasn't moved
136
- this.normalizedCoord.x,
137
- this.normalizedCoord.y
138
- ]);
139
- }
140
- onMouseDblClick(event) {
141
- if (!this.videoPlayer.isVideoReady()) {
142
- return;
143
- }
144
- this.streamMessageController.toStreamerHandlers.get('MouseDouble')([
145
- event.button,
146
- // We use the store value of this.coord as opposed to the mouseEvent.x/y as the mouseEvent location
147
- // uses the system cursor location which hasn't moved
148
- this.normalizedCoord.x,
149
- this.normalizedCoord.y
150
- ]);
151
- }
152
- }
153
- exports.MouseControllerLocked = MouseControllerLocked;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.MouseControllerLocked = void 0;
4
+ const lib_pixelstreamingcommon_ue5_5_1 = require("@epicgames-ps/lib-pixelstreamingcommon-ue5.5");
5
+ const MouseController_1 = require("./MouseController");
6
+ /**
7
+ * A mouse controller that locks the mouse to the video document and prevents it from leaving the window
8
+ */
9
+ class MouseControllerLocked extends MouseController_1.MouseController {
10
+ constructor(streamMessageController, videoPlayer, coordinateConverter, activeKeys) {
11
+ super(streamMessageController, videoPlayer, coordinateConverter, activeKeys);
12
+ this.videoElementParent = videoPlayer.getVideoParentElement();
13
+ this.x = this.videoElementParent.getBoundingClientRect().width / 2;
14
+ this.y = this.videoElementParent.getBoundingClientRect().height / 2;
15
+ this.normalizedCoord = this.coordinateConverter.translateUnsigned(this.x, this.y);
16
+ this.onRequestLockListener = this.onRequestLock.bind(this);
17
+ this.onLockStateChangeListener = this.onLockStateChange.bind(this);
18
+ this.onMouseUpListener = this.onMouseUp.bind(this);
19
+ this.onMouseDownListener = this.onMouseDown.bind(this);
20
+ this.onMouseDblClickListener = this.onMouseDblClick.bind(this);
21
+ this.onMouseWheelListener = this.onMouseWheel.bind(this);
22
+ this.onMouseMoveListener = this.onMouseMove.bind(this);
23
+ }
24
+ register() {
25
+ super.register();
26
+ this.videoElementParent.requestPointerLock =
27
+ this.videoElementParent.requestPointerLock || this.videoElementParent.mozRequestPointerLock;
28
+ document.exitPointerLock = document.exitPointerLock || document.mozExitPointerLock;
29
+ if (this.videoElementParent.requestPointerLock) {
30
+ this.videoElementParent.addEventListener('click', this.onRequestLockListener);
31
+ }
32
+ document.addEventListener('pointerlockchange', this.onLockStateChangeListener);
33
+ document.addEventListener('mozpointerlockchange', this.onLockStateChangeListener);
34
+ this.videoElementParent.addEventListener('mousedown', this.onMouseDownListener);
35
+ this.videoElementParent.addEventListener('mouseup', this.onMouseUpListener);
36
+ this.videoElementParent.addEventListener('wheel', this.onMouseWheelListener);
37
+ this.videoElementParent.addEventListener('dblclick', this.onMouseDblClickListener);
38
+ }
39
+ unregister() {
40
+ const pointerLockElement = document.pointerLockElement || document.mozPointerLockElement;
41
+ if (document.exitPointerLock && pointerLockElement === this.videoElementParent) {
42
+ document.exitPointerLock();
43
+ }
44
+ this.videoElementParent.removeEventListener('click', this.onRequestLockListener);
45
+ document.removeEventListener('pointerlockchange', this.onLockStateChangeListener);
46
+ document.removeEventListener('mozpointerlockchange', this.onLockStateChangeListener);
47
+ document.removeEventListener('mousemove', this.onMouseMoveListener);
48
+ this.videoElementParent.removeEventListener('mousedown', this.onMouseDownListener);
49
+ this.videoElementParent.removeEventListener('mouseup', this.onMouseUpListener);
50
+ this.videoElementParent.removeEventListener('wheel', this.onMouseWheelListener);
51
+ this.videoElementParent.removeEventListener('dblclick', this.onMouseDblClickListener);
52
+ super.unregister();
53
+ }
54
+ onRequestLock() {
55
+ this.videoElementParent.requestPointerLock();
56
+ }
57
+ onLockStateChange() {
58
+ const pointerLockElement = document.pointerLockElement || document.mozPointerLockElement;
59
+ if (pointerLockElement === this.videoElementParent) {
60
+ lib_pixelstreamingcommon_ue5_5_1.Logger.Info('Pointer locked');
61
+ document.addEventListener('mousemove', this.onMouseMoveListener);
62
+ }
63
+ else {
64
+ lib_pixelstreamingcommon_ue5_5_1.Logger.Info('The pointer lock status is now unlocked');
65
+ document.removeEventListener('mousemove', this.onMouseMoveListener);
66
+ // If mouse loses focus, send a key up for all of the currently held-down keys
67
+ // This is necessary as when the mouse loses focus, the windows stops listening for events and as such
68
+ // the keyup listener won't get fired
69
+ const activeKeys = this.activeKeys.getActiveKeys();
70
+ activeKeys.forEach((key) => {
71
+ this.streamMessageController.toStreamerHandlers.get('KeyUp')([key]);
72
+ });
73
+ }
74
+ }
75
+ onMouseDown(event) {
76
+ if (!this.videoPlayer.isVideoReady()) {
77
+ return;
78
+ }
79
+ this.streamMessageController.toStreamerHandlers.get('MouseDown')([
80
+ event.button,
81
+ // We use the store value of this.coord as opposed to the mouseEvent.x/y as the mouseEvent location
82
+ // uses the system cursor location which hasn't moved
83
+ this.normalizedCoord.x,
84
+ this.normalizedCoord.y
85
+ ]);
86
+ }
87
+ onMouseUp(event) {
88
+ if (!this.videoPlayer.isVideoReady()) {
89
+ return;
90
+ }
91
+ this.streamMessageController.toStreamerHandlers.get('MouseUp')([
92
+ event.button,
93
+ // We use the store value of this.coord as opposed to the mouseEvent.x/y as the mouseEvent location
94
+ // uses the system cursor location which hasn't moved
95
+ this.normalizedCoord.x,
96
+ this.normalizedCoord.y
97
+ ]);
98
+ }
99
+ onMouseMove(event) {
100
+ if (!this.videoPlayer.isVideoReady()) {
101
+ return;
102
+ }
103
+ const styleWidth = this.videoPlayer.getVideoParentElement().clientWidth;
104
+ const styleHeight = this.videoPlayer.getVideoParentElement().clientHeight;
105
+ this.x += event.movementX;
106
+ this.y += event.movementY;
107
+ while (this.x > styleWidth) {
108
+ this.x -= styleWidth;
109
+ }
110
+ while (this.y > styleHeight) {
111
+ this.y -= styleHeight;
112
+ }
113
+ while (this.x < 0) {
114
+ this.x += styleWidth;
115
+ }
116
+ while (this.y < 0) {
117
+ this.y += styleHeight;
118
+ }
119
+ this.normalizedCoord = this.coordinateConverter.translateUnsigned(this.x, this.y);
120
+ const delta = this.coordinateConverter.translateSigned(event.movementX, event.movementY);
121
+ this.streamMessageController.toStreamerHandlers.get('MouseMove')([
122
+ this.normalizedCoord.x,
123
+ this.normalizedCoord.y,
124
+ delta.x,
125
+ delta.y
126
+ ]);
127
+ }
128
+ onMouseWheel(event) {
129
+ if (!this.videoPlayer.isVideoReady()) {
130
+ return;
131
+ }
132
+ this.streamMessageController.toStreamerHandlers.get('MouseWheel')([
133
+ event.wheelDelta,
134
+ // We use the store value of this.coord as opposed to the mouseEvent.x/y as the mouseEvent location
135
+ // uses the system cursor location which hasn't moved
136
+ this.normalizedCoord.x,
137
+ this.normalizedCoord.y
138
+ ]);
139
+ }
140
+ onMouseDblClick(event) {
141
+ if (!this.videoPlayer.isVideoReady()) {
142
+ return;
143
+ }
144
+ this.streamMessageController.toStreamerHandlers.get('MouseDouble')([
145
+ event.button,
146
+ // We use the store value of this.coord as opposed to the mouseEvent.x/y as the mouseEvent location
147
+ // uses the system cursor location which hasn't moved
148
+ this.normalizedCoord.x,
149
+ this.normalizedCoord.y
150
+ ]);
151
+ }
152
+ }
153
+ exports.MouseControllerLocked = MouseControllerLocked;
154
154
  //# sourceMappingURL=MouseControllerLocked.js.map
@@ -1,20 +1,20 @@
1
- "use strict";
2
- // Copyright Epic Games, Inc. All Rights Reserved.
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.SpecialKeyCodes = void 0;
5
- /**
6
- * Registers the Special Key codes
7
- * Must be kept in sync with JavaScriptKeyCodeToFKey C++ array.
8
- * The index of the entry in the array is the special key code given below.
9
- */
10
- class SpecialKeyCodes {
11
- }
12
- exports.SpecialKeyCodes = SpecialKeyCodes;
13
- SpecialKeyCodes.backSpace = 8;
14
- SpecialKeyCodes.shift = 16;
15
- SpecialKeyCodes.control = 17;
16
- SpecialKeyCodes.alt = 18;
17
- SpecialKeyCodes.rightShift = 253;
18
- SpecialKeyCodes.rightControl = 254;
19
- SpecialKeyCodes.rightAlt = 255;
1
+ "use strict";
2
+ // Copyright Epic Games, Inc. All Rights Reserved.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.SpecialKeyCodes = void 0;
5
+ /**
6
+ * Registers the Special Key codes
7
+ * Must be kept in sync with JavaScriptKeyCodeToFKey C++ array.
8
+ * The index of the entry in the array is the special key code given below.
9
+ */
10
+ class SpecialKeyCodes {
11
+ }
12
+ exports.SpecialKeyCodes = SpecialKeyCodes;
13
+ SpecialKeyCodes.backSpace = 8;
14
+ SpecialKeyCodes.shift = 16;
15
+ SpecialKeyCodes.control = 17;
16
+ SpecialKeyCodes.alt = 18;
17
+ SpecialKeyCodes.rightShift = 253;
18
+ SpecialKeyCodes.rightControl = 254;
19
+ SpecialKeyCodes.rightAlt = 255;
20
20
  //# sourceMappingURL=SpecialKeyCodes.js.map
@@ -1,124 +1,124 @@
1
- "use strict";
2
- // Copyright Epic Games, Inc. All Rights Reserved.
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.TouchController = void 0;
5
- const lib_pixelstreamingcommon_ue5_5_1 = require("@epicgames-ps/lib-pixelstreamingcommon-ue5.5");
6
- /**
7
- * The basic touch controller that handles the touch events on the document.
8
- */
9
- class TouchController {
10
- constructor(streamMessageController, videoPlayer, coordinateConverter) {
11
- this.fingers = [9, 8, 7, 6, 5, 4, 3, 2, 1, 0];
12
- this.fingerIds = new Map();
13
- this.maxByteValue = 255;
14
- this.streamMessageController = streamMessageController;
15
- this.videoPlayer = videoPlayer;
16
- this.coordinateConverter = coordinateConverter;
17
- this.videoElementParent = videoPlayer.getVideoElement();
18
- this.onTouchStartListener = this.onTouchStart.bind(this);
19
- this.onTouchEndListener = this.onTouchEnd.bind(this);
20
- this.onTouchMoveListener = this.onTouchMove.bind(this);
21
- }
22
- register() {
23
- this.videoElementParent.addEventListener('touchstart', this.onTouchStartListener);
24
- this.videoElementParent.addEventListener('touchend', this.onTouchEndListener);
25
- this.videoElementParent.addEventListener('touchmove', this.onTouchMoveListener);
26
- }
27
- unregister() {
28
- this.videoElementParent.addEventListener('touchstart', this.onTouchStartListener);
29
- this.videoElementParent.addEventListener('touchend', this.onTouchEndListener);
30
- this.videoElementParent.addEventListener('touchmove', this.onTouchMoveListener);
31
- }
32
- rememberTouch(touch) {
33
- const finger = this.fingers.pop();
34
- if (finger === undefined) {
35
- lib_pixelstreamingcommon_ue5_5_1.Logger.Info('exhausted touch identifiers');
36
- }
37
- this.fingerIds.set(touch.identifier, finger);
38
- }
39
- forgetTouch(touch) {
40
- this.fingers.push(this.fingerIds.get(touch.identifier));
41
- // Sort array back into descending order. This means if finger '1' were to lift after finger '0', we would ensure that 0 will be the first index to pop
42
- this.fingers.sort(function (a, b) {
43
- return b - a;
44
- });
45
- this.fingerIds.delete(touch.identifier);
46
- }
47
- onTouchStart(touchEvent) {
48
- if (!this.videoPlayer.isVideoReady()) {
49
- return;
50
- }
51
- for (let t = 0; t < touchEvent.changedTouches.length; t++) {
52
- this.rememberTouch(touchEvent.changedTouches[t]);
53
- }
54
- this.emitTouchData('TouchStart', touchEvent.changedTouches);
55
- touchEvent.preventDefault();
56
- }
57
- onTouchEnd(touchEvent) {
58
- if (!this.videoPlayer.isVideoReady()) {
59
- return;
60
- }
61
- this.emitTouchData('TouchEnd', touchEvent.changedTouches);
62
- // Re-cycle unique identifiers previously assigned to each touch.
63
- for (let t = 0; t < touchEvent.changedTouches.length; t++) {
64
- this.forgetTouch(touchEvent.changedTouches[t]);
65
- }
66
- touchEvent.preventDefault();
67
- }
68
- onTouchMove(touchEvent) {
69
- if (!this.videoPlayer.isVideoReady()) {
70
- return;
71
- }
72
- this.emitTouchData('TouchMove', touchEvent.touches);
73
- touchEvent.preventDefault();
74
- }
75
- emitTouchData(type, touches) {
76
- if (!this.videoPlayer.isVideoReady()) {
77
- return;
78
- }
79
- const offset = this.videoPlayer.getVideoParentElement().getBoundingClientRect();
80
- const toStreamerHandlers = this.streamMessageController.toStreamerHandlers;
81
- for (let t = 0; t < touches.length; t++) {
82
- const numTouches = 1; // the number of touches to be sent this message
83
- const touch = touches[t];
84
- const x = touch.clientX - offset.left;
85
- const y = touch.clientY - offset.top;
86
- lib_pixelstreamingcommon_ue5_5_1.Logger.Info(`F${this.fingerIds.get(touch.identifier)}=(${x}, ${y})`);
87
- const coord = this.coordinateConverter.translateUnsigned(x, y);
88
- switch (type) {
89
- case 'TouchStart':
90
- toStreamerHandlers.get('TouchStart')([
91
- numTouches,
92
- coord.x,
93
- coord.y,
94
- this.fingerIds.get(touch.identifier),
95
- this.maxByteValue * (touch.force > 0 ? touch.force : 1),
96
- coord.inRange ? 1 : 0
97
- ]);
98
- break;
99
- case 'TouchEnd':
100
- toStreamerHandlers.get('TouchEnd')([
101
- numTouches,
102
- coord.x,
103
- coord.y,
104
- this.fingerIds.get(touch.identifier),
105
- this.maxByteValue * touch.force,
106
- coord.inRange ? 1 : 0
107
- ]);
108
- break;
109
- case 'TouchMove':
110
- toStreamerHandlers.get('TouchMove')([
111
- numTouches,
112
- coord.x,
113
- coord.y,
114
- this.fingerIds.get(touch.identifier),
115
- this.maxByteValue * (touch.force > 0 ? touch.force : 1),
116
- coord.inRange ? 1 : 0
117
- ]);
118
- break;
119
- }
120
- }
121
- }
122
- }
123
- exports.TouchController = TouchController;
1
+ "use strict";
2
+ // Copyright Epic Games, Inc. All Rights Reserved.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.TouchController = void 0;
5
+ const lib_pixelstreamingcommon_ue5_5_1 = require("@epicgames-ps/lib-pixelstreamingcommon-ue5.5");
6
+ /**
7
+ * The basic touch controller that handles the touch events on the document.
8
+ */
9
+ class TouchController {
10
+ constructor(streamMessageController, videoPlayer, coordinateConverter) {
11
+ this.fingers = [9, 8, 7, 6, 5, 4, 3, 2, 1, 0];
12
+ this.fingerIds = new Map();
13
+ this.maxByteValue = 255;
14
+ this.streamMessageController = streamMessageController;
15
+ this.videoPlayer = videoPlayer;
16
+ this.coordinateConverter = coordinateConverter;
17
+ this.videoElementParent = videoPlayer.getVideoElement();
18
+ this.onTouchStartListener = this.onTouchStart.bind(this);
19
+ this.onTouchEndListener = this.onTouchEnd.bind(this);
20
+ this.onTouchMoveListener = this.onTouchMove.bind(this);
21
+ }
22
+ register() {
23
+ this.videoElementParent.addEventListener('touchstart', this.onTouchStartListener);
24
+ this.videoElementParent.addEventListener('touchend', this.onTouchEndListener);
25
+ this.videoElementParent.addEventListener('touchmove', this.onTouchMoveListener);
26
+ }
27
+ unregister() {
28
+ this.videoElementParent.addEventListener('touchstart', this.onTouchStartListener);
29
+ this.videoElementParent.addEventListener('touchend', this.onTouchEndListener);
30
+ this.videoElementParent.addEventListener('touchmove', this.onTouchMoveListener);
31
+ }
32
+ rememberTouch(touch) {
33
+ const finger = this.fingers.pop();
34
+ if (finger === undefined) {
35
+ lib_pixelstreamingcommon_ue5_5_1.Logger.Info('exhausted touch identifiers');
36
+ }
37
+ this.fingerIds.set(touch.identifier, finger);
38
+ }
39
+ forgetTouch(touch) {
40
+ this.fingers.push(this.fingerIds.get(touch.identifier));
41
+ // Sort array back into descending order. This means if finger '1' were to lift after finger '0', we would ensure that 0 will be the first index to pop
42
+ this.fingers.sort(function (a, b) {
43
+ return b - a;
44
+ });
45
+ this.fingerIds.delete(touch.identifier);
46
+ }
47
+ onTouchStart(touchEvent) {
48
+ if (!this.videoPlayer.isVideoReady()) {
49
+ return;
50
+ }
51
+ for (let t = 0; t < touchEvent.changedTouches.length; t++) {
52
+ this.rememberTouch(touchEvent.changedTouches[t]);
53
+ }
54
+ this.emitTouchData('TouchStart', touchEvent.changedTouches);
55
+ touchEvent.preventDefault();
56
+ }
57
+ onTouchEnd(touchEvent) {
58
+ if (!this.videoPlayer.isVideoReady()) {
59
+ return;
60
+ }
61
+ this.emitTouchData('TouchEnd', touchEvent.changedTouches);
62
+ // Re-cycle unique identifiers previously assigned to each touch.
63
+ for (let t = 0; t < touchEvent.changedTouches.length; t++) {
64
+ this.forgetTouch(touchEvent.changedTouches[t]);
65
+ }
66
+ touchEvent.preventDefault();
67
+ }
68
+ onTouchMove(touchEvent) {
69
+ if (!this.videoPlayer.isVideoReady()) {
70
+ return;
71
+ }
72
+ this.emitTouchData('TouchMove', touchEvent.touches);
73
+ touchEvent.preventDefault();
74
+ }
75
+ emitTouchData(type, touches) {
76
+ if (!this.videoPlayer.isVideoReady()) {
77
+ return;
78
+ }
79
+ const offset = this.videoPlayer.getVideoParentElement().getBoundingClientRect();
80
+ const toStreamerHandlers = this.streamMessageController.toStreamerHandlers;
81
+ for (let t = 0; t < touches.length; t++) {
82
+ const numTouches = 1; // the number of touches to be sent this message
83
+ const touch = touches[t];
84
+ const x = touch.clientX - offset.left;
85
+ const y = touch.clientY - offset.top;
86
+ lib_pixelstreamingcommon_ue5_5_1.Logger.Info(`F${this.fingerIds.get(touch.identifier)}=(${x}, ${y})`);
87
+ const coord = this.coordinateConverter.translateUnsigned(x, y);
88
+ switch (type) {
89
+ case 'TouchStart':
90
+ toStreamerHandlers.get('TouchStart')([
91
+ numTouches,
92
+ coord.x,
93
+ coord.y,
94
+ this.fingerIds.get(touch.identifier),
95
+ this.maxByteValue * (touch.force > 0 ? touch.force : 1),
96
+ coord.inRange ? 1 : 0
97
+ ]);
98
+ break;
99
+ case 'TouchEnd':
100
+ toStreamerHandlers.get('TouchEnd')([
101
+ numTouches,
102
+ coord.x,
103
+ coord.y,
104
+ this.fingerIds.get(touch.identifier),
105
+ this.maxByteValue * touch.force,
106
+ coord.inRange ? 1 : 0
107
+ ]);
108
+ break;
109
+ case 'TouchMove':
110
+ toStreamerHandlers.get('TouchMove')([
111
+ numTouches,
112
+ coord.x,
113
+ coord.y,
114
+ this.fingerIds.get(touch.identifier),
115
+ this.maxByteValue * (touch.force > 0 ? touch.force : 1),
116
+ coord.inRange ? 1 : 0
117
+ ]);
118
+ break;
119
+ }
120
+ }
121
+ }
122
+ }
123
+ exports.TouchController = TouchController;
124
124
  //# sourceMappingURL=TouchController.js.map