@epicgames-ps/lib-pixelstreamingfrontend-ue5.5 0.0.8 → 0.0.11
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/.eslintignore +6 -2
- package/.eslintrc.js +12 -1
- package/dist/lib-pixelstreamingfrontend.esm.js +1 -1
- package/dist/lib-pixelstreamingfrontend.js +1 -1
- package/package.json +4 -6
- package/src/Config/Config.ts +45 -31
- package/src/Config/SettingOption.ts +1 -1
- package/src/DataChannel/DataChannelLatencyTestController.ts +3 -3
- package/src/Inputs/GamepadController.ts +6 -1
- package/src/Inputs/TouchController.ts +2 -2
- package/src/PeerConnectionController/AggregatedStats.ts +34 -13
- package/src/PeerConnectionController/CandidatePairStats.ts +10 -3
- package/src/PeerConnectionController/CandidateStat.ts +4 -2
- package/src/PixelStreaming/PixelStreaming.test.ts +3 -3
- package/src/PixelStreaming/PixelStreaming.ts +34 -1
- package/src/UI/OnScreenKeyboard.ts +1 -4
- package/src/Util/EventEmitter.ts +12 -1
- package/src/WebRtcPlayer/WebRtcPlayerController.ts +20 -22
- package/src/WebXR/WebXRController.ts +1 -1
- package/types/Config/Config.d.ts +1 -0
- package/types/Inputs/GamepadController.d.ts +1 -1
- package/types/PeerConnectionController/AggregatedStats.d.ts +8 -1
- package/types/PeerConnectionController/CandidatePairStats.d.ts +10 -3
- package/types/PeerConnectionController/CandidateStat.d.ts +4 -2
- package/types/PixelStreaming/PixelStreaming.d.ts +2 -1
- package/types/Util/EventEmitter.d.ts +8 -1
- package/types/WebRtcPlayer/WebRtcPlayerController.d.ts +1 -1
package/src/Util/EventEmitter.ts
CHANGED
|
@@ -537,6 +537,16 @@ export class PlayerCountEvent extends Event {
|
|
|
537
537
|
}
|
|
538
538
|
}
|
|
539
539
|
|
|
540
|
+
/**
|
|
541
|
+
* An event that is emitted when the webRTC connections is relayed over TCP.
|
|
542
|
+
*/
|
|
543
|
+
export class WebRtcTCPRelayDetectedEvent extends Event {
|
|
544
|
+
readonly type: 'webRtcTCPRelayDetected';
|
|
545
|
+
constructor() {
|
|
546
|
+
super('webRtcTCPRelayDetected');
|
|
547
|
+
}
|
|
548
|
+
}
|
|
549
|
+
|
|
540
550
|
export type PixelStreamingEvent =
|
|
541
551
|
| AfkWarningActivateEvent
|
|
542
552
|
| AfkWarningUpdateEvent
|
|
@@ -573,7 +583,8 @@ export type PixelStreamingEvent =
|
|
|
573
583
|
| XrSessionStartedEvent
|
|
574
584
|
| XrSessionEndedEvent
|
|
575
585
|
| XrFrameEvent
|
|
576
|
-
| PlayerCountEvent
|
|
586
|
+
| PlayerCountEvent
|
|
587
|
+
| WebRtcTCPRelayDetectedEvent;
|
|
577
588
|
|
|
578
589
|
export class EventEmitter extends EventTarget {
|
|
579
590
|
/**
|
|
@@ -25,9 +25,7 @@ import {
|
|
|
25
25
|
NumericParameters
|
|
26
26
|
} from '../Config/Config';
|
|
27
27
|
import {
|
|
28
|
-
EncoderSettings,
|
|
29
28
|
InitialSettings,
|
|
30
|
-
WebRTCSettings
|
|
31
29
|
} from '../DataChannel/InitialSettings';
|
|
32
30
|
import { LatencyTestResults } from '../DataChannel/LatencyTestResults';
|
|
33
31
|
import { FileTemplate, FileUtil } from '../Util/FileUtil';
|
|
@@ -192,44 +190,44 @@ export class WebRtcPlayerController {
|
|
|
192
190
|
// set up websocket methods
|
|
193
191
|
this.transport = new WebSocketTransport();
|
|
194
192
|
this.protocol = new SignallingProtocol(this.transport);
|
|
195
|
-
this.protocol.
|
|
193
|
+
this.protocol.addListener(Messages.config.typeName, (msg: BaseMessage) =>
|
|
196
194
|
this.handleOnConfigMessage(msg as Messages.config)
|
|
197
195
|
);
|
|
198
|
-
this.protocol.
|
|
196
|
+
this.protocol.addListener(Messages.streamerList.typeName, (msg: BaseMessage) =>
|
|
199
197
|
this.handleStreamerListMessage(msg as Messages.streamerList)
|
|
200
198
|
);
|
|
201
|
-
this.protocol.
|
|
199
|
+
this.protocol.addListener(Messages.streamerIdChanged.typeName, (msg: BaseMessage) =>
|
|
202
200
|
this.handleStreamerIDChangedMessage(msg as Messages.streamerIdChanged)
|
|
203
201
|
);
|
|
204
|
-
this.protocol.
|
|
202
|
+
this.protocol.addListener(Messages.playerCount.typeName, (msg: BaseMessage) => {
|
|
205
203
|
const playerCountMessage = msg as Messages.playerCount;
|
|
206
204
|
this.pixelStreaming._onPlayerCount(playerCountMessage.count);
|
|
207
205
|
});
|
|
208
|
-
this.protocol.
|
|
206
|
+
this.protocol.addListener(Messages.answer.typeName, (msg: BaseMessage) =>
|
|
209
207
|
this.handleWebRtcAnswer(msg as Messages.answer)
|
|
210
208
|
);
|
|
211
|
-
this.protocol.
|
|
209
|
+
this.protocol.addListener(Messages.offer.typeName, (msg: BaseMessage) =>
|
|
212
210
|
this.handleWebRtcOffer(msg as Messages.offer)
|
|
213
211
|
);
|
|
214
|
-
this.protocol.
|
|
215
|
-
this.handleWebRtcSFUPeerDatachannels(msg as Messages.
|
|
212
|
+
this.protocol.addListener(Messages.peerDataChannels.typeName, (msg: BaseMessage) =>
|
|
213
|
+
this.handleWebRtcSFUPeerDatachannels(msg as Messages.peerDataChannels)
|
|
216
214
|
);
|
|
217
|
-
this.protocol.
|
|
215
|
+
this.protocol.addListener(Messages.iceCandidate.typeName, (msg: BaseMessage) => {
|
|
218
216
|
const iceCandidateMessage = msg as Messages.iceCandidate;
|
|
219
217
|
this.handleIceCandidate(iceCandidateMessage.candidate);
|
|
220
218
|
});
|
|
221
|
-
this.protocol.
|
|
219
|
+
this.protocol.transport.addListener('open', () => {
|
|
222
220
|
const BrowserSendsOffer = this.config.isFlagEnabled(Flags.BrowserSendOffer);
|
|
223
221
|
if (!BrowserSendsOffer) {
|
|
224
222
|
const message = MessageHelpers.createMessage(Messages.listStreamers);
|
|
225
223
|
this.protocol.sendMessage(message);
|
|
226
224
|
}
|
|
227
225
|
});
|
|
228
|
-
this.protocol.
|
|
226
|
+
this.protocol.transport.addListener('error', () => {
|
|
229
227
|
// dont really need to do anything here since the close event should follow.
|
|
230
228
|
Logger.Error(Logger.GetStackTrace(), `Got a transport error.`);
|
|
231
229
|
});
|
|
232
|
-
this.protocol.
|
|
230
|
+
this.protocol.transport.addListener('close', (event: CloseEvent) => {
|
|
233
231
|
// when we refresh the page during a stream we get the going away code.
|
|
234
232
|
// in that case we don't want to reconnect since we're navigating away.
|
|
235
233
|
// https://developer.mozilla.org/en-US/docs/Web/API/CloseEvent/code
|
|
@@ -1331,7 +1329,7 @@ export class WebRtcPlayerController {
|
|
|
1331
1329
|
// get the current selected streamer id option
|
|
1332
1330
|
const streamerIDOption = this.config.getSettingOption(OptionParameters.StreamerId);
|
|
1333
1331
|
const existingSelection = streamerIDOption.selected.toString().trim();
|
|
1334
|
-
if (
|
|
1332
|
+
if (existingSelection) {
|
|
1335
1333
|
// default to selected option if it exists
|
|
1336
1334
|
wantedStreamerId = streamerIDOption.selected;
|
|
1337
1335
|
}
|
|
@@ -1386,7 +1384,7 @@ export class WebRtcPlayerController {
|
|
|
1386
1384
|
this.isReconnecting = true;
|
|
1387
1385
|
this.reconnectAttempt++;
|
|
1388
1386
|
setTimeout(() => {
|
|
1389
|
-
this.protocol.
|
|
1387
|
+
this.protocol.sendMessage(MessageHelpers.createMessage(Messages.listStreamers));
|
|
1390
1388
|
}, reconnectDelay);
|
|
1391
1389
|
} else {
|
|
1392
1390
|
// We've exhausted our reconnect attempts, return to main screen
|
|
@@ -1488,7 +1486,7 @@ export class WebRtcPlayerController {
|
|
|
1488
1486
|
* Handle when the SFU provides the peer with its data channels
|
|
1489
1487
|
* @param DataChannels - The message from the SFU containing the data channels ids
|
|
1490
1488
|
*/
|
|
1491
|
-
handleWebRtcSFUPeerDatachannels(DataChannels: Messages.
|
|
1489
|
+
handleWebRtcSFUPeerDatachannels(DataChannels: Messages.peerDataChannels) {
|
|
1492
1490
|
const SendOptions: RTCDataChannelInit = {
|
|
1493
1491
|
ordered: true,
|
|
1494
1492
|
negotiated: true,
|
|
@@ -1517,7 +1515,7 @@ export class WebRtcPlayerController {
|
|
|
1517
1515
|
RecvOptions
|
|
1518
1516
|
);
|
|
1519
1517
|
this.recvDataChannelController.handleOnOpen = () =>
|
|
1520
|
-
this.protocol.
|
|
1518
|
+
this.protocol.sendMessage(MessageHelpers.createMessage(Messages.peerDataChannelsReady));
|
|
1521
1519
|
// If we're uni-directional, only the recv data channel should handle incoming messages
|
|
1522
1520
|
this.recvDataChannelController.handleOnMessage = (
|
|
1523
1521
|
ev: MessageEvent
|
|
@@ -1570,7 +1568,7 @@ export class WebRtcPlayerController {
|
|
|
1570
1568
|
handleSendIceCandidate(iceEvent: RTCPeerConnectionIceEvent) {
|
|
1571
1569
|
Logger.Log(Logger.GetStackTrace(), 'OnIceCandidate', 6);
|
|
1572
1570
|
if (iceEvent.candidate && iceEvent.candidate.candidate) {
|
|
1573
|
-
this.protocol.
|
|
1571
|
+
this.protocol.sendMessage(MessageHelpers.createMessage(Messages.iceCandidate, { candidate: iceEvent.candidate }));
|
|
1574
1572
|
}
|
|
1575
1573
|
}
|
|
1576
1574
|
|
|
@@ -1610,7 +1608,7 @@ export class WebRtcPlayerController {
|
|
|
1610
1608
|
maxBitrateBps: 1000 * this.config.getNumericSettingValue(NumericParameters.WebRTCMaxBitrate)
|
|
1611
1609
|
};
|
|
1612
1610
|
|
|
1613
|
-
this.protocol.
|
|
1611
|
+
this.protocol.sendMessage(MessageHelpers.createMessage(Messages.offer, extraParams));
|
|
1614
1612
|
}
|
|
1615
1613
|
|
|
1616
1614
|
/**
|
|
@@ -1630,10 +1628,10 @@ export class WebRtcPlayerController {
|
|
|
1630
1628
|
maxBitrateBps: 1000 * this.config.getNumericSettingValue(NumericParameters.WebRTCMaxBitrate)
|
|
1631
1629
|
};
|
|
1632
1630
|
|
|
1633
|
-
this.protocol.
|
|
1631
|
+
this.protocol.sendMessage(MessageHelpers.createMessage(Messages.answer, extraParams));
|
|
1634
1632
|
|
|
1635
1633
|
if (this.isUsingSFU) {
|
|
1636
|
-
this.protocol.
|
|
1634
|
+
this.protocol.sendMessage(MessageHelpers.createMessage(Messages.dataChannelRequest));
|
|
1637
1635
|
}
|
|
1638
1636
|
}
|
|
1639
1637
|
|
|
@@ -193,7 +193,7 @@ export class WebXRController {
|
|
|
193
193
|
|
|
194
194
|
if (this.webRtcController.config.isFlagEnabled(Flags.XRControllerInput)) {
|
|
195
195
|
this.xrSession.inputSources.forEach(
|
|
196
|
-
(source: XRInputSource,
|
|
196
|
+
(source: XRInputSource, _index: number, _array: XRInputSource[]) => {
|
|
197
197
|
this.xrGamepadController.updateStatus(
|
|
198
198
|
source,
|
|
199
199
|
frame,
|
package/types/Config/Config.d.ts
CHANGED
|
@@ -27,6 +27,7 @@ export declare class Flags {
|
|
|
27
27
|
static GamepadInput: "GamepadInput";
|
|
28
28
|
static XRControllerInput: "XRControllerInput";
|
|
29
29
|
static WaitForStreamer: "WaitForStreamer";
|
|
30
|
+
static HideUI: "HideUI";
|
|
30
31
|
}
|
|
31
32
|
export type FlagsKeys = Exclude<keyof typeof Flags, 'prototype'>;
|
|
32
33
|
export type FlagsIds = typeof Flags[FlagsKeys];
|
|
@@ -43,7 +43,7 @@ export declare class GamePadController {
|
|
|
43
43
|
* Event to send the gamepaddisconnected message to the application
|
|
44
44
|
*/
|
|
45
45
|
onGamepadDisconnected(controllerIdx: number): void;
|
|
46
|
-
onBeforeUnload(
|
|
46
|
+
onBeforeUnload(_: Event): void;
|
|
47
47
|
}
|
|
48
48
|
/**
|
|
49
49
|
* Additional types for Window and Navigator
|
|
@@ -12,7 +12,7 @@ export declare class AggregatedStats {
|
|
|
12
12
|
inboundAudioStats: InboundAudioStats;
|
|
13
13
|
lastVideoStats: InboundVideoStats;
|
|
14
14
|
lastAudioStats: InboundAudioStats;
|
|
15
|
-
|
|
15
|
+
candidatePairs: Array<CandidatePairStats>;
|
|
16
16
|
DataChannelStats: DataChannelStats;
|
|
17
17
|
localCandidates: Array<CandidateStat>;
|
|
18
18
|
remoteCandidates: Array<CandidateStat>;
|
|
@@ -20,6 +20,7 @@ export declare class AggregatedStats {
|
|
|
20
20
|
sessionStats: SessionStats;
|
|
21
21
|
streamStats: StreamStats;
|
|
22
22
|
codecs: Map<string, string>;
|
|
23
|
+
transportStats: RTCTransportStats;
|
|
23
24
|
constructor();
|
|
24
25
|
/**
|
|
25
26
|
* Gather all the information from the RTC Peer Connection Report
|
|
@@ -67,6 +68,7 @@ export declare class AggregatedStats {
|
|
|
67
68
|
* @param stat - video track stats
|
|
68
69
|
*/
|
|
69
70
|
handleTrack(stat: InboundTrackStats): void;
|
|
71
|
+
handleTransport(stat: RTCTransportStats): void;
|
|
70
72
|
handleCodec(stat: CodecStats): void;
|
|
71
73
|
handleSessionStatistics(videoStartTime: number, inputController: boolean | null, videoEncoderAvgQP: number): void;
|
|
72
74
|
/**
|
|
@@ -74,4 +76,9 @@ export declare class AggregatedStats {
|
|
|
74
76
|
* @param value - the number to be checked
|
|
75
77
|
*/
|
|
76
78
|
isNumber(value: unknown): boolean;
|
|
79
|
+
/**
|
|
80
|
+
* Helper function to return the active candidate pair
|
|
81
|
+
* @returns The candidate pair that is currently receiving data
|
|
82
|
+
*/
|
|
83
|
+
getActiveCandidatePair(): CandidatePairStats | null;
|
|
77
84
|
}
|
|
@@ -4,12 +4,19 @@
|
|
|
4
4
|
export declare class CandidatePairStats {
|
|
5
5
|
bytesReceived: number;
|
|
6
6
|
bytesSent: number;
|
|
7
|
+
currentRoundTripTime: number;
|
|
8
|
+
id: string;
|
|
9
|
+
lastPacketReceivedTimestamp: number;
|
|
10
|
+
lastPacketSentTimestamp: number;
|
|
7
11
|
localCandidateId: string;
|
|
8
|
-
remoteCandidateId: string;
|
|
9
12
|
nominated: boolean;
|
|
13
|
+
priority: number;
|
|
10
14
|
readable: boolean;
|
|
11
|
-
|
|
15
|
+
remoteCandidateId: string;
|
|
12
16
|
selected: boolean;
|
|
13
17
|
state: string;
|
|
14
|
-
|
|
18
|
+
timestamp: number;
|
|
19
|
+
transportId: string;
|
|
20
|
+
type: string;
|
|
21
|
+
writable: boolean;
|
|
15
22
|
}
|
|
@@ -2,10 +2,12 @@
|
|
|
2
2
|
* ICE Candidate Stat collected from the RTC Stats Report
|
|
3
3
|
*/
|
|
4
4
|
export declare class CandidateStat {
|
|
5
|
-
label: string;
|
|
6
|
-
id: string;
|
|
7
5
|
address: string;
|
|
8
6
|
candidateType: string;
|
|
7
|
+
id: string;
|
|
8
|
+
label: string;
|
|
9
9
|
port: number;
|
|
10
10
|
protocol: 'tcp' | 'udp';
|
|
11
|
+
relayProtocol: 'tcp' | 'udp' | 'tls';
|
|
12
|
+
transportId: string;
|
|
11
13
|
}
|
|
@@ -3,7 +3,7 @@ import { LatencyTestResults } from '../DataChannel/LatencyTestResults';
|
|
|
3
3
|
import { AggregatedStats } from '../PeerConnectionController/AggregatedStats';
|
|
4
4
|
import { WebRtcPlayerController } from '../WebRtcPlayer/WebRtcPlayerController';
|
|
5
5
|
import { InitialSettings } from '../DataChannel/InitialSettings';
|
|
6
|
-
import { PixelStreamingEvent } from '../Util/EventEmitter';
|
|
6
|
+
import { PixelStreamingEvent, StatsReceivedEvent } from '../Util/EventEmitter';
|
|
7
7
|
import { WebXRController } from '../WebXR/WebXRController';
|
|
8
8
|
import { MessageDirection } from '../UeInstanceMessage/StreamMessageController';
|
|
9
9
|
import { DataChannelLatencyTestConfig, DataChannelLatencyTestController } from "../DataChannel/DataChannelLatencyTestController";
|
|
@@ -159,6 +159,7 @@ export declare class PixelStreaming {
|
|
|
159
159
|
*/
|
|
160
160
|
_onQualityControlOwnership(hasQualityOwnership: boolean): void;
|
|
161
161
|
_onPlayerCount(playerCount: number): void;
|
|
162
|
+
_setupWebRtcTCPRelayDetection(statsReceivedEvent: StatsReceivedEvent): void;
|
|
162
163
|
/**
|
|
163
164
|
* Request a connection latency test.
|
|
164
165
|
* NOTE: There are plans to refactor all request* functions. Expect changes if you use this!
|
|
@@ -395,7 +395,14 @@ export declare class PlayerCountEvent extends Event {
|
|
|
395
395
|
};
|
|
396
396
|
constructor(data: PlayerCountEvent['data']);
|
|
397
397
|
}
|
|
398
|
-
|
|
398
|
+
/**
|
|
399
|
+
* An event that is emitted when the webRTC connections is relayed over TCP.
|
|
400
|
+
*/
|
|
401
|
+
export declare class WebRtcTCPRelayDetectedEvent extends Event {
|
|
402
|
+
readonly type: 'webRtcTCPRelayDetected';
|
|
403
|
+
constructor();
|
|
404
|
+
}
|
|
405
|
+
export type PixelStreamingEvent = AfkWarningActivateEvent | AfkWarningUpdateEvent | AfkWarningDeactivateEvent | AfkTimedOutEvent | VideoEncoderAvgQPEvent | WebRtcSdpEvent | WebRtcAutoConnectEvent | WebRtcConnectingEvent | WebRtcConnectedEvent | WebRtcFailedEvent | WebRtcDisconnectedEvent | DataChannelOpenEvent | DataChannelCloseEvent | DataChannelErrorEvent | VideoInitializedEvent | StreamLoadingEvent | StreamPreConnectEvent | StreamReconnectEvent | StreamPreDisconnectEvent | PlayStreamErrorEvent | PlayStreamEvent | PlayStreamRejectedEvent | LoadFreezeFrameEvent | HideFreezeFrameEvent | StatsReceivedEvent | StreamerListMessageEvent | StreamerIDChangedMessageEvent | LatencyTestResultEvent | DataChannelLatencyTestResponseEvent | DataChannelLatencyTestResultEvent | InitialSettingsEvent | SettingsChangedEvent | XrSessionStartedEvent | XrSessionEndedEvent | XrFrameEvent | PlayerCountEvent | WebRtcTCPRelayDetectedEvent;
|
|
399
406
|
export declare class EventEmitter extends EventTarget {
|
|
400
407
|
/**
|
|
401
408
|
* Dispatch a new event.
|
|
@@ -196,7 +196,7 @@ export declare class WebRtcPlayerController {
|
|
|
196
196
|
* Handle when the SFU provides the peer with its data channels
|
|
197
197
|
* @param DataChannels - The message from the SFU containing the data channels ids
|
|
198
198
|
*/
|
|
199
|
-
handleWebRtcSFUPeerDatachannels(DataChannels: Messages.
|
|
199
|
+
handleWebRtcSFUPeerDatachannels(DataChannels: Messages.peerDataChannels): void;
|
|
200
200
|
handlePostWebrtcNegotiation(): void;
|
|
201
201
|
/**
|
|
202
202
|
* When an ice Candidate is received from the Signaling server add it to the Peer Connection Client
|