@epicgames-ps/lib-pixelstreamingfrontend-ue5.5 0.1.3 → 0.2.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 (94) hide show
  1. package/.eslintrc.js +1 -1
  2. package/.prettierrc.json +1 -0
  3. package/dist/lib-pixelstreamingfrontend.esm.js +1 -1
  4. package/dist/lib-pixelstreamingfrontend.js +1 -1
  5. package/package.json +6 -5
  6. package/src/AFK/AFKController.ts +10 -32
  7. package/src/Config/Config.ts +179 -201
  8. package/src/Config/SettingBase.ts +61 -2
  9. package/src/Config/SettingFlag.ts +10 -48
  10. package/src/Config/SettingNumber.ts +10 -28
  11. package/src/Config/SettingOption.ts +13 -46
  12. package/src/Config/SettingText.ts +9 -37
  13. package/src/DataChannel/DataChannelController.ts +6 -26
  14. package/src/DataChannel/DataChannelLatencyTestController.ts +38 -33
  15. package/src/DataChannel/DataChannelLatencyTestResults.ts +8 -10
  16. package/src/DataChannel/DataChannelSender.ts +5 -15
  17. package/src/DataChannel/LatencyTestResults.ts +5 -15
  18. package/src/FreezeFrame/FreezeFrame.ts +7 -19
  19. package/src/FreezeFrame/FreezeFrameController.ts +3 -14
  20. package/src/Inputs/GamepadController.ts +123 -221
  21. package/src/Inputs/GamepadTypes.ts +23 -0
  22. package/src/Inputs/IInputController.ts +17 -0
  23. package/src/Inputs/InputClassesFactory.ts +38 -45
  24. package/src/Inputs/KeyCodes.ts +114 -0
  25. package/src/Inputs/KeyboardController.ts +49 -232
  26. package/src/Inputs/MouseController.ts +71 -297
  27. package/src/Inputs/MouseControllerHovering.ts +118 -0
  28. package/src/Inputs/MouseControllerLocked.ts +194 -0
  29. package/src/Inputs/TouchController.ts +49 -105
  30. package/src/Inputs/TouchControllerFake.ts +132 -0
  31. package/src/Inputs/XRGamepadController.ts +35 -44
  32. package/src/PeerConnectionController/AggregatedStats.ts +26 -54
  33. package/src/PeerConnectionController/CandidatePairStats.ts +1 -1
  34. package/src/PeerConnectionController/CandidateStat.ts +1 -1
  35. package/src/PeerConnectionController/PeerConnectionController.ts +217 -164
  36. package/src/PixelStreaming/PixelStreaming.ts +174 -226
  37. package/src/UI/OnScreenKeyboard.ts +14 -9
  38. package/src/UeInstanceMessage/ResponseController.ts +6 -15
  39. package/src/UeInstanceMessage/SendMessageController.ts +16 -18
  40. package/src/UeInstanceMessage/StreamMessageController.ts +3 -12
  41. package/src/UeInstanceMessage/ToStreamerMessagesController.ts +3 -9
  42. package/src/Util/EventEmitter.ts +17 -22
  43. package/src/Util/FileUtil.ts +11 -34
  44. package/src/Util/IURLSearchParams.ts +25 -0
  45. package/src/Util/InputCoordTranslator.ts +73 -0
  46. package/src/Util/RTCUtils.ts +23 -15
  47. package/src/VideoPlayer/StreamController.ts +6 -23
  48. package/src/VideoPlayer/VideoPlayer.ts +9 -30
  49. package/src/WebRtcPlayer/WebRtcPlayerController.ts +328 -690
  50. package/src/WebXR/WebXRController.ts +82 -94
  51. package/src/pixelstreamingfrontend.ts +6 -10
  52. package/types/AFK/AFKController.d.ts +0 -1
  53. package/types/Config/Config.d.ts +6 -5
  54. package/types/Config/SettingBase.d.ts +13 -0
  55. package/types/Config/SettingFlag.d.ts +1 -10
  56. package/types/Config/SettingNumber.d.ts +1 -5
  57. package/types/Config/SettingOption.d.ts +1 -10
  58. package/types/Config/SettingText.d.ts +1 -9
  59. package/types/DataChannel/DataChannelLatencyTestController.d.ts +1 -1
  60. package/types/Inputs/GamepadController.d.ts +22 -46
  61. package/types/Inputs/GamepadTypes.d.ts +7 -0
  62. package/types/Inputs/IInputController.d.ts +16 -0
  63. package/types/Inputs/InputClassesFactory.d.ts +7 -8
  64. package/types/Inputs/KeyCodes.d.ts +5 -0
  65. package/types/Inputs/KeyboardController.d.ts +17 -45
  66. package/types/Inputs/MouseController.d.ts +33 -68
  67. package/types/Inputs/MouseControllerHovering.d.ts +26 -0
  68. package/types/Inputs/MouseControllerLocked.d.ts +31 -0
  69. package/types/Inputs/TouchController.d.ts +19 -44
  70. package/types/Inputs/TouchControllerFake.d.ts +29 -0
  71. package/types/Inputs/XRGamepadController.d.ts +0 -7
  72. package/types/PeerConnectionController/PeerConnectionController.d.ts +10 -1
  73. package/types/PixelStreaming/PixelStreaming.d.ts +14 -2
  74. package/types/UI/OnScreenKeyboard.d.ts +2 -2
  75. package/types/Util/EventEmitter.d.ts +1 -1
  76. package/types/Util/IURLSearchParams.d.ts +9 -0
  77. package/types/Util/InputCoordTranslator.d.ts +29 -0
  78. package/types/VideoPlayer/StreamController.d.ts +0 -2
  79. package/types/WebRtcPlayer/WebRtcPlayerController.d.ts +19 -17
  80. package/types/pixelstreamingfrontend.d.ts +1 -1
  81. package/src/Inputs/FakeTouchController.ts +0 -199
  82. package/src/Inputs/HoveringMouseEvents.ts +0 -192
  83. package/src/Inputs/IMouseEvents.ts +0 -64
  84. package/src/Inputs/ITouchController.ts +0 -29
  85. package/src/Inputs/LockedMouseEvents.ts +0 -287
  86. package/src/Util/CoordinateConverter.ts +0 -290
  87. package/src/Util/EventListenerTracker.ts +0 -29
  88. package/types/Inputs/FakeTouchController.d.ts +0 -61
  89. package/types/Inputs/HoveringMouseEvents.d.ts +0 -56
  90. package/types/Inputs/IMouseEvents.d.ts +0 -53
  91. package/types/Inputs/ITouchController.d.ts +0 -24
  92. package/types/Inputs/LockedMouseEvents.d.ts +0 -80
  93. package/types/Util/CoordinateConverter.d.ts +0 -100
  94. package/types/Util/EventListenerTracker.d.ts +0 -14
@@ -1,10 +1,6 @@
1
1
  // Copyright Epic Games, Inc. All Rights Reserved.
2
2
 
3
- import {
4
- InboundRTPStats,
5
- InboundVideoStats,
6
- InboundAudioStats
7
- } from './InboundRTPStats';
3
+ import { InboundRTPStats, InboundVideoStats, InboundAudioStats } from './InboundRTPStats';
8
4
  import { InboundTrackStats } from './InboundTrackStats';
9
5
  import { DataChannelStats } from './DataChannelStats';
10
6
  import { CandidateStat } from './CandidateStat';
@@ -19,7 +15,7 @@ import { Logger } from '@epicgames-ps/lib-pixelstreamingcommon-ue5.5';
19
15
  * The Aggregated Stats that is generated from the RTC Stats Report
20
16
  */
21
17
 
22
- type RTCStatsTypePS = RTCStatsType | 'stream' | 'media-playout';
18
+ type RTCStatsTypePS = RTCStatsType | 'stream' | 'media-playout' | 'track';
23
19
  export class AggregatedStats {
24
20
  inboundVideoStats: InboundVideoStats;
25
21
  inboundAudioStats: InboundAudioStats;
@@ -101,8 +97,8 @@ export class AggregatedStats {
101
97
  this.handleStream(stat);
102
98
  break;
103
99
  default:
104
- Logger.Error(Logger.GetStackTrace(), 'unhandled Stat Type');
105
- Logger.Log(Logger.GetStackTrace(), stat);
100
+ Logger.Error('unhandled Stat Type');
101
+ Logger.Info(stat);
106
102
  break;
107
103
  }
108
104
  });
@@ -122,10 +118,8 @@ export class AggregatedStats {
122
118
  * @param stat - the stats coming in from ice candidates
123
119
  */
124
120
  handleCandidatePair(stat: CandidatePairStats) {
125
-
126
121
  // Add the candidate pair to the candidate pair array
127
- this.candidatePairs.push(stat)
128
-
122
+ this.candidatePairs.push(stat);
129
123
  }
130
124
 
131
125
  /**
@@ -135,8 +129,7 @@ export class AggregatedStats {
135
129
  handleDataChannel(stat: DataChannelStats) {
136
130
  this.DataChannelStats.bytesReceived = stat.bytesReceived;
137
131
  this.DataChannelStats.bytesSent = stat.bytesSent;
138
- this.DataChannelStats.dataChannelIdentifier =
139
- stat.dataChannelIdentifier;
132
+ this.DataChannelStats.dataChannelIdentifier = stat.dataChannelIdentifier;
140
133
  this.DataChannelStats.id = stat.id;
141
134
  this.DataChannelStats.label = stat.label;
142
135
  this.DataChannelStats.messagesReceived = stat.messagesReceived;
@@ -176,7 +169,7 @@ export class AggregatedStats {
176
169
  RemoteCandidate.id = stat.id;
177
170
  RemoteCandidate.candidateType = stat.candidateType;
178
171
  RemoteCandidate.relayProtocol = stat.relayProtocol;
179
- RemoteCandidate.transportId = stat.transportId
172
+ RemoteCandidate.transportId = stat.transportId;
180
173
  this.remoteCandidates.push(RemoteCandidate);
181
174
  }
182
175
 
@@ -194,14 +187,9 @@ export class AggregatedStats {
194
187
 
195
188
  if (this.lastVideoStats != undefined) {
196
189
  this.inboundVideoStats.bitrate =
197
- (8 *
198
- (this.inboundVideoStats.bytesReceived -
199
- this.lastVideoStats.bytesReceived)) /
200
- (this.inboundVideoStats.timestamp -
201
- this.lastVideoStats.timestamp);
202
- this.inboundVideoStats.bitrate = Math.floor(
203
- this.inboundVideoStats.bitrate
204
- );
190
+ (8 * (this.inboundVideoStats.bytesReceived - this.lastVideoStats.bytesReceived)) /
191
+ (this.inboundVideoStats.timestamp - this.lastVideoStats.timestamp);
192
+ this.inboundVideoStats.bitrate = Math.floor(this.inboundVideoStats.bitrate);
205
193
  }
206
194
  this.lastVideoStats = { ...this.inboundVideoStats };
207
195
  break;
@@ -213,19 +201,14 @@ export class AggregatedStats {
213
201
 
214
202
  if (this.lastAudioStats != undefined) {
215
203
  this.inboundAudioStats.bitrate =
216
- (8 *
217
- (this.inboundAudioStats.bytesReceived -
218
- this.lastAudioStats.bytesReceived)) /
219
- (this.inboundAudioStats.timestamp -
220
- this.lastAudioStats.timestamp);
221
- this.inboundAudioStats.bitrate = Math.floor(
222
- this.inboundAudioStats.bitrate
223
- );
204
+ (8 * (this.inboundAudioStats.bytesReceived - this.lastAudioStats.bytesReceived)) /
205
+ (this.inboundAudioStats.timestamp - this.lastAudioStats.timestamp);
206
+ this.inboundAudioStats.bitrate = Math.floor(this.inboundAudioStats.bitrate);
224
207
  }
225
208
  this.lastAudioStats = { ...this.inboundAudioStats };
226
209
  break;
227
210
  default:
228
- Logger.Log(Logger.GetStackTrace(), 'Kind is not handled');
211
+ Logger.Info('Kind is not handled');
229
212
  break;
230
213
  }
231
214
  }
@@ -258,10 +241,7 @@ export class AggregatedStats {
258
241
  */
259
242
  handleTrack(stat: InboundTrackStats) {
260
243
  // we only want to extract stats from the video track
261
- if (
262
- stat.type === 'track' &&
263
- (stat.trackIdentifier === 'video_label' || stat.kind === 'video')
264
- ) {
244
+ if (stat.type === 'track' && (stat.trackIdentifier === 'video_label' || stat.kind === 'video')) {
265
245
  this.inboundVideoStats.framesDropped = stat.framesDropped;
266
246
  this.inboundVideoStats.framesReceived = stat.framesReceived;
267
247
  this.inboundVideoStats.frameHeight = stat.frameHeight;
@@ -269,16 +249,13 @@ export class AggregatedStats {
269
249
  }
270
250
  }
271
251
 
272
- handleTransport(stat: RTCTransportStats){
252
+ handleTransport(stat: RTCTransportStats) {
273
253
  this.transportStats = stat;
274
254
  }
275
255
 
276
-
277
256
  handleCodec(stat: CodecStats) {
278
257
  const codecId = stat.id;
279
- const codecType = `${stat.mimeType
280
- .replace('video/', '')
281
- .replace('audio/', '')}${
258
+ const codecType = `${stat.mimeType.replace('video/', '').replace('audio/', '')}${
282
259
  stat.sdpFmtpLine ? ` ${stat.sdpFmtpLine}` : ''
283
260
  }`;
284
261
  this.codecs.set(codecId, codecType);
@@ -290,17 +267,10 @@ export class AggregatedStats {
290
267
  videoEncoderAvgQP: number
291
268
  ) {
292
269
  const deltaTime = Date.now() - videoStartTime;
293
- this.sessionStats.runTime = new Date(deltaTime)
294
- .toISOString()
295
- .substr(11, 8)
296
- .toString();
270
+ this.sessionStats.runTime = new Date(deltaTime).toISOString().substr(11, 8).toString();
297
271
 
298
272
  const controlsStreamInput =
299
- inputController === null
300
- ? 'Not sent yet'
301
- : inputController
302
- ? 'true'
303
- : 'false';
273
+ inputController === null ? 'Not sent yet' : inputController ? 'true' : 'false';
304
274
  this.sessionStats.controlsStreamInput = controlsStreamInput;
305
275
 
306
276
  this.sessionStats.videoEncoderAvgQP = videoEncoderAvgQP;
@@ -319,14 +289,16 @@ export class AggregatedStats {
319
289
  * @returns The candidate pair that is currently receiving data
320
290
  */
321
291
  public getActiveCandidatePair(): CandidatePairStats | null {
322
-
323
292
  // Check if the RTCTransport stat is not undefined
324
- if (this.transportStats){
293
+ if (this.transportStats) {
325
294
  // Return the candidate pair that matches the transport candidate pair id
326
- return this.candidatePairs.find((candidatePair) => candidatePair.id === this.transportStats.selectedCandidatePairId, null);
295
+ return this.candidatePairs.find(
296
+ (candidatePair) => candidatePair.id === this.transportStats.selectedCandidatePairId,
297
+ null
298
+ );
327
299
  }
328
-
300
+
329
301
  // Fall back to the selected candidate pair
330
302
  return this.candidatePairs.find((candidatePair) => candidatePair.selected, null);
331
- }
303
+ }
332
304
  }
@@ -20,5 +20,5 @@ export class CandidatePairStats {
20
20
  timestamp: number;
21
21
  transportId: string;
22
22
  type: string;
23
- writable: boolean;
23
+ writable: boolean;
24
24
  }
@@ -7,7 +7,7 @@ export class CandidateStat {
7
7
  address: string;
8
8
  candidateType: string;
9
9
  id: string;
10
- label: string;
10
+ label: string;
11
11
  port: number;
12
12
  protocol: 'tcp' | 'udp';
13
13
  relayProtocol: 'tcp' | 'udp' | 'tls';