@epicgames-ps/lib-pixelstreamingfrontend-ue5.5 1.0.2 → 1.1.0

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 (92) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/dist/cjs/Config/Config.js +16 -23
  3. package/dist/cjs/Config/Config.js.map +1 -1
  4. package/dist/cjs/Inputs/GamepadController.js.map +1 -1
  5. package/dist/cjs/Inputs/KeyboardController.js +0 -23
  6. package/dist/cjs/Inputs/KeyboardController.js.map +1 -1
  7. package/dist/cjs/Inputs/MouseController.js +9 -6
  8. package/dist/cjs/Inputs/MouseController.js.map +1 -1
  9. package/dist/cjs/Inputs/MouseControllerHovering.js.map +1 -1
  10. package/dist/cjs/Inputs/MouseControllerLocked.js +1 -0
  11. package/dist/cjs/Inputs/MouseControllerLocked.js.map +1 -1
  12. package/dist/cjs/PixelStreaming/PixelStreaming.js +12 -13
  13. package/dist/cjs/PixelStreaming/PixelStreaming.js.map +1 -1
  14. package/dist/cjs/UeInstanceMessage/StreamMessageController.js +4 -0
  15. package/dist/cjs/UeInstanceMessage/StreamMessageController.js.map +1 -1
  16. package/dist/cjs/Util/BrowserUtils.js +32 -0
  17. package/dist/cjs/Util/BrowserUtils.js.map +1 -0
  18. package/dist/cjs/Util/EventEmitter.js +11 -1
  19. package/dist/cjs/Util/EventEmitter.js.map +1 -1
  20. package/dist/cjs/Util/IURLSearchParams.js +1 -0
  21. package/dist/cjs/Util/IURLSearchParams.js.map +1 -1
  22. package/dist/cjs/Util/RTCUtils.js +1 -0
  23. package/dist/cjs/Util/RTCUtils.js.map +1 -1
  24. package/dist/cjs/VideoPlayer/VideoPlayer.js +12 -1
  25. package/dist/cjs/VideoPlayer/VideoPlayer.js.map +1 -1
  26. package/dist/cjs/WebRtcPlayer/WebRtcPlayerController.js +31 -7
  27. package/dist/cjs/WebRtcPlayer/WebRtcPlayerController.js.map +1 -1
  28. package/dist/esm/Config/Config.js +16 -23
  29. package/dist/esm/Config/Config.js.map +1 -1
  30. package/dist/esm/Inputs/GamepadController.js.map +1 -1
  31. package/dist/esm/Inputs/KeyboardController.js +0 -23
  32. package/dist/esm/Inputs/KeyboardController.js.map +1 -1
  33. package/dist/esm/Inputs/MouseController.js +9 -6
  34. package/dist/esm/Inputs/MouseController.js.map +1 -1
  35. package/dist/esm/Inputs/MouseControllerHovering.js.map +1 -1
  36. package/dist/esm/Inputs/MouseControllerLocked.js +1 -0
  37. package/dist/esm/Inputs/MouseControllerLocked.js.map +1 -1
  38. package/dist/esm/PixelStreaming/PixelStreaming.js +12 -13
  39. package/dist/esm/PixelStreaming/PixelStreaming.js.map +1 -1
  40. package/dist/esm/UeInstanceMessage/StreamMessageController.js +4 -0
  41. package/dist/esm/UeInstanceMessage/StreamMessageController.js.map +1 -1
  42. package/dist/esm/Util/BrowserUtils.js +28 -0
  43. package/dist/esm/Util/BrowserUtils.js.map +1 -0
  44. package/dist/esm/Util/EventEmitter.js +9 -0
  45. package/dist/esm/Util/EventEmitter.js.map +1 -1
  46. package/dist/esm/Util/IURLSearchParams.js +1 -0
  47. package/dist/esm/Util/IURLSearchParams.js.map +1 -1
  48. package/dist/esm/Util/RTCUtils.js +1 -0
  49. package/dist/esm/Util/RTCUtils.js.map +1 -1
  50. package/dist/esm/VideoPlayer/VideoPlayer.js +12 -1
  51. package/dist/esm/VideoPlayer/VideoPlayer.js.map +1 -1
  52. package/dist/esm/WebRtcPlayer/WebRtcPlayerController.js +32 -8
  53. package/dist/esm/WebRtcPlayer/WebRtcPlayerController.js.map +1 -1
  54. package/dist/types/Config/Config.d.ts +8 -0
  55. package/dist/types/Inputs/KeyboardController.d.ts +0 -2
  56. package/dist/types/PixelStreaming/PixelStreaming.d.ts +6 -6
  57. package/dist/types/Util/BrowserUtils.d.ts +3 -0
  58. package/dist/types/Util/EventEmitter.d.ts +14 -1
  59. package/dist/types/VideoPlayer/VideoPlayer.d.ts +2 -1
  60. package/dist/types/WebRtcPlayer/WebRtcPlayerController.d.ts +10 -5
  61. package/eslint.config.mjs +4 -4
  62. package/package.json +2 -2
  63. package/src/Config/Config.ts +32 -30
  64. package/src/Config/SettingBase.ts +1 -1
  65. package/src/Config/SettingFlag.ts +1 -1
  66. package/src/Config/SettingNumber.ts +1 -1
  67. package/src/Config/SettingOption.ts +2 -2
  68. package/src/Config/SettingText.ts +1 -1
  69. package/src/Inputs/GamepadController.ts +1 -2
  70. package/src/Inputs/IInputController.ts +1 -0
  71. package/src/Inputs/KeyboardController.ts +0 -31
  72. package/src/Inputs/MouseController.ts +9 -8
  73. package/src/Inputs/MouseControllerHovering.ts +1 -0
  74. package/src/Inputs/MouseControllerLocked.ts +1 -0
  75. package/src/PixelStreaming/PixelStreaming.ts +13 -19
  76. package/src/UeInstanceMessage/StreamMessageController.ts +4 -0
  77. package/src/Util/BrowserUtils.ts +36 -0
  78. package/src/Util/EventEmitter.ts +19 -0
  79. package/src/Util/IURLSearchParams.ts +1 -0
  80. package/src/Util/RTCUtils.ts +1 -0
  81. package/src/VideoPlayer/VideoPlayer.ts +14 -2
  82. package/src/WebRtcPlayer/WebRtcPlayerController.ts +35 -8
  83. package/tsconfig.cjs.json +1 -1
  84. package/tsconfig.esm.json +1 -1
  85. package/tsconfig.jest.json +1 -1
  86. package/dist/cjs/UI/OnScreenKeyboard.js +0 -86
  87. package/dist/cjs/UI/OnScreenKeyboard.js.map +0 -1
  88. package/dist/esm/UI/OnScreenKeyboard.js +0 -82
  89. package/dist/esm/UI/OnScreenKeyboard.js.map +0 -1
  90. package/dist/types/UI/OnScreenKeyboard.d.ts +0 -30
  91. package/src/UI/OnScreenKeyboard.ts +0 -102
  92. /package/{tsconfig.base.json → tsconfig.json} +0 -0
@@ -34,7 +34,7 @@ import { ResponseController } from '../UeInstanceMessage/ResponseController';
34
34
  import { SendMessageController } from '../UeInstanceMessage/SendMessageController';
35
35
  import { ToStreamerMessagesController } from '../UeInstanceMessage/ToStreamerMessagesController';
36
36
  import { DataChannelSender } from '../DataChannel/DataChannelSender';
37
- import { InputCoordTranslator, UntranslatedCoordUnsigned } from '../Util/InputCoordTranslator';
37
+ import { InputCoordTranslator } from '../Util/InputCoordTranslator';
38
38
  import { PixelStreaming } from '../PixelStreaming/PixelStreaming';
39
39
  import {
40
40
  DataChannelCloseEvent,
@@ -45,6 +45,7 @@ import {
45
45
  PlayStreamErrorEvent,
46
46
  PlayStreamEvent,
47
47
  PlayStreamRejectedEvent,
48
+ ShowOnScreenKeyboardEvent,
48
49
  StreamerListMessageEvent,
49
50
  StreamerIDChangedMessageEvent
50
51
  } from '../Util/EventEmitter';
@@ -56,6 +57,7 @@ import { IURLSearchParams } from '../Util/IURLSearchParams';
56
57
  import { IInputController } from '../Inputs/IInputController';
57
58
  import { GamepadController } from '../Inputs/GamepadController';
58
59
  import { LatencyInfo } from '../PeerConnectionController/LatencyCalculator';
60
+ import { BrowserUtils } from '../Util/BrowserUtils';
59
61
 
60
62
  /**
61
63
  * Entry point for the WebRTC Player
@@ -169,7 +171,7 @@ export class WebRtcPlayerController {
169
171
  this.streamMessageController = new StreamMessageController();
170
172
 
171
173
  // set up websocket methods
172
- this.transport = new WebSocketTransport();
174
+ this.transport = new WebSocketTransport(config.webSocketProtocols);
173
175
  this.protocol = new SignallingProtocol(this.transport);
174
176
  this.protocol.addListener(Messages.config.typeName, (msg: BaseMessage) =>
175
177
  this.handleOnConfigMessage(msg as Messages.config)
@@ -232,6 +234,11 @@ export class WebRtcPlayerController {
232
234
 
233
235
  this.forceReconnect = false;
234
236
 
237
+ // Reset the list of all possible codecs on disconnect so that if the next connection has "NegotiateCodecs" on
238
+ // then all codecs can be negotiated
239
+ this.config.getSettingOption(OptionParameters.PreferredCodec).options =
240
+ BrowserUtils.getSupportedVideoCodecs();
241
+
235
242
  this.pixelStreaming._onDisconnect(disconnectMessage, allowClickToReconnect);
236
243
 
237
244
  this.afkController.stopAfkWarningTimer();
@@ -335,12 +342,11 @@ export class WebRtcPlayerController {
335
342
  }
336
343
 
337
344
  /**
338
- * Make a request to UnquantizedAndDenormalizeUnsigned coordinates
339
- * @param x x axis coordinate
340
- * @param y y axis coordinate
345
+ * Destroys the video player and makes sure resources are freed. This helps to prevent the issue in chrome
346
+ * where it refuses to make new video players.
341
347
  */
342
- requestUnquantizedAndDenormalizeUnsigned(x: number, y: number): UntranslatedCoordUnsigned {
343
- return this.coordinateConverter.untranslateUnsigned(x, y);
348
+ destroyVideoPlayer() {
349
+ this.videoPlayer.destroy();
344
350
  }
345
351
 
346
352
  /**
@@ -700,11 +706,23 @@ export class WebRtcPlayerController {
700
706
 
701
707
  Logger.Info('Data Channel Command: ' + commandAsString);
702
708
  const command = JSON.parse(commandAsString);
709
+
710
+ // Handle "onScreenKeyboard" event
703
711
  if (command.command === 'onScreenKeyboard') {
704
- this.pixelStreaming._activateOnScreenKeyboard(command);
712
+ this.handleOnScreenKeyboardCommand(command);
705
713
  }
706
714
  }
707
715
 
716
+ handleOnScreenKeyboardCommand(command: any) {
717
+ const data: ShowOnScreenKeyboardEvent['data'] = {
718
+ showOnScreenKeyboard: command.showOnScreenKeyboard ?? true,
719
+ x: command.x ?? 0,
720
+ y: command.y ?? 0,
721
+ contents: command.contents ?? ''
722
+ };
723
+ this.pixelStreaming.dispatchEvent(new ShowOnScreenKeyboardEvent(data));
724
+ }
725
+
708
726
  /**
709
727
  * Handles a protocol message received from the streamer
710
728
  * @param message the message data from the streamer
@@ -1762,6 +1780,15 @@ export class WebRtcPlayerController {
1762
1780
  this.toStreamerMessagesController.SendRequestQualityControl();
1763
1781
  }
1764
1782
 
1783
+ /**
1784
+ * Send a `TextBoxEntry` message back to UE.
1785
+ * @param contents The new contents of the UE side text box.
1786
+ */
1787
+ sendTextboxEntry(contents: string) {
1788
+ Logger.Info('---- Sending TextboxEntry message ----');
1789
+ this.streamMessageController.toStreamerHandlers.get('TextboxEntry')?.([contents]);
1790
+ }
1791
+
1765
1792
  /**
1766
1793
  * Handles when a Latency Test Result are received from the UE Instance
1767
1794
  * @param message - Latency Test Timings
package/tsconfig.cjs.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "extends": "./tsconfig.base.json",
2
+ "extends": "./tsconfig.json",
3
3
  "compilerOptions": {
4
4
  "outDir": "./dist/cjs",
5
5
  "module": "commonjs"
package/tsconfig.esm.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "extends": "./tsconfig.base.json",
2
+ "extends": "./tsconfig.json",
3
3
  "compilerOptions": {
4
4
  "outDir": "./dist/esm",
5
5
  "module": "es6",
@@ -1,5 +1,5 @@
1
1
  {
2
- "extends": "./tsconfig.base.json",
2
+ "extends": "./tsconfig.json",
3
3
  "include": ["./src/**/*.ts"],
4
4
  "exclude": [],
5
5
  "compilerOptions": {
@@ -1,86 +0,0 @@
1
- "use strict";
2
- // Copyright Epic Games, Inc. All Rights Reserved.
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.OnScreenKeyboard = void 0;
5
- /**
6
- * Class for handling on screen keyboard usage
7
- */
8
- class OnScreenKeyboard {
9
- /**
10
- *
11
- * @param videoElementParent The div element the video player is injected into
12
- */
13
- constructor(videoElementParent) {
14
- this.editTextButton = null;
15
- this.hiddenInput = null;
16
- if ('ontouchstart' in document.documentElement) {
17
- this.createOnScreenKeyboardHelpers(videoElementParent);
18
- }
19
- }
20
- /**
21
- * An override for unquantizeAndDenormalizeUnsigned
22
- * @param x the x axis point
23
- * @param y the y axis point
24
- * @returns unquantizeAndDenormalizeUnsigned object
25
- */
26
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
27
- unquantizeAndDenormalizeUnsigned(x, y) {
28
- return null;
29
- }
30
- /**
31
- * Creates on screen keyboard helpers
32
- * @param videoElementParent The div element the video player i injected into
33
- */
34
- createOnScreenKeyboardHelpers(videoElementParent) {
35
- if (!this.hiddenInput) {
36
- this.hiddenInput = document.createElement('input');
37
- this.hiddenInput.id = 'hiddenInput';
38
- this.hiddenInput.maxLength = 0;
39
- // Set inline style so that users not using the UI library
40
- // will still have this element display correctly
41
- this.hiddenInput.style.position = 'absolute';
42
- this.hiddenInput.style.left = '-10%';
43
- this.hiddenInput.style.width = '0px';
44
- this.hiddenInput.style.opacity = '0';
45
- videoElementParent.appendChild(this.hiddenInput);
46
- }
47
- if (!this.editTextButton) {
48
- this.editTextButton = document.createElement('button');
49
- this.editTextButton.id = 'editTextButton';
50
- this.editTextButton.innerHTML = 'edit text';
51
- videoElementParent.appendChild(this.editTextButton);
52
- // Hide the 'edit text' button.
53
- this.editTextButton.style.display = 'none';
54
- this.editTextButton.addEventListener('touchend', (event) => {
55
- // Show the on-screen keyboard.
56
- this.hiddenInput.focus();
57
- event.preventDefault();
58
- });
59
- }
60
- }
61
- /**
62
- * Shows the on screen keyboard
63
- * @param command the command received via the data channel containing keyboard positions
64
- */
65
- showOnScreenKeyboard(command) {
66
- if (!this.editTextButton) {
67
- return;
68
- }
69
- if (command.showOnScreenKeyboard) {
70
- // Show the 'edit text' button.
71
- this.editTextButton.style.display = 'block';
72
- // Place the 'edit text' button near the UE input widget.
73
- const pos = this.unquantizeAndDenormalizeUnsigned(command.x, command.y);
74
- this.editTextButton.style.top = pos.y.toString() + 'px';
75
- this.editTextButton.style.left = (pos.x - 40).toString() + 'px';
76
- }
77
- else {
78
- // Hide the 'edit text' button.
79
- this.editTextButton.style.display = 'none';
80
- // Hide the on-screen keyboard.
81
- this.hiddenInput.blur();
82
- }
83
- }
84
- }
85
- exports.OnScreenKeyboard = OnScreenKeyboard;
86
- //# sourceMappingURL=OnScreenKeyboard.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"OnScreenKeyboard.js","sourceRoot":"","sources":["../../../src/UI/OnScreenKeyboard.ts"],"names":[],"mappings":";AAAA,kDAAkD;;;AAIlD;;GAEG;AACH,MAAa,gBAAgB;IAUzB;;;OAGG;IACH,YAAY,kBAA+B;QACvC,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC;QAC3B,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC;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CAAC,OAAO,GAAG,MAAM,CAAC;YAE3C,IAAI,CAAC,cAAc,CAAC,gBAAgB,CAAC,UAAU,EAAE,CAAC,KAAY,EAAE,EAAE;gBAC9D,+BAA+B;gBAC/B,IAAI,CAAC,WAAW,CAAC,KAAK,EAAE,CAAC;gBACzB,KAAK,CAAC,cAAc,EAAE,CAAC;YAC3B,CAAC,CAAC,CAAC;QACP,CAAC;IACL,CAAC;IAED;;;OAGG;IACH,oBAAoB,CAAC,OAAY;QAC7B,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE,CAAC;YACvB,OAAO;QACX,CAAC;QAED,IAAI,OAAO,CAAC,oBAAoB,EAAE,CAAC;YAC/B,+BAA+B;YAC/B,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,OAAO,GAAG,OAAO,CAAC;YAC5C,yDAAyD;YACzD,MAAM,GAAG,GAAG,IAAI,CAAC,gCAAgC,CAAC,OAAO,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC;YACxE,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,GAAG,GAAG,GAAG,CAAC,CAAC,CAAC,QAAQ,EAAE,GAAG,IAAI,CAAC;YACxD,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,IAAI,GAAG,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC,QAAQ,EAAE,GAAG,IAAI,CAAC;QACpE,CAAC;aAAM,CAAC;YACJ,+BAA+B;YAC/B,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,OAAO,GAAG,MAAM,CAAC;YAC3C,+BAA+B;YAC/B,IAAI,CAAC,WAAW,CAAC,IAAI,EAAE,CAAC;QAC5B,CAAC;IACL,CAAC;CACJ;AA9FD,4CA8FC"}
@@ -1,82 +0,0 @@
1
- // Copyright Epic Games, Inc. All Rights Reserved.
2
- /**
3
- * Class for handling on screen keyboard usage
4
- */
5
- export class OnScreenKeyboard {
6
- /**
7
- *
8
- * @param videoElementParent The div element the video player is injected into
9
- */
10
- constructor(videoElementParent) {
11
- this.editTextButton = null;
12
- this.hiddenInput = null;
13
- if ('ontouchstart' in document.documentElement) {
14
- this.createOnScreenKeyboardHelpers(videoElementParent);
15
- }
16
- }
17
- /**
18
- * An override for unquantizeAndDenormalizeUnsigned
19
- * @param x the x axis point
20
- * @param y the y axis point
21
- * @returns unquantizeAndDenormalizeUnsigned object
22
- */
23
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
24
- unquantizeAndDenormalizeUnsigned(x, y) {
25
- return null;
26
- }
27
- /**
28
- * Creates on screen keyboard helpers
29
- * @param videoElementParent The div element the video player i injected into
30
- */
31
- createOnScreenKeyboardHelpers(videoElementParent) {
32
- if (!this.hiddenInput) {
33
- this.hiddenInput = document.createElement('input');
34
- this.hiddenInput.id = 'hiddenInput';
35
- this.hiddenInput.maxLength = 0;
36
- // Set inline style so that users not using the UI library
37
- // will still have this element display correctly
38
- this.hiddenInput.style.position = 'absolute';
39
- this.hiddenInput.style.left = '-10%';
40
- this.hiddenInput.style.width = '0px';
41
- this.hiddenInput.style.opacity = '0';
42
- videoElementParent.appendChild(this.hiddenInput);
43
- }
44
- if (!this.editTextButton) {
45
- this.editTextButton = document.createElement('button');
46
- this.editTextButton.id = 'editTextButton';
47
- this.editTextButton.innerHTML = 'edit text';
48
- videoElementParent.appendChild(this.editTextButton);
49
- // Hide the 'edit text' button.
50
- this.editTextButton.style.display = 'none';
51
- this.editTextButton.addEventListener('touchend', (event) => {
52
- // Show the on-screen keyboard.
53
- this.hiddenInput.focus();
54
- event.preventDefault();
55
- });
56
- }
57
- }
58
- /**
59
- * Shows the on screen keyboard
60
- * @param command the command received via the data channel containing keyboard positions
61
- */
62
- showOnScreenKeyboard(command) {
63
- if (!this.editTextButton) {
64
- return;
65
- }
66
- if (command.showOnScreenKeyboard) {
67
- // Show the 'edit text' button.
68
- this.editTextButton.style.display = 'block';
69
- // Place the 'edit text' button near the UE input widget.
70
- const pos = this.unquantizeAndDenormalizeUnsigned(command.x, command.y);
71
- this.editTextButton.style.top = pos.y.toString() + 'px';
72
- this.editTextButton.style.left = (pos.x - 40).toString() + 'px';
73
- }
74
- else {
75
- // Hide the 'edit text' button.
76
- this.editTextButton.style.display = 'none';
77
- // Hide the on-screen keyboard.
78
- this.hiddenInput.blur();
79
- }
80
- }
81
- }
82
- //# sourceMappingURL=OnScreenKeyboard.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"OnScreenKeyboard.js","sourceRoot":"","sources":["../../../src/UI/OnScreenKeyboard.ts"],"names":[],"mappings":"AAAA,kDAAkD;AAIlD;;GAEG;AACH,MAAM,OAAO,gBAAgB;IAUzB;;;OAGG;IACH,YAAY,kBAA+B;QACvC,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC;QAC3B,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC;QAExB,IAAI,cAAc,IAAI,QAAQ,CAAC,eAAe,EAAE,CAAC;YAC7C,IAAI,CAAC,6BAA6B,CAAC,kBAAkB,CAAC,CAAC;QAC3D,CAAC;IACL,CAAC;IAED;;;;;OAKG;IACH,6DAA6D;IAC7D,gCAAgC,CAAC,CAAS,EAAE,CAAS;QACjD,OAAO,IAAI,CAAC;IAChB,CAAC;IAED;;;OAGG;IACH,6BAA6B,CAAC,kBAA+B;QACzD,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC;YACpB,IAAI,CAAC,WAAW,GAAG,QAAQ,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;YACnD,IAAI,CAAC,WAAW,CAAC,EAAE,GAAG,aAAa,CAAC;YACpC,IAAI,CAAC,WAAW,CAAC,SAAS,GAAG,CAAC,CAAC;YAE/B,0DAA0D;YAC1D,kDAAkD;YAClD,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,QAAQ,GAAG,UAAU,CAAC;YAC7C,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,IAAI,GAAG,MAAM,CAAC;YACrC,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,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,IAAI,CAAC;YACxD,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,IAAI,GAAG,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC,QAAQ,EAAE,GAAG,IAAI,CAAC;QACpE,CAAC;aAAM,CAAC;YACJ,+BAA+B;YAC/B,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,OAAO,GAAG,MAAM,CAAC;YAC3C,+BAA+B;YAC/B,IAAI,CAAC,WAAW,CAAC,IAAI,EAAE,CAAC;QAC5B,CAAC;IACL,CAAC;CACJ"}
@@ -1,30 +0,0 @@
1
- import { UntranslatedCoordUnsigned } from '../Util/InputCoordTranslator';
2
- /**
3
- * Class for handling on screen keyboard usage
4
- */
5
- export declare class OnScreenKeyboard {
6
- editTextButton: HTMLButtonElement;
7
- hiddenInput: HTMLInputElement;
8
- /**
9
- *
10
- * @param videoElementParent The div element the video player is injected into
11
- */
12
- constructor(videoElementParent: HTMLElement);
13
- /**
14
- * An override for unquantizeAndDenormalizeUnsigned
15
- * @param x the x axis point
16
- * @param y the y axis point
17
- * @returns unquantizeAndDenormalizeUnsigned object
18
- */
19
- unquantizeAndDenormalizeUnsigned(x: number, y: number): UntranslatedCoordUnsigned;
20
- /**
21
- * Creates on screen keyboard helpers
22
- * @param videoElementParent The div element the video player i injected into
23
- */
24
- createOnScreenKeyboardHelpers(videoElementParent: HTMLElement): void;
25
- /**
26
- * Shows the on screen keyboard
27
- * @param command the command received via the data channel containing keyboard positions
28
- */
29
- showOnScreenKeyboard(command: any): void;
30
- }
@@ -1,102 +0,0 @@
1
- // Copyright Epic Games, Inc. All Rights Reserved.
2
-
3
- import { UntranslatedCoordUnsigned } from '../Util/InputCoordTranslator';
4
-
5
- /**
6
- * Class for handling on screen keyboard usage
7
- */
8
- export class OnScreenKeyboard {
9
- // If the user focuses on a UE input widget then we show them a button to open
10
- // the on-screen keyboard. JavaScript security means we can only show the
11
- // on-screen keyboard in response to a user interaction.
12
- editTextButton: HTMLButtonElement;
13
-
14
- // A hidden input text box which is used only for focusing and opening the
15
- // on-screen keyboard.
16
- hiddenInput: HTMLInputElement;
17
-
18
- /**
19
- *
20
- * @param videoElementParent The div element the video player is injected into
21
- */
22
- constructor(videoElementParent: HTMLElement) {
23
- this.editTextButton = null;
24
- this.hiddenInput = null;
25
-
26
- if ('ontouchstart' in document.documentElement) {
27
- this.createOnScreenKeyboardHelpers(videoElementParent);
28
- }
29
- }
30
-
31
- /**
32
- * An override for unquantizeAndDenormalizeUnsigned
33
- * @param x the x axis point
34
- * @param y the y axis point
35
- * @returns unquantizeAndDenormalizeUnsigned object
36
- */
37
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
38
- unquantizeAndDenormalizeUnsigned(x: number, y: number): UntranslatedCoordUnsigned {
39
- return null;
40
- }
41
-
42
- /**
43
- * Creates on screen keyboard helpers
44
- * @param videoElementParent The div element the video player i injected into
45
- */
46
- createOnScreenKeyboardHelpers(videoElementParent: HTMLElement) {
47
- if (!this.hiddenInput) {
48
- this.hiddenInput = document.createElement('input');
49
- this.hiddenInput.id = 'hiddenInput';
50
- this.hiddenInput.maxLength = 0;
51
-
52
- // Set inline style so that users not using the UI library
53
- // will still have this element display correctly
54
- this.hiddenInput.style.position = 'absolute';
55
- this.hiddenInput.style.left = '-10%';
56
- this.hiddenInput.style.width = '0px';
57
- this.hiddenInput.style.opacity = '0';
58
-
59
- videoElementParent.appendChild(this.hiddenInput);
60
- }
61
-
62
- if (!this.editTextButton) {
63
- this.editTextButton = document.createElement('button');
64
- this.editTextButton.id = 'editTextButton';
65
- this.editTextButton.innerHTML = 'edit text';
66
- videoElementParent.appendChild(this.editTextButton);
67
-
68
- // Hide the 'edit text' button.
69
- this.editTextButton.style.display = 'none';
70
-
71
- this.editTextButton.addEventListener('touchend', (event: Event) => {
72
- // Show the on-screen keyboard.
73
- this.hiddenInput.focus();
74
- event.preventDefault();
75
- });
76
- }
77
- }
78
-
79
- /**
80
- * Shows the on screen keyboard
81
- * @param command the command received via the data channel containing keyboard positions
82
- */
83
- showOnScreenKeyboard(command: any) {
84
- if (!this.editTextButton) {
85
- return;
86
- }
87
-
88
- if (command.showOnScreenKeyboard) {
89
- // Show the 'edit text' button.
90
- this.editTextButton.style.display = 'block';
91
- // Place the 'edit text' button near the UE input widget.
92
- const pos = this.unquantizeAndDenormalizeUnsigned(command.x, command.y);
93
- this.editTextButton.style.top = pos.y.toString() + 'px';
94
- this.editTextButton.style.left = (pos.x - 40).toString() + 'px';
95
- } else {
96
- // Hide the 'edit text' button.
97
- this.editTextButton.style.display = 'none';
98
- // Hide the on-screen keyboard.
99
- this.hiddenInput.blur();
100
- }
101
- }
102
- }
File without changes