@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.
- package/.eslintrc.js +1 -1
- package/.prettierrc.json +1 -0
- package/dist/lib-pixelstreamingfrontend.esm.js +1 -1
- package/dist/lib-pixelstreamingfrontend.js +1 -1
- package/package.json +6 -5
- package/src/AFK/AFKController.ts +10 -32
- package/src/Config/Config.ts +179 -201
- package/src/Config/SettingBase.ts +61 -2
- package/src/Config/SettingFlag.ts +10 -48
- package/src/Config/SettingNumber.ts +10 -28
- package/src/Config/SettingOption.ts +13 -46
- package/src/Config/SettingText.ts +9 -37
- package/src/DataChannel/DataChannelController.ts +6 -26
- package/src/DataChannel/DataChannelLatencyTestController.ts +38 -33
- package/src/DataChannel/DataChannelLatencyTestResults.ts +8 -10
- package/src/DataChannel/DataChannelSender.ts +5 -15
- package/src/DataChannel/LatencyTestResults.ts +5 -15
- package/src/FreezeFrame/FreezeFrame.ts +7 -19
- package/src/FreezeFrame/FreezeFrameController.ts +3 -14
- package/src/Inputs/GamepadController.ts +123 -221
- package/src/Inputs/GamepadTypes.ts +23 -0
- package/src/Inputs/IInputController.ts +17 -0
- package/src/Inputs/InputClassesFactory.ts +38 -45
- package/src/Inputs/KeyCodes.ts +114 -0
- package/src/Inputs/KeyboardController.ts +49 -232
- package/src/Inputs/MouseController.ts +71 -297
- package/src/Inputs/MouseControllerHovering.ts +118 -0
- package/src/Inputs/MouseControllerLocked.ts +194 -0
- package/src/Inputs/TouchController.ts +49 -105
- package/src/Inputs/TouchControllerFake.ts +132 -0
- package/src/Inputs/XRGamepadController.ts +35 -44
- package/src/PeerConnectionController/AggregatedStats.ts +26 -54
- package/src/PeerConnectionController/CandidatePairStats.ts +1 -1
- package/src/PeerConnectionController/CandidateStat.ts +1 -1
- package/src/PeerConnectionController/PeerConnectionController.ts +217 -164
- package/src/PixelStreaming/PixelStreaming.ts +174 -226
- package/src/UI/OnScreenKeyboard.ts +14 -9
- package/src/UeInstanceMessage/ResponseController.ts +6 -15
- package/src/UeInstanceMessage/SendMessageController.ts +16 -18
- package/src/UeInstanceMessage/StreamMessageController.ts +3 -12
- package/src/UeInstanceMessage/ToStreamerMessagesController.ts +3 -9
- package/src/Util/EventEmitter.ts +17 -22
- package/src/Util/FileUtil.ts +11 -34
- package/src/Util/IURLSearchParams.ts +25 -0
- package/src/Util/InputCoordTranslator.ts +73 -0
- package/src/Util/RTCUtils.ts +23 -15
- package/src/VideoPlayer/StreamController.ts +6 -23
- package/src/VideoPlayer/VideoPlayer.ts +9 -30
- package/src/WebRtcPlayer/WebRtcPlayerController.ts +328 -690
- package/src/WebXR/WebXRController.ts +82 -94
- package/src/pixelstreamingfrontend.ts +6 -10
- package/types/AFK/AFKController.d.ts +0 -1
- package/types/Config/Config.d.ts +6 -5
- package/types/Config/SettingBase.d.ts +13 -0
- package/types/Config/SettingFlag.d.ts +1 -10
- package/types/Config/SettingNumber.d.ts +1 -5
- package/types/Config/SettingOption.d.ts +1 -10
- package/types/Config/SettingText.d.ts +1 -9
- package/types/DataChannel/DataChannelLatencyTestController.d.ts +1 -1
- package/types/Inputs/GamepadController.d.ts +22 -46
- package/types/Inputs/GamepadTypes.d.ts +7 -0
- package/types/Inputs/IInputController.d.ts +16 -0
- package/types/Inputs/InputClassesFactory.d.ts +7 -8
- package/types/Inputs/KeyCodes.d.ts +5 -0
- package/types/Inputs/KeyboardController.d.ts +17 -45
- package/types/Inputs/MouseController.d.ts +33 -68
- package/types/Inputs/MouseControllerHovering.d.ts +26 -0
- package/types/Inputs/MouseControllerLocked.d.ts +31 -0
- package/types/Inputs/TouchController.d.ts +19 -44
- package/types/Inputs/TouchControllerFake.d.ts +29 -0
- package/types/Inputs/XRGamepadController.d.ts +0 -7
- package/types/PeerConnectionController/PeerConnectionController.d.ts +10 -1
- package/types/PixelStreaming/PixelStreaming.d.ts +14 -2
- package/types/UI/OnScreenKeyboard.d.ts +2 -2
- package/types/Util/EventEmitter.d.ts +1 -1
- package/types/Util/IURLSearchParams.d.ts +9 -0
- package/types/Util/InputCoordTranslator.d.ts +29 -0
- package/types/VideoPlayer/StreamController.d.ts +0 -2
- package/types/WebRtcPlayer/WebRtcPlayerController.d.ts +19 -17
- package/types/pixelstreamingfrontend.d.ts +1 -1
- package/src/Inputs/FakeTouchController.ts +0 -199
- package/src/Inputs/HoveringMouseEvents.ts +0 -192
- package/src/Inputs/IMouseEvents.ts +0 -64
- package/src/Inputs/ITouchController.ts +0 -29
- package/src/Inputs/LockedMouseEvents.ts +0 -287
- package/src/Util/CoordinateConverter.ts +0 -290
- package/src/Util/EventListenerTracker.ts +0 -29
- package/types/Inputs/FakeTouchController.d.ts +0 -61
- package/types/Inputs/HoveringMouseEvents.d.ts +0 -56
- package/types/Inputs/IMouseEvents.d.ts +0 -53
- package/types/Inputs/ITouchController.d.ts +0 -24
- package/types/Inputs/LockedMouseEvents.d.ts +0 -80
- package/types/Util/CoordinateConverter.d.ts +0 -100
- 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(
|
|
105
|
-
Logger.
|
|
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
|
-
|
|
199
|
-
|
|
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
|
-
|
|
218
|
-
|
|
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.
|
|
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(
|
|
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
|
}
|