@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,39 +1,39 @@
1
- // Copyright Epic Games, Inc. All Rights Reserved.
2
- import { SettingBase } from './SettingBase';
3
- /**
4
- * A text setting object with a text label.
5
- */
6
- export class SettingText extends SettingBase {
7
- constructor(id, label, description, defaultTextValue, useUrlParams,
8
- // eslint-disable-next-line @typescript-eslint/no-empty-function
9
- defaultOnChangeListener = () => {
10
- /* Do nothing, to be overridden. */
11
- }) {
12
- super(id, label, description, defaultTextValue, defaultOnChangeListener);
13
- if (!useUrlParams || !this.hasURLParam(this.id)) {
14
- this.text = defaultTextValue;
15
- }
16
- else {
17
- // parse flag from url parameters
18
- this.text = this.getURLParam(this.id);
19
- }
20
- this.useUrlParams = useUrlParams;
21
- }
22
- getValueAsString() {
23
- return this.text;
24
- }
25
- /**
26
- * @return The setting's value.
27
- */
28
- get text() {
29
- return this.value;
30
- }
31
- /**
32
- * Update the setting's stored value.
33
- * @param inValue The new value for the setting.
34
- */
35
- set text(inValue) {
36
- this.value = inValue;
37
- }
38
- }
1
+ // Copyright Epic Games, Inc. All Rights Reserved.
2
+ import { SettingBase } from './SettingBase';
3
+ /**
4
+ * A text setting object with a text label.
5
+ */
6
+ export class SettingText extends SettingBase {
7
+ constructor(id, label, description, defaultTextValue, useUrlParams,
8
+ // eslint-disable-next-line @typescript-eslint/no-empty-function
9
+ defaultOnChangeListener = () => {
10
+ /* Do nothing, to be overridden. */
11
+ }) {
12
+ super(id, label, description, defaultTextValue, defaultOnChangeListener);
13
+ if (!useUrlParams || !this.hasURLParam(this.id)) {
14
+ this.text = defaultTextValue;
15
+ }
16
+ else {
17
+ // parse flag from url parameters
18
+ this.text = this.getURLParam(this.id);
19
+ }
20
+ this.useUrlParams = useUrlParams;
21
+ }
22
+ getValueAsString() {
23
+ return this.text;
24
+ }
25
+ /**
26
+ * @return The setting's value.
27
+ */
28
+ get text() {
29
+ return this.value;
30
+ }
31
+ /**
32
+ * Update the setting's stored value.
33
+ * @param inValue The new value for the setting.
34
+ */
35
+ set text(inValue) {
36
+ this.value = inValue;
37
+ }
38
+ }
39
39
  //# sourceMappingURL=SettingText.js.map
@@ -1,103 +1,103 @@
1
- // Copyright Epic Games, Inc. All Rights Reserved.
2
- import { Logger } from '@epicgames-ps/lib-pixelstreamingcommon-ue5.5';
3
- /**
4
- * Handles the Sending and Receiving of messages to the UE Instance via the Data Channel
5
- */
6
- export class DataChannelController {
7
- constructor() {
8
- this.isReceivingFreezeFrame = false;
9
- }
10
- /**
11
- * return the current state of a datachannel controller instance
12
- * @returns the current DataChannelController instance
13
- */
14
- getDataChannelInstance() {
15
- return this;
16
- }
17
- /**
18
- * To Create and Set up a Data Channel
19
- * @param peerConnection - The RTC Peer Connection
20
- * @param label - Label of the Data Channel
21
- * @param datachannelOptions - Optional RTC DataChannel options
22
- */
23
- createDataChannel(peerConnection, label, datachannelOptions) {
24
- this.peerConnection = peerConnection;
25
- this.label = label;
26
- this.datachannelOptions = datachannelOptions;
27
- if (datachannelOptions == null) {
28
- this.datachannelOptions = {};
29
- this.datachannelOptions.ordered = true;
30
- }
31
- this.dataChannel = this.peerConnection.createDataChannel(this.label, this.datachannelOptions);
32
- this.setupDataChannel();
33
- }
34
- setupDataChannel() {
35
- //We Want an Array Buffer not a blob
36
- this.dataChannel.binaryType = 'arraybuffer';
37
- this.dataChannel.onopen = (ev) => this.handleOnOpen(ev);
38
- this.dataChannel.onclose = (ev) => this.handleOnClose(ev);
39
- this.dataChannel.onmessage = (ev) => this.handleOnMessage(ev);
40
- this.dataChannel.onerror = (ev) => this.handleOnError(ev);
41
- }
42
- /**
43
- * Handles when the Data Channel is opened
44
- */
45
- handleOnOpen(ev) {
46
- var _a;
47
- Logger.Info(`Data Channel (${this.label}) opened.`);
48
- this.onOpen((_a = this.dataChannel) === null || _a === void 0 ? void 0 : _a.label, ev);
49
- }
50
- /**
51
- * Handles when the Data Channel is closed
52
- */
53
- handleOnClose(ev) {
54
- var _a;
55
- Logger.Info(`Data Channel (${this.label}) closed.`);
56
- this.onClose((_a = this.dataChannel) === null || _a === void 0 ? void 0 : _a.label, ev);
57
- }
58
- /**
59
- * Handles when a message is received
60
- * @param event - Message Event
61
- */
62
- handleOnMessage(event) {
63
- // Higher log level to prevent log spam with messages received
64
- Logger.Info(`Data Channel (${this.label}) message: ${event}`);
65
- }
66
- /**
67
- * Handles when an error is thrown
68
- * @param event - Error Event
69
- */
70
- handleOnError(event) {
71
- var _a;
72
- Logger.Info(`Data Channel (${this.label}) error: ${event}`);
73
- this.onError((_a = this.dataChannel) === null || _a === void 0 ? void 0 : _a.label, event);
74
- }
75
- /**
76
- * Override to register onOpen handler
77
- * @param label Data channel label ("datachannel", "send-datachannel", "recv-datachannel")
78
- * @param ev event
79
- */
80
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
81
- onOpen(label, ev) {
82
- // empty default implementation
83
- }
84
- /**
85
- * Override to register onClose handler
86
- * @param label Data channel label ("datachannel", "send-datachannel", "recv-datachannel")
87
- * @param ev event
88
- */
89
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
90
- onClose(label, ev) {
91
- // empty default implementation
92
- }
93
- /**
94
- * Override to register onError handler
95
- * @param label Data channel label ("datachannel", "send-datachannel", "recv-datachannel")
96
- * @param ev event
97
- */
98
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
99
- onError(label, ev) {
100
- // empty default implementation
101
- }
102
- }
1
+ // Copyright Epic Games, Inc. All Rights Reserved.
2
+ import { Logger } from '@epicgames-ps/lib-pixelstreamingcommon-ue5.5';
3
+ /**
4
+ * Handles the Sending and Receiving of messages to the UE Instance via the Data Channel
5
+ */
6
+ export class DataChannelController {
7
+ constructor() {
8
+ this.isReceivingFreezeFrame = false;
9
+ }
10
+ /**
11
+ * return the current state of a datachannel controller instance
12
+ * @returns the current DataChannelController instance
13
+ */
14
+ getDataChannelInstance() {
15
+ return this;
16
+ }
17
+ /**
18
+ * To Create and Set up a Data Channel
19
+ * @param peerConnection - The RTC Peer Connection
20
+ * @param label - Label of the Data Channel
21
+ * @param datachannelOptions - Optional RTC DataChannel options
22
+ */
23
+ createDataChannel(peerConnection, label, datachannelOptions) {
24
+ this.peerConnection = peerConnection;
25
+ this.label = label;
26
+ this.datachannelOptions = datachannelOptions;
27
+ if (datachannelOptions == null) {
28
+ this.datachannelOptions = {};
29
+ this.datachannelOptions.ordered = true;
30
+ }
31
+ this.dataChannel = this.peerConnection.createDataChannel(this.label, this.datachannelOptions);
32
+ this.setupDataChannel();
33
+ }
34
+ setupDataChannel() {
35
+ //We Want an Array Buffer not a blob
36
+ this.dataChannel.binaryType = 'arraybuffer';
37
+ this.dataChannel.onopen = (ev) => this.handleOnOpen(ev);
38
+ this.dataChannel.onclose = (ev) => this.handleOnClose(ev);
39
+ this.dataChannel.onmessage = (ev) => this.handleOnMessage(ev);
40
+ this.dataChannel.onerror = (ev) => this.handleOnError(ev);
41
+ }
42
+ /**
43
+ * Handles when the Data Channel is opened
44
+ */
45
+ handleOnOpen(ev) {
46
+ var _a;
47
+ Logger.Info(`Data Channel (${this.label}) opened.`);
48
+ this.onOpen((_a = this.dataChannel) === null || _a === void 0 ? void 0 : _a.label, ev);
49
+ }
50
+ /**
51
+ * Handles when the Data Channel is closed
52
+ */
53
+ handleOnClose(ev) {
54
+ var _a;
55
+ Logger.Info(`Data Channel (${this.label}) closed.`);
56
+ this.onClose((_a = this.dataChannel) === null || _a === void 0 ? void 0 : _a.label, ev);
57
+ }
58
+ /**
59
+ * Handles when a message is received
60
+ * @param event - Message Event
61
+ */
62
+ handleOnMessage(event) {
63
+ // Higher log level to prevent log spam with messages received
64
+ Logger.Info(`Data Channel (${this.label}) message: ${event}`);
65
+ }
66
+ /**
67
+ * Handles when an error is thrown
68
+ * @param event - Error Event
69
+ */
70
+ handleOnError(event) {
71
+ var _a;
72
+ Logger.Info(`Data Channel (${this.label}) error: ${event}`);
73
+ this.onError((_a = this.dataChannel) === null || _a === void 0 ? void 0 : _a.label, event);
74
+ }
75
+ /**
76
+ * Override to register onOpen handler
77
+ * @param label Data channel label ("datachannel", "send-datachannel", "recv-datachannel")
78
+ * @param ev event
79
+ */
80
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
81
+ onOpen(label, ev) {
82
+ // empty default implementation
83
+ }
84
+ /**
85
+ * Override to register onClose handler
86
+ * @param label Data channel label ("datachannel", "send-datachannel", "recv-datachannel")
87
+ * @param ev event
88
+ */
89
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
90
+ onClose(label, ev) {
91
+ // empty default implementation
92
+ }
93
+ /**
94
+ * Override to register onError handler
95
+ * @param label Data channel label ("datachannel", "send-datachannel", "recv-datachannel")
96
+ * @param ev event
97
+ */
98
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
99
+ onError(label, ev) {
100
+ // empty default implementation
101
+ }
102
+ }
103
103
  //# sourceMappingURL=DataChannelController.js.map
@@ -1,91 +1,91 @@
1
- // Copyright Epic Games, Inc. All Rights Reserved.
2
- import { Logger } from '@epicgames-ps/lib-pixelstreamingcommon-ue5.5';
3
- import { DataChannelLatencyTestRecord } from './DataChannelLatencyTestResults';
4
- export class DataChannelLatencyTestController {
5
- constructor(sink, callback) {
6
- this.intervalHandle = undefined;
7
- this.sink = sink;
8
- this.callback = callback;
9
- this.records = new Map();
10
- this.seq = 0;
11
- }
12
- start(config) {
13
- if (this.isRunning()) {
14
- return false;
15
- }
16
- this.startTime = Date.now();
17
- this.records.clear();
18
- this.intervalHandle = window.setInterval((() => {
19
- if (Date.now() - this.startTime >= config.duration) {
20
- this.stop();
21
- }
22
- else {
23
- this.sendRequest(config.requestSize, config.responseSize);
24
- }
25
- }).bind(this), Math.floor(1000 / config.rps));
26
- return true;
27
- }
28
- stop() {
29
- if (this.intervalHandle) {
30
- window.clearInterval(this.intervalHandle);
31
- this.intervalHandle = undefined;
32
- this.callback(this.produceResult());
33
- }
34
- }
35
- produceResult() {
36
- const resultRecords = new Map(this.records);
37
- return {
38
- records: resultRecords,
39
- dataChannelRtt: Math.ceil(Array.from(this.records.values()).reduce((acc, next) => {
40
- return acc + (next.playerReceivedTimestamp - next.playerSentTimestamp);
41
- }, 0) / this.records.size),
42
- playerToStreamerTime: Math.ceil(Array.from(this.records.values()).reduce((acc, next) => {
43
- return acc + (next.streamerReceivedTimestamp - next.playerSentTimestamp);
44
- }, 0) / this.records.size),
45
- streamerToPlayerTime: Math.ceil(Array.from(this.records.values()).reduce((acc, next) => {
46
- return acc + (next.playerReceivedTimestamp - next.streamerSentTimestamp);
47
- }, 0) / this.records.size),
48
- exportLatencyAsCSV: () => {
49
- let csv = 'Timestamp;RTT;PlayerToStreamer;StreamerToPlayer;\n';
50
- resultRecords.forEach((record) => {
51
- csv += record.playerSentTimestamp + ';';
52
- csv += record.playerReceivedTimestamp - record.playerSentTimestamp + ';';
53
- csv += record.streamerReceivedTimestamp - record.playerSentTimestamp + ';';
54
- csv += record.playerReceivedTimestamp - record.streamerSentTimestamp + ';';
55
- csv += '\n';
56
- });
57
- return csv;
58
- }
59
- };
60
- }
61
- isRunning() {
62
- return !!this.intervalHandle;
63
- }
64
- receive(response) {
65
- if (!this.isRunning()) {
66
- return;
67
- }
68
- if (!response) {
69
- Logger.Error('Undefined response from server');
70
- return;
71
- }
72
- const record = this.records.get(response.Seq);
73
- if (record) {
74
- record.update(response);
75
- }
76
- }
77
- sendRequest(requestSize, responseSize) {
78
- const request = this.createRequest(requestSize, responseSize);
79
- const record = new DataChannelLatencyTestRecord(request);
80
- this.records.set(record.seq, record);
81
- this.sink(request);
82
- }
83
- createRequest(requestSize, responseSize) {
84
- return {
85
- Seq: this.seq++,
86
- FillResponseSize: responseSize,
87
- Filler: requestSize ? 'A'.repeat(requestSize) : ''
88
- };
89
- }
90
- }
1
+ // Copyright Epic Games, Inc. All Rights Reserved.
2
+ import { Logger } from '@epicgames-ps/lib-pixelstreamingcommon-ue5.5';
3
+ import { DataChannelLatencyTestRecord } from './DataChannelLatencyTestResults';
4
+ export class DataChannelLatencyTestController {
5
+ constructor(sink, callback) {
6
+ this.intervalHandle = undefined;
7
+ this.sink = sink;
8
+ this.callback = callback;
9
+ this.records = new Map();
10
+ this.seq = 0;
11
+ }
12
+ start(config) {
13
+ if (this.isRunning()) {
14
+ return false;
15
+ }
16
+ this.startTime = Date.now();
17
+ this.records.clear();
18
+ this.intervalHandle = window.setInterval((() => {
19
+ if (Date.now() - this.startTime >= config.duration) {
20
+ this.stop();
21
+ }
22
+ else {
23
+ this.sendRequest(config.requestSize, config.responseSize);
24
+ }
25
+ }).bind(this), Math.floor(1000 / config.rps));
26
+ return true;
27
+ }
28
+ stop() {
29
+ if (this.intervalHandle) {
30
+ window.clearInterval(this.intervalHandle);
31
+ this.intervalHandle = undefined;
32
+ this.callback(this.produceResult());
33
+ }
34
+ }
35
+ produceResult() {
36
+ const resultRecords = new Map(this.records);
37
+ return {
38
+ records: resultRecords,
39
+ dataChannelRtt: Math.ceil(Array.from(this.records.values()).reduce((acc, next) => {
40
+ return acc + (next.playerReceivedTimestamp - next.playerSentTimestamp);
41
+ }, 0) / this.records.size),
42
+ playerToStreamerTime: Math.ceil(Array.from(this.records.values()).reduce((acc, next) => {
43
+ return acc + (next.streamerReceivedTimestamp - next.playerSentTimestamp);
44
+ }, 0) / this.records.size),
45
+ streamerToPlayerTime: Math.ceil(Array.from(this.records.values()).reduce((acc, next) => {
46
+ return acc + (next.playerReceivedTimestamp - next.streamerSentTimestamp);
47
+ }, 0) / this.records.size),
48
+ exportLatencyAsCSV: () => {
49
+ let csv = 'Timestamp;RTT;PlayerToStreamer;StreamerToPlayer;\n';
50
+ resultRecords.forEach((record) => {
51
+ csv += record.playerSentTimestamp + ';';
52
+ csv += record.playerReceivedTimestamp - record.playerSentTimestamp + ';';
53
+ csv += record.streamerReceivedTimestamp - record.playerSentTimestamp + ';';
54
+ csv += record.playerReceivedTimestamp - record.streamerSentTimestamp + ';';
55
+ csv += '\n';
56
+ });
57
+ return csv;
58
+ }
59
+ };
60
+ }
61
+ isRunning() {
62
+ return !!this.intervalHandle;
63
+ }
64
+ receive(response) {
65
+ if (!this.isRunning()) {
66
+ return;
67
+ }
68
+ if (!response) {
69
+ Logger.Error('Undefined response from server');
70
+ return;
71
+ }
72
+ const record = this.records.get(response.Seq);
73
+ if (record) {
74
+ record.update(response);
75
+ }
76
+ }
77
+ sendRequest(requestSize, responseSize) {
78
+ const request = this.createRequest(requestSize, responseSize);
79
+ const record = new DataChannelLatencyTestRecord(request);
80
+ this.records.set(record.seq, record);
81
+ this.sink(request);
82
+ }
83
+ createRequest(requestSize, responseSize) {
84
+ return {
85
+ Seq: this.seq++,
86
+ FillResponseSize: responseSize,
87
+ Filler: requestSize ? 'A'.repeat(requestSize) : ''
88
+ };
89
+ }
90
+ }
91
91
  //# sourceMappingURL=DataChannelLatencyTestController.js.map
@@ -1,15 +1,15 @@
1
- // Copyright Epic Games, Inc. All Rights Reserved.
2
- export class DataChannelLatencyTestRecord {
3
- constructor(request) {
4
- this.seq = request.Seq;
5
- this.playerSentTimestamp = Date.now();
6
- this.requestFillerSize = request.Filler ? request.Filler.length : 0;
7
- }
8
- update(response) {
9
- this.playerReceivedTimestamp = Date.now();
10
- this.streamerReceivedTimestamp = response.ReceivedTimestamp;
11
- this.streamerSentTimestamp = response.SentTimestamp;
12
- this.responseFillerSize = response.Filler ? response.Filler.length : 0;
13
- }
14
- }
1
+ // Copyright Epic Games, Inc. All Rights Reserved.
2
+ export class DataChannelLatencyTestRecord {
3
+ constructor(request) {
4
+ this.seq = request.Seq;
5
+ this.playerSentTimestamp = Date.now();
6
+ this.requestFillerSize = request.Filler ? request.Filler.length : 0;
7
+ }
8
+ update(response) {
9
+ this.playerReceivedTimestamp = Date.now();
10
+ this.streamerReceivedTimestamp = response.ReceivedTimestamp;
11
+ this.streamerSentTimestamp = response.SentTimestamp;
12
+ this.responseFillerSize = response.Filler ? response.Filler.length : 0;
13
+ }
14
+ }
15
15
  //# sourceMappingURL=DataChannelLatencyTestResults.js.map
@@ -1,40 +1,40 @@
1
- // Copyright Epic Games, Inc. All Rights Reserved.
2
- import { Logger } from '@epicgames-ps/lib-pixelstreamingcommon-ue5.5';
3
- /**
4
- * A class for sending data channel messages
5
- */
6
- export class DataChannelSender {
7
- /**
8
- * @param dataChannelProvider - Data channel object type
9
- */
10
- constructor(dataChannelProvider) {
11
- this.dataChannelProvider = dataChannelProvider;
12
- }
13
- canSend() {
14
- return (this.dataChannelProvider.getDataChannelInstance().dataChannel !== undefined &&
15
- this.dataChannelProvider.getDataChannelInstance().dataChannel.readyState == 'open');
16
- }
17
- /**
18
- * Send Data over the Data channel to the UE Instance
19
- * @param data - Message Data Array Buffer
20
- */
21
- sendData(data) {
22
- // reset the afk inactivity
23
- const dataChannelInstance = this.dataChannelProvider.getDataChannelInstance();
24
- if (dataChannelInstance.dataChannel.readyState == 'open') {
25
- dataChannelInstance.dataChannel.send(data);
26
- Logger.Info(`Message Sent: ${new Uint8Array(data)}`);
27
- this.resetAfkWarningTimerOnDataSend();
28
- }
29
- else {
30
- Logger.Error(`Message Failed: ${new Uint8Array(data)}`);
31
- }
32
- }
33
- /**
34
- * An override method for resetting the Afk warning timer when data is sent over the data channel
35
- */
36
- resetAfkWarningTimerOnDataSend() {
37
- // Base Functionality: Do Nothing
38
- }
39
- }
1
+ // Copyright Epic Games, Inc. All Rights Reserved.
2
+ import { Logger } from '@epicgames-ps/lib-pixelstreamingcommon-ue5.5';
3
+ /**
4
+ * A class for sending data channel messages
5
+ */
6
+ export class DataChannelSender {
7
+ /**
8
+ * @param dataChannelProvider - Data channel object type
9
+ */
10
+ constructor(dataChannelProvider) {
11
+ this.dataChannelProvider = dataChannelProvider;
12
+ }
13
+ canSend() {
14
+ return (this.dataChannelProvider.getDataChannelInstance().dataChannel !== undefined &&
15
+ this.dataChannelProvider.getDataChannelInstance().dataChannel.readyState == 'open');
16
+ }
17
+ /**
18
+ * Send Data over the Data channel to the UE Instance
19
+ * @param data - Message Data Array Buffer
20
+ */
21
+ sendData(data) {
22
+ // reset the afk inactivity
23
+ const dataChannelInstance = this.dataChannelProvider.getDataChannelInstance();
24
+ if (dataChannelInstance.dataChannel.readyState == 'open') {
25
+ dataChannelInstance.dataChannel.send(data);
26
+ Logger.Info(`Message Sent: ${new Uint8Array(data)}`);
27
+ this.resetAfkWarningTimerOnDataSend();
28
+ }
29
+ else {
30
+ Logger.Error(`Message Failed: ${new Uint8Array(data)}`);
31
+ }
32
+ }
33
+ /**
34
+ * An override method for resetting the Afk warning timer when data is sent over the data channel
35
+ */
36
+ resetAfkWarningTimerOnDataSend() {
37
+ // Base Functionality: Do Nothing
38
+ }
39
+ }
40
40
  //# sourceMappingURL=DataChannelSender.js.map
@@ -1,35 +1,35 @@
1
- // Copyright Epic Games, Inc. All Rights Reserved.
2
- /**
3
- * Latency Test Results Data
4
- */
5
- export class InitialSettings {
6
- constructor() {
7
- this.PixelStreamingSettings = new PixelStreamingSettings();
8
- this.EncoderSettings = new EncoderSettings();
9
- this.WebRTCSettings = new WebRTCSettings();
10
- }
11
- /**
12
- * Checks for compatibility with the FPS and MaxFPS stats between 4.27 and 5
13
- */
14
- ueCompatible() {
15
- if (this.WebRTCSettings.MaxFPS != null) {
16
- this.WebRTCSettings.FPS = this.WebRTCSettings.MaxFPS;
17
- }
18
- }
19
- }
20
- /**
21
- * A class for handling Pixel Streaming details
22
- */
23
- export class PixelStreamingSettings {
24
- }
25
- /**
26
- * A class for handling encoder stats
27
- */
28
- export class EncoderSettings {
29
- }
30
- /**
31
- * A class for handling web rtc stats
32
- */
33
- export class WebRTCSettings {
34
- }
1
+ // Copyright Epic Games, Inc. All Rights Reserved.
2
+ /**
3
+ * Latency Test Results Data
4
+ */
5
+ export class InitialSettings {
6
+ constructor() {
7
+ this.PixelStreamingSettings = new PixelStreamingSettings();
8
+ this.EncoderSettings = new EncoderSettings();
9
+ this.WebRTCSettings = new WebRTCSettings();
10
+ }
11
+ /**
12
+ * Checks for compatibility with the FPS and MaxFPS stats between 4.27 and 5
13
+ */
14
+ ueCompatible() {
15
+ if (this.WebRTCSettings.MaxFPS != null) {
16
+ this.WebRTCSettings.FPS = this.WebRTCSettings.MaxFPS;
17
+ }
18
+ }
19
+ }
20
+ /**
21
+ * A class for handling Pixel Streaming details
22
+ */
23
+ export class PixelStreamingSettings {
24
+ }
25
+ /**
26
+ * A class for handling encoder stats
27
+ */
28
+ export class EncoderSettings {
29
+ }
30
+ /**
31
+ * A class for handling web rtc stats
32
+ */
33
+ export class WebRTCSettings {
34
+ }
35
35
  //# sourceMappingURL=InitialSettings.js.map