@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,99 +1,99 @@
1
- "use strict";
2
- // Copyright Epic Games, Inc. All Rights Reserved.
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.SettingBase = void 0;
5
- /**
6
- * Base class for a setting that has a text label and an arbitrary setting value it stores.
7
- */
8
- class SettingBase {
9
- constructor(id, label, description, defaultSettingValue,
10
- // eslint-disable-next-line @typescript-eslint/no-empty-function
11
- defaultOnChangeListener = () => {
12
- /* Do nothing, to be overridden. */
13
- }) {
14
- this.parseURLParams();
15
- this.onChange = defaultOnChangeListener;
16
- this.onChangeEmit = () => {
17
- /* Do nothing, to be overridden. */
18
- };
19
- this.id = id;
20
- this.description = description;
21
- this.label = label;
22
- this.value = defaultSettingValue;
23
- }
24
- /**
25
- * Set the label text for the setting.
26
- * @param label setting label.
27
- */
28
- set label(inLabel) {
29
- this._label = inLabel;
30
- this.onChangeEmit(this._value);
31
- }
32
- /**
33
- * @returns The label text for the setting.
34
- */
35
- get label() {
36
- return this._label;
37
- }
38
- /**
39
- * @return The setting's value.
40
- */
41
- get value() {
42
- return this._value;
43
- }
44
- /**
45
- * Update the setting's stored value.
46
- * @param inValue The new value for the setting.
47
- */
48
- set value(inValue) {
49
- this._value = inValue;
50
- this.onChange(this._value, this);
51
- this.onChangeEmit(this._value);
52
- }
53
- /**
54
- * Persist the setting value in URL.
55
- */
56
- updateURLParams() {
57
- if (this.useUrlParams) {
58
- // set url params
59
- const urlParams = new URLSearchParams(window.location.search);
60
- const valueString = this.getValueAsString();
61
- let set = false;
62
- for (const [name, _value] of urlParams) {
63
- if (name.toLowerCase() == this.id.toLowerCase()) {
64
- urlParams.set(name, valueString);
65
- set = true;
66
- break;
67
- }
68
- }
69
- if (!set) {
70
- urlParams.set(this.id, valueString);
71
- }
72
- window.history.replaceState({}, '', urlParams.toString() !== '' ? `${location.pathname}?${urlParams}` : `${location.pathname}`);
73
- }
74
- }
75
- /**
76
- * Allows sub types to provide their value for the url search params.
77
- */
78
- getValueAsString() {
79
- return '';
80
- }
81
- parseURLParams() {
82
- this._urlParams = {};
83
- const params = new URLSearchParams(window.location.search);
84
- for (const [name, value] of params) {
85
- this._urlParams[name.toLowerCase()] = value;
86
- }
87
- }
88
- hasURLParam(name) {
89
- return name.toLowerCase() in this._urlParams;
90
- }
91
- getURLParam(name) {
92
- if (this.hasURLParam(name)) {
93
- return this._urlParams[name.toLowerCase()];
94
- }
95
- return '';
96
- }
97
- }
98
- exports.SettingBase = SettingBase;
1
+ "use strict";
2
+ // Copyright Epic Games, Inc. All Rights Reserved.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.SettingBase = void 0;
5
+ /**
6
+ * Base class for a setting that has a text label and an arbitrary setting value it stores.
7
+ */
8
+ class SettingBase {
9
+ constructor(id, label, description, defaultSettingValue,
10
+ // eslint-disable-next-line @typescript-eslint/no-empty-function
11
+ defaultOnChangeListener = () => {
12
+ /* Do nothing, to be overridden. */
13
+ }) {
14
+ this.parseURLParams();
15
+ this.onChange = defaultOnChangeListener;
16
+ this.onChangeEmit = () => {
17
+ /* Do nothing, to be overridden. */
18
+ };
19
+ this.id = id;
20
+ this.description = description;
21
+ this.label = label;
22
+ this.value = defaultSettingValue;
23
+ }
24
+ /**
25
+ * Set the label text for the setting.
26
+ * @param label setting label.
27
+ */
28
+ set label(inLabel) {
29
+ this._label = inLabel;
30
+ this.onChangeEmit(this._value);
31
+ }
32
+ /**
33
+ * @returns The label text for the setting.
34
+ */
35
+ get label() {
36
+ return this._label;
37
+ }
38
+ /**
39
+ * @return The setting's value.
40
+ */
41
+ get value() {
42
+ return this._value;
43
+ }
44
+ /**
45
+ * Update the setting's stored value.
46
+ * @param inValue The new value for the setting.
47
+ */
48
+ set value(inValue) {
49
+ this._value = inValue;
50
+ this.onChange(this._value, this);
51
+ this.onChangeEmit(this._value);
52
+ }
53
+ /**
54
+ * Persist the setting value in URL.
55
+ */
56
+ updateURLParams() {
57
+ if (this.useUrlParams) {
58
+ // set url params
59
+ const urlParams = new URLSearchParams(window.location.search);
60
+ const valueString = this.getValueAsString();
61
+ let set = false;
62
+ for (const [name, _value] of urlParams) {
63
+ if (name.toLowerCase() == this.id.toLowerCase()) {
64
+ urlParams.set(name, valueString);
65
+ set = true;
66
+ break;
67
+ }
68
+ }
69
+ if (!set) {
70
+ urlParams.set(this.id, valueString);
71
+ }
72
+ window.history.replaceState({}, '', urlParams.toString() !== '' ? `${location.pathname}?${urlParams}` : `${location.pathname}`);
73
+ }
74
+ }
75
+ /**
76
+ * Allows sub types to provide their value for the url search params.
77
+ */
78
+ getValueAsString() {
79
+ return '';
80
+ }
81
+ parseURLParams() {
82
+ this._urlParams = {};
83
+ const params = new URLSearchParams(window.location.search);
84
+ for (const [name, value] of params) {
85
+ this._urlParams[name.toLowerCase()] = value;
86
+ }
87
+ }
88
+ hasURLParam(name) {
89
+ return name.toLowerCase() in this._urlParams;
90
+ }
91
+ getURLParam(name) {
92
+ if (this.hasURLParam(name)) {
93
+ return this._urlParams[name.toLowerCase()];
94
+ }
95
+ return '';
96
+ }
97
+ }
98
+ exports.SettingBase = SettingBase;
99
99
  //# sourceMappingURL=SettingBase.js.map
@@ -1,50 +1,50 @@
1
- "use strict";
2
- // Copyright Epic Games, Inc. All Rights Reserved.
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.SettingFlag = void 0;
5
- const SettingBase_1 = require("./SettingBase");
6
- /**
7
- * A boolean flag setting object with a text label.
8
- */
9
- class SettingFlag extends SettingBase_1.SettingBase {
10
- constructor(id, label, description, defaultFlagValue, useUrlParams,
11
- // eslint-disable-next-line @typescript-eslint/no-empty-function
12
- defaultOnChangeListener = () => {
13
- /* Do nothing, to be overridden. */
14
- }) {
15
- super(id, label, description, defaultFlagValue, defaultOnChangeListener);
16
- if (!useUrlParams || !this.hasURLParam(this.id)) {
17
- this.flag = defaultFlagValue;
18
- }
19
- else {
20
- // parse flag from url parameters
21
- const urlParamFlag = this.getURLParam(this.id);
22
- this.flag = urlParamFlag.toLowerCase() != 'false';
23
- }
24
- this.useUrlParams = useUrlParams;
25
- }
26
- getValueAsString() {
27
- return this.flag ? 'true' : 'false';
28
- }
29
- /**
30
- * Enables this flag.
31
- */
32
- enable() {
33
- this.flag = true;
34
- }
35
- /**
36
- * @return The setting's value.
37
- */
38
- get flag() {
39
- return !!this.value;
40
- }
41
- /**
42
- * Update the setting's stored value.
43
- * @param inValue The new value for the setting.
44
- */
45
- set flag(inValue) {
46
- this.value = inValue;
47
- }
48
- }
49
- exports.SettingFlag = SettingFlag;
1
+ "use strict";
2
+ // Copyright Epic Games, Inc. All Rights Reserved.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.SettingFlag = void 0;
5
+ const SettingBase_1 = require("./SettingBase");
6
+ /**
7
+ * A boolean flag setting object with a text label.
8
+ */
9
+ class SettingFlag extends SettingBase_1.SettingBase {
10
+ constructor(id, label, description, defaultFlagValue, useUrlParams,
11
+ // eslint-disable-next-line @typescript-eslint/no-empty-function
12
+ defaultOnChangeListener = () => {
13
+ /* Do nothing, to be overridden. */
14
+ }) {
15
+ super(id, label, description, defaultFlagValue, defaultOnChangeListener);
16
+ if (!useUrlParams || !this.hasURLParam(this.id)) {
17
+ this.flag = defaultFlagValue;
18
+ }
19
+ else {
20
+ // parse flag from url parameters
21
+ const urlParamFlag = this.getURLParam(this.id);
22
+ this.flag = urlParamFlag.toLowerCase() != 'false';
23
+ }
24
+ this.useUrlParams = useUrlParams;
25
+ }
26
+ getValueAsString() {
27
+ return this.flag ? 'true' : 'false';
28
+ }
29
+ /**
30
+ * Enables this flag.
31
+ */
32
+ enable() {
33
+ this.flag = true;
34
+ }
35
+ /**
36
+ * @return The setting's value.
37
+ */
38
+ get flag() {
39
+ return !!this.value;
40
+ }
41
+ /**
42
+ * Update the setting's stored value.
43
+ * @param inValue The new value for the setting.
44
+ */
45
+ set flag(inValue) {
46
+ this.value = inValue;
47
+ }
48
+ }
49
+ exports.SettingFlag = SettingFlag;
50
50
  //# sourceMappingURL=SettingFlag.js.map
@@ -1,84 +1,84 @@
1
- "use strict";
2
- // Copyright Epic Games, Inc. All Rights Reserved.
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.SettingNumber = void 0;
5
- const SettingBase_1 = require("./SettingBase");
6
- /**
7
- * A number setting object with a text label. Min and max limit the range of allowed values.
8
- */
9
- class SettingNumber extends SettingBase_1.SettingBase {
10
- constructor(id, label, description, min, max, defaultNumber, useUrlParams,
11
- // eslint-disable-next-line @typescript-eslint/no-empty-function
12
- defaultOnChangeListener = () => {
13
- /* Do nothing, to be overridden. */
14
- }) {
15
- super(id, label, description, defaultNumber, defaultOnChangeListener);
16
- this._min = min;
17
- this._max = max;
18
- // attempt to read the number from the url params
19
- if (!useUrlParams || !this.hasURLParam(this.id)) {
20
- this.number = defaultNumber;
21
- }
22
- else {
23
- const parsedValue = Number.parseFloat(this.getURLParam(this.id));
24
- this.number = Number.isNaN(parsedValue) ? defaultNumber : parsedValue;
25
- }
26
- this.useUrlParams = useUrlParams;
27
- }
28
- getValueAsString() {
29
- return this.number.toString();
30
- }
31
- /**
32
- * Set the number value (will be clamped within range).
33
- */
34
- set number(newNumber) {
35
- this.value = this.clamp(newNumber);
36
- }
37
- /**
38
- * @returns The number stored.
39
- */
40
- get number() {
41
- return this.value;
42
- }
43
- /**
44
- * Clamps a number between the min and max values (inclusive).
45
- * @param inNumber The number to clamp.
46
- * @returns The clamped number.
47
- */
48
- clamp(inNumber) {
49
- if (this._min == null && this._max == null) {
50
- return inNumber;
51
- }
52
- else if (this._min == null) {
53
- return Math.min(this._max, inNumber);
54
- }
55
- else if (this._max == null) {
56
- return Math.max(this._min, inNumber);
57
- }
58
- else {
59
- return Math.max(Math.min(this._max, inNumber), this._min);
60
- }
61
- }
62
- /**
63
- * Returns the minimum value
64
- * @returns The minimum value
65
- */
66
- get min() {
67
- return this._min;
68
- }
69
- /**
70
- * Returns the maximum value
71
- * @returns The maximum value
72
- */
73
- get max() {
74
- return this._max;
75
- }
76
- /**
77
- * Add a change listener to the number object.
78
- */
79
- addOnChangedListener(onChangedFunc) {
80
- this.onChange = onChangedFunc;
81
- }
82
- }
83
- exports.SettingNumber = SettingNumber;
1
+ "use strict";
2
+ // Copyright Epic Games, Inc. All Rights Reserved.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.SettingNumber = void 0;
5
+ const SettingBase_1 = require("./SettingBase");
6
+ /**
7
+ * A number setting object with a text label. Min and max limit the range of allowed values.
8
+ */
9
+ class SettingNumber extends SettingBase_1.SettingBase {
10
+ constructor(id, label, description, min, max, defaultNumber, useUrlParams,
11
+ // eslint-disable-next-line @typescript-eslint/no-empty-function
12
+ defaultOnChangeListener = () => {
13
+ /* Do nothing, to be overridden. */
14
+ }) {
15
+ super(id, label, description, defaultNumber, defaultOnChangeListener);
16
+ this._min = min;
17
+ this._max = max;
18
+ // attempt to read the number from the url params
19
+ if (!useUrlParams || !this.hasURLParam(this.id)) {
20
+ this.number = defaultNumber;
21
+ }
22
+ else {
23
+ const parsedValue = Number.parseFloat(this.getURLParam(this.id));
24
+ this.number = Number.isNaN(parsedValue) ? defaultNumber : parsedValue;
25
+ }
26
+ this.useUrlParams = useUrlParams;
27
+ }
28
+ getValueAsString() {
29
+ return this.number.toString();
30
+ }
31
+ /**
32
+ * Set the number value (will be clamped within range).
33
+ */
34
+ set number(newNumber) {
35
+ this.value = this.clamp(newNumber);
36
+ }
37
+ /**
38
+ * @returns The number stored.
39
+ */
40
+ get number() {
41
+ return this.value;
42
+ }
43
+ /**
44
+ * Clamps a number between the min and max values (inclusive).
45
+ * @param inNumber The number to clamp.
46
+ * @returns The clamped number.
47
+ */
48
+ clamp(inNumber) {
49
+ if (this._min == null && this._max == null) {
50
+ return inNumber;
51
+ }
52
+ else if (this._min == null) {
53
+ return Math.min(this._max, inNumber);
54
+ }
55
+ else if (this._max == null) {
56
+ return Math.max(this._min, inNumber);
57
+ }
58
+ else {
59
+ return Math.max(Math.min(this._max, inNumber), this._min);
60
+ }
61
+ }
62
+ /**
63
+ * Returns the minimum value
64
+ * @returns The minimum value
65
+ */
66
+ get min() {
67
+ return this._min;
68
+ }
69
+ /**
70
+ * Returns the maximum value
71
+ * @returns The maximum value
72
+ */
73
+ get max() {
74
+ return this._max;
75
+ }
76
+ /**
77
+ * Add a change listener to the number object.
78
+ */
79
+ addOnChangedListener(onChangedFunc) {
80
+ this.onChange = onChangedFunc;
81
+ }
82
+ }
83
+ exports.SettingNumber = SettingNumber;
84
84
  //# sourceMappingURL=SettingNumber.js.map
@@ -1,85 +1,85 @@
1
- "use strict";
2
- // Copyright Epic Games, Inc. All Rights Reserved.
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.SettingOption = void 0;
5
- const lib_pixelstreamingcommon_ue5_5_1 = require("@epicgames-ps/lib-pixelstreamingcommon-ue5.5");
6
- const SettingBase_1 = require("./SettingBase");
7
- /**
8
- * An Option setting object with a text label. Allows you to specify an array of options and select one of them.
9
- */
10
- class SettingOption extends SettingBase_1.SettingBase {
11
- constructor(id, label, description, defaultTextValue, options, useUrlParams,
12
- // eslint-disable-next-line @typescript-eslint/no-empty-function
13
- defaultUrlParamResolver = function (value) {
14
- /* Return the string as-is by default */
15
- return value;
16
- },
17
- // eslint-disable-next-line @typescript-eslint/no-empty-function
18
- defaultOnChangeListener = () => {
19
- /* Do nothing, to be overridden. */
20
- }) {
21
- super(id, label, description, defaultTextValue, defaultOnChangeListener);
22
- this._urlParamResolver = defaultUrlParamResolver;
23
- const stringToMatch = this.hasURLParam(this.id)
24
- ? this._urlParamResolver(this.getURLParam(this.id))
25
- : defaultTextValue;
26
- this.options = options !== null && options !== void 0 ? options : [stringToMatch];
27
- this.selected = stringToMatch;
28
- this.useUrlParams = useUrlParams;
29
- }
30
- getValueAsString() {
31
- return this.selected;
32
- }
33
- /**
34
- * Add a change listener to the select element.
35
- */
36
- addOnChangedListener(onChangedFunc) {
37
- this.onChange = onChangedFunc;
38
- }
39
- /**
40
- * @returns All available options as an array
41
- */
42
- get options() {
43
- return this._options;
44
- }
45
- /**
46
- * Set options
47
- * @param values Array of options
48
- */
49
- set options(values) {
50
- this._options = values;
51
- this.onChangeEmit(this.selected);
52
- }
53
- /**
54
- * @returns Selected option as a string
55
- */
56
- get selected() {
57
- return this.value;
58
- }
59
- /**
60
- * Set selected option if it matches one of the available options
61
- * @param value Selected option
62
- */
63
- set selected(value) {
64
- if (value === undefined) {
65
- return;
66
- }
67
- // If options contains the value, then set that as selected
68
- if (this.options.includes(value)) {
69
- this.value = value;
70
- }
71
- else {
72
- lib_pixelstreamingcommon_ue5_5_1.Logger.Error(`Could not set "${value}" as the selected option for ${this.id} because it wasn't one of the options.`);
73
- }
74
- }
75
- /**
76
- * Set the url parameter resolver to do some transformation to the string value
77
- * that is extracted from the url parameters.
78
- * @param urlParam A function that transforms the extracted url parameter string for this setting to something else.
79
- */
80
- set urlParamResolver(value) {
81
- this._urlParamResolver = value;
82
- }
83
- }
84
- exports.SettingOption = SettingOption;
1
+ "use strict";
2
+ // Copyright Epic Games, Inc. All Rights Reserved.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.SettingOption = void 0;
5
+ const lib_pixelstreamingcommon_ue5_5_1 = require("@epicgames-ps/lib-pixelstreamingcommon-ue5.5");
6
+ const SettingBase_1 = require("./SettingBase");
7
+ /**
8
+ * An Option setting object with a text label. Allows you to specify an array of options and select one of them.
9
+ */
10
+ class SettingOption extends SettingBase_1.SettingBase {
11
+ constructor(id, label, description, defaultTextValue, options, useUrlParams,
12
+ // eslint-disable-next-line @typescript-eslint/no-empty-function
13
+ defaultUrlParamResolver = function (value) {
14
+ /* Return the string as-is by default */
15
+ return value;
16
+ },
17
+ // eslint-disable-next-line @typescript-eslint/no-empty-function
18
+ defaultOnChangeListener = () => {
19
+ /* Do nothing, to be overridden. */
20
+ }) {
21
+ super(id, label, description, defaultTextValue, defaultOnChangeListener);
22
+ this._urlParamResolver = defaultUrlParamResolver;
23
+ const stringToMatch = this.hasURLParam(this.id)
24
+ ? this._urlParamResolver(this.getURLParam(this.id))
25
+ : defaultTextValue;
26
+ this.options = options !== null && options !== void 0 ? options : [stringToMatch];
27
+ this.selected = stringToMatch;
28
+ this.useUrlParams = useUrlParams;
29
+ }
30
+ getValueAsString() {
31
+ return this.selected;
32
+ }
33
+ /**
34
+ * Add a change listener to the select element.
35
+ */
36
+ addOnChangedListener(onChangedFunc) {
37
+ this.onChange = onChangedFunc;
38
+ }
39
+ /**
40
+ * @returns All available options as an array
41
+ */
42
+ get options() {
43
+ return this._options;
44
+ }
45
+ /**
46
+ * Set options
47
+ * @param values Array of options
48
+ */
49
+ set options(values) {
50
+ this._options = values;
51
+ this.onChangeEmit(this.selected);
52
+ }
53
+ /**
54
+ * @returns Selected option as a string
55
+ */
56
+ get selected() {
57
+ return this.value;
58
+ }
59
+ /**
60
+ * Set selected option if it matches one of the available options
61
+ * @param value Selected option
62
+ */
63
+ set selected(value) {
64
+ if (value === undefined) {
65
+ return;
66
+ }
67
+ // If options contains the value, then set that as selected
68
+ if (this.options.includes(value)) {
69
+ this.value = value;
70
+ }
71
+ else {
72
+ lib_pixelstreamingcommon_ue5_5_1.Logger.Error(`Could not set "${value}" as the selected option for ${this.id} because it wasn't one of the options.`);
73
+ }
74
+ }
75
+ /**
76
+ * Set the url parameter resolver to do some transformation to the string value
77
+ * that is extracted from the url parameters.
78
+ * @param urlParam A function that transforms the extracted url parameter string for this setting to something else.
79
+ */
80
+ set urlParamResolver(value) {
81
+ this._urlParamResolver = value;
82
+ }
83
+ }
84
+ exports.SettingOption = SettingOption;
85
85
  //# sourceMappingURL=SettingOption.js.map