@epicgames-ps/lib-pixelstreamingfrontend-ue5.5 0.0.5

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 (138) hide show
  1. package/.cspell.json +48 -0
  2. package/.eslintignore +8 -0
  3. package/.eslintrc.js +8 -0
  4. package/.prettierignore +0 -0
  5. package/.prettierrc.json +6 -0
  6. package/dist/lib-pixelstreamingfrontend.esm.js +1 -0
  7. package/dist/lib-pixelstreamingfrontend.js +1 -0
  8. package/jest.config.js +18 -0
  9. package/package.json +48 -0
  10. package/readme.md +15 -0
  11. package/src/AFK/AFKController.test.ts +162 -0
  12. package/src/AFK/AFKController.ts +158 -0
  13. package/src/Config/Config.test.ts +222 -0
  14. package/src/Config/Config.ts +970 -0
  15. package/src/Config/SettingBase.ts +65 -0
  16. package/src/Config/SettingFlag.ts +99 -0
  17. package/src/Config/SettingNumber.ts +111 -0
  18. package/src/Config/SettingOption.ts +124 -0
  19. package/src/Config/SettingText.ts +82 -0
  20. package/src/DataChannel/DataChannelController.ts +138 -0
  21. package/src/DataChannel/DataChannelLatencyTestController.ts +129 -0
  22. package/src/DataChannel/DataChannelLatencyTestResults.ts +67 -0
  23. package/src/DataChannel/DataChannelSender.ts +59 -0
  24. package/src/DataChannel/InitialSettings.ts +61 -0
  25. package/src/DataChannel/LatencyTestResults.ts +76 -0
  26. package/src/FreezeFrame/FreezeFrame.ts +114 -0
  27. package/src/FreezeFrame/FreezeFrameController.ts +114 -0
  28. package/src/Inputs/FakeTouchController.ts +199 -0
  29. package/src/Inputs/GamepadController.ts +314 -0
  30. package/src/Inputs/GamepadTypes.ts +10 -0
  31. package/src/Inputs/HoveringMouseEvents.ts +192 -0
  32. package/src/Inputs/IMouseEvents.ts +64 -0
  33. package/src/Inputs/ITouchController.ts +29 -0
  34. package/src/Inputs/InputClassesFactory.ts +140 -0
  35. package/src/Inputs/KeyboardController.ts +354 -0
  36. package/src/Inputs/LockedMouseEvents.ts +287 -0
  37. package/src/Inputs/MouseButtons.ts +25 -0
  38. package/src/Inputs/MouseController.ts +362 -0
  39. package/src/Inputs/SpecialKeyCodes.ts +16 -0
  40. package/src/Inputs/TouchController.ts +208 -0
  41. package/src/Inputs/XRGamepadController.ts +126 -0
  42. package/src/PeerConnectionController/AggregatedStats.ts +311 -0
  43. package/src/PeerConnectionController/CandidatePairStats.ts +17 -0
  44. package/src/PeerConnectionController/CandidateStat.ts +13 -0
  45. package/src/PeerConnectionController/CodecStats.ts +19 -0
  46. package/src/PeerConnectionController/DataChannelStats.ts +17 -0
  47. package/src/PeerConnectionController/InboundRTPStats.ts +154 -0
  48. package/src/PeerConnectionController/InboundTrackStats.ts +34 -0
  49. package/src/PeerConnectionController/OutBoundRTPStats.ts +26 -0
  50. package/src/PeerConnectionController/PeerConnectionController.ts +563 -0
  51. package/src/PeerConnectionController/SessionStats.ts +10 -0
  52. package/src/PeerConnectionController/StreamStats.ts +11 -0
  53. package/src/PixelStreaming/PixelStreaming.test.ts +626 -0
  54. package/src/PixelStreaming/PixelStreaming.ts +851 -0
  55. package/src/UI/OnScreenKeyboard.ts +97 -0
  56. package/src/UeInstanceMessage/ResponseController.ts +47 -0
  57. package/src/UeInstanceMessage/SendMessageController.ts +154 -0
  58. package/src/UeInstanceMessage/StreamMessageController.ts +233 -0
  59. package/src/UeInstanceMessage/ToStreamerMessagesController.ts +62 -0
  60. package/src/Util/CoordinateConverter.ts +289 -0
  61. package/src/Util/EventEmitter.ts +611 -0
  62. package/src/Util/EventListenerTracker.ts +29 -0
  63. package/src/Util/FileUtil.ts +140 -0
  64. package/src/Util/RTCUtils.ts +41 -0
  65. package/src/Util/WebGLUtils.ts +49 -0
  66. package/src/Util/WebXRUtils.ts +25 -0
  67. package/src/VideoPlayer/StreamController.ts +89 -0
  68. package/src/VideoPlayer/VideoPlayer.ts +246 -0
  69. package/src/WebRtcPlayer/WebRtcPlayerController.ts +2158 -0
  70. package/src/WebXR/WebXRController.ts +319 -0
  71. package/src/__test__/mockMediaStream.ts +124 -0
  72. package/src/__test__/mockRTCPeerConnection.ts +347 -0
  73. package/src/__test__/mockRTCRtpReceiver.ts +22 -0
  74. package/src/__test__/mockWebSocket.ts +136 -0
  75. package/src/pixelstreamingfrontend.ts +46 -0
  76. package/tsconfig.jest.json +8 -0
  77. package/tsconfig.json +24 -0
  78. package/types/AFK/AFKController.d.ts +39 -0
  79. package/types/Config/Config.d.ts +218 -0
  80. package/types/Config/SettingBase.d.ts +30 -0
  81. package/types/Config/SettingFlag.d.ts +33 -0
  82. package/types/Config/SettingNumber.d.ts +45 -0
  83. package/types/Config/SettingOption.d.ts +43 -0
  84. package/types/Config/SettingText.d.ts +29 -0
  85. package/types/DataChannel/DataChannelController.d.ts +59 -0
  86. package/types/DataChannel/DataChannelLatencyTestController.d.ts +26 -0
  87. package/types/DataChannel/DataChannelLatencyTestResults.d.ts +46 -0
  88. package/types/DataChannel/DataChannelSender.d.ts +21 -0
  89. package/types/DataChannel/InitialSettings.d.ts +44 -0
  90. package/types/DataChannel/LatencyTestResults.d.ts +31 -0
  91. package/types/FreezeFrame/FreezeFrame.d.ts +36 -0
  92. package/types/FreezeFrame/FreezeFrameController.d.ts +37 -0
  93. package/types/Inputs/FakeTouchController.d.ts +61 -0
  94. package/types/Inputs/GamepadController.d.ts +85 -0
  95. package/types/Inputs/GamepadTypes.d.ts +8 -0
  96. package/types/Inputs/HoveringMouseEvents.d.ts +56 -0
  97. package/types/Inputs/IMouseEvents.d.ts +53 -0
  98. package/types/Inputs/ITouchController.d.ts +24 -0
  99. package/types/Inputs/InputClassesFactory.d.ts +54 -0
  100. package/types/Inputs/KeyboardController.d.ts +62 -0
  101. package/types/Inputs/LockedMouseEvents.d.ts +80 -0
  102. package/types/Inputs/MouseButtons.d.ts +22 -0
  103. package/types/Inputs/MouseController.d.ts +75 -0
  104. package/types/Inputs/SpecialKeyCodes.d.ts +14 -0
  105. package/types/Inputs/TouchController.d.ts +53 -0
  106. package/types/Inputs/XRGamepadController.d.ts +15 -0
  107. package/types/PeerConnectionController/AggregatedStats.d.ts +77 -0
  108. package/types/PeerConnectionController/CandidatePairStats.d.ts +15 -0
  109. package/types/PeerConnectionController/CandidateStat.d.ts +11 -0
  110. package/types/PeerConnectionController/CodecStats.d.ts +14 -0
  111. package/types/PeerConnectionController/DataChannelStats.d.ts +15 -0
  112. package/types/PeerConnectionController/InboundRTPStats.d.ts +141 -0
  113. package/types/PeerConnectionController/InboundTrackStats.d.ts +32 -0
  114. package/types/PeerConnectionController/OutBoundRTPStats.d.ts +23 -0
  115. package/types/PeerConnectionController/PeerConnectionController.d.ts +132 -0
  116. package/types/PeerConnectionController/SessionStats.d.ts +8 -0
  117. package/types/PeerConnectionController/StreamStats.d.ts +9 -0
  118. package/types/PixelStreaming/PixelStreaming.d.ts +259 -0
  119. package/types/UI/OnScreenKeyboard.d.ts +31 -0
  120. package/types/UeInstanceMessage/ResponseController.d.ts +19 -0
  121. package/types/UeInstanceMessage/SendMessageController.d.ts +18 -0
  122. package/types/UeInstanceMessage/StreamMessageController.d.ts +29 -0
  123. package/types/UeInstanceMessage/ToStreamerMessagesController.d.ts +32 -0
  124. package/types/Util/CoordinateConverter.d.ts +100 -0
  125. package/types/Util/EventEmitter.d.ts +422 -0
  126. package/types/Util/EventListenerTracker.d.ts +14 -0
  127. package/types/Util/FileUtil.d.ts +32 -0
  128. package/types/Util/RTCUtils.d.ts +8 -0
  129. package/types/Util/WebGLUtils.d.ts +4 -0
  130. package/types/Util/WebXRUtils.d.ts +9 -0
  131. package/types/VideoPlayer/StreamController.d.ts +24 -0
  132. package/types/VideoPlayer/VideoPlayer.d.ts +78 -0
  133. package/types/WebRtcPlayer/WebRtcPlayerController.d.ts +377 -0
  134. package/types/WebXR/WebXRController.d.ts +26 -0
  135. package/types/pixelstreamingfrontend.d.ts +22 -0
  136. package/webpack.common.js +35 -0
  137. package/webpack.dev.js +35 -0
  138. package/webpack.prod.js +36 -0
@@ -0,0 +1,377 @@
1
+ import { MessageReceive, SignallingProtocol, ITransport } from '@epicgames-ps/lib-pixelstreamingcommon-ue5.5';
2
+ import { StreamController } from '../VideoPlayer/StreamController';
3
+ import { FreezeFrameController } from '../FreezeFrame/FreezeFrameController';
4
+ import { AFKController } from '../AFK/AFKController';
5
+ import { DataChannelController } from '../DataChannel/DataChannelController';
6
+ import { PeerConnectionController } from '../PeerConnectionController/PeerConnectionController';
7
+ import { KeyboardController } from '../Inputs/KeyboardController';
8
+ import { AggregatedStats } from '../PeerConnectionController/AggregatedStats';
9
+ import { Config } from '../Config/Config';
10
+ import { FileTemplate } from '../Util/FileUtil';
11
+ import { InputClassesFactory } from '../Inputs/InputClassesFactory';
12
+ import { VideoPlayer } from '../VideoPlayer/VideoPlayer';
13
+ import { StreamMessageController, MessageDirection } from '../UeInstanceMessage/StreamMessageController';
14
+ import { ResponseController } from '../UeInstanceMessage/ResponseController';
15
+ import { SendMessageController } from '../UeInstanceMessage/SendMessageController';
16
+ import { ToStreamerMessagesController } from '../UeInstanceMessage/ToStreamerMessagesController';
17
+ import { MouseController } from '../Inputs/MouseController';
18
+ import { GamePadController } from '../Inputs/GamepadController';
19
+ import { DataChannelSender } from '../DataChannel/DataChannelSender';
20
+ import { CoordinateConverter, UnquantizedDenormalizedUnsignedCoord } from '../Util/CoordinateConverter';
21
+ import { PixelStreaming } from '../PixelStreaming/PixelStreaming';
22
+ import { ITouchController } from '../Inputs/ITouchController';
23
+ import { DataChannelLatencyTestRequest } from "../DataChannel/DataChannelLatencyTestResults";
24
+ /**
25
+ * Entry point for the WebRTC Player
26
+ */
27
+ export declare class WebRtcPlayerController {
28
+ config: Config;
29
+ responseController: ResponseController;
30
+ sdpConstraints: RTCOfferOptions;
31
+ transport: ITransport;
32
+ protocol: SignallingProtocol;
33
+ sendrecvDataChannelController: DataChannelController;
34
+ recvDataChannelController: DataChannelController;
35
+ dataChannelSender: DataChannelSender;
36
+ datachannelOptions: RTCDataChannelInit;
37
+ videoPlayer: VideoPlayer;
38
+ streamController: StreamController;
39
+ peerConnectionController: PeerConnectionController;
40
+ inputClassesFactory: InputClassesFactory;
41
+ freezeFrameController: FreezeFrameController;
42
+ shouldShowPlayOverlay: boolean;
43
+ afkController: AFKController;
44
+ videoElementParentClientRect: DOMRect;
45
+ latencyStartTime: number;
46
+ pixelStreaming: PixelStreaming;
47
+ streamMessageController: StreamMessageController;
48
+ sendMessageController: SendMessageController;
49
+ toStreamerMessagesController: ToStreamerMessagesController;
50
+ keyboardController: KeyboardController;
51
+ mouseController: MouseController;
52
+ touchController: ITouchController;
53
+ gamePadController: GamePadController;
54
+ coordinateConverter: CoordinateConverter;
55
+ isUsingSFU: boolean;
56
+ isQualityController: boolean;
57
+ statsTimerHandle: number;
58
+ file: FileTemplate;
59
+ preferredCodec: string;
60
+ peerConfig: RTCConfiguration;
61
+ videoAvgQp: number;
62
+ locallyClosed: boolean;
63
+ shouldReconnect: boolean;
64
+ isReconnecting: boolean;
65
+ reconnectAttempt: number;
66
+ disconnectMessage: string;
67
+ subscribedStream: string;
68
+ signallingUrlBuilder: () => string;
69
+ autoJoinTimer: ReturnType<typeof setTimeout>;
70
+ /**
71
+ *
72
+ * @param config - the frontend config object
73
+ * @param pixelStreaming - the PixelStreaming object
74
+ */
75
+ constructor(config: Config, pixelStreaming: PixelStreaming);
76
+ /**
77
+ * Make a request to UnquantizedAndDenormalizeUnsigned coordinates
78
+ * @param x x axis coordinate
79
+ * @param y y axis coordinate
80
+ */
81
+ requestUnquantizedAndDenormalizeUnsigned(x: number, y: number): UnquantizedDenormalizedUnsignedCoord;
82
+ /**
83
+ * Handles when a message is received
84
+ * @param event - Message Event
85
+ */
86
+ handleOnMessage(event: MessageEvent): void;
87
+ /**
88
+ * Register message all handlers
89
+ */
90
+ registerMessageHandlers(): void;
91
+ /**
92
+ * Activate the logic associated with a command from UE
93
+ * @param message
94
+ */
95
+ onCommand(message: ArrayBuffer): void;
96
+ /**
97
+ * Handles a protocol message received from the streamer
98
+ * @param message the message data from the streamer
99
+ */
100
+ onProtocolMessage(message: ArrayBuffer): void;
101
+ /**
102
+ * Handles an input control message when it is received from the streamer
103
+ * @param message The input control message
104
+ */
105
+ onInputControlOwnership(message: ArrayBuffer): void;
106
+ /**
107
+ *
108
+ * @param message
109
+ */
110
+ onGamepadResponse(message: ArrayBuffer): void;
111
+ onAfkTriggered(): void;
112
+ /**
113
+ * Set whether we should timeout when afk.
114
+ * @param afkEnabled If true we timeout when idle for some given amount of time.
115
+ */
116
+ setAfkEnabled(afkEnabled: boolean): void;
117
+ /**
118
+ * Attempt a reconnection to the signalling server
119
+ */
120
+ tryReconnect(message: string): void;
121
+ /**
122
+ * Loads a freeze frame if it is required otherwise shows the play overlay
123
+ */
124
+ loadFreezeFrameOrShowPlayOverlay(): void;
125
+ /**
126
+ * Process the freeze frame and load it
127
+ * @param message The freeze frame data in bytes
128
+ */
129
+ onFreezeFrameMessage(message: ArrayBuffer): void;
130
+ /**
131
+ * Enable the video after hiding a freeze frame
132
+ */
133
+ invalidateFreezeFrameAndEnableVideo(): void;
134
+ /**
135
+ * Prep datachannel data for processing file extension
136
+ * @param data the file extension data
137
+ */
138
+ onFileExtension(data: ArrayBuffer): void;
139
+ /**
140
+ * Prep datachannel data for processing the file mime type
141
+ * @param data the file mime type data
142
+ */
143
+ onFileMimeType(data: ArrayBuffer): void;
144
+ /**
145
+ * Prep datachannel data for processing the file contents
146
+ * @param data the file contents data
147
+ */
148
+ onFileContents(data: ArrayBuffer): void;
149
+ /**
150
+ * Plays the stream audio and video source and sets up other pieces while the stream starts
151
+ */
152
+ playStream(): void;
153
+ /**
154
+ * Plays the video stream
155
+ */
156
+ private playVideo;
157
+ /**
158
+ * Enable the video to play automatically if enableAutoplay is true
159
+ */
160
+ autoPlayVideoOrSetUpPlayOverlay(): void;
161
+ /**
162
+ * Connect to the Signaling server
163
+ */
164
+ connectToSignallingServer(): void;
165
+ /**
166
+ * This will start the handshake to the signalling server
167
+ * @param peerConfig - RTC Configuration Options from the Signaling server
168
+ * @remark RTC Peer Connection on Ice Candidate event have it handled by handle Send Ice Candidate
169
+ */
170
+ startSession(peerConfig: RTCConfiguration): void;
171
+ /**
172
+ * Checks the peer connection options for a turn server and returns true or false
173
+ */
174
+ checkTurnServerAvailability(options: RTCConfiguration): boolean;
175
+ /**
176
+ * Handles when a Config Message is received contains the Peer Connection Options required (STUN and TURN Server Info)
177
+ * @param messageConfig - Config Message received from the signaling server
178
+ */
179
+ handleOnConfigMessage(messageConfig: MessageReceive.MessageConfig): void;
180
+ /**
181
+ * Handles when the signalling server gives us the list of streamer ids.
182
+ */
183
+ handleStreamerListMessage(messageStreamerList: MessageReceive.MessageStreamerList): void;
184
+ handleStreamerIDChangedMessage(streamerIDChangedMessage: MessageReceive.MessageStreamerIDChanged): void;
185
+ /**
186
+ * Handle the RTC Answer from the signaling server
187
+ * @param Answer - Answer SDP from the peer.
188
+ */
189
+ handleWebRtcAnswer(Answer: MessageReceive.MessageAnswer): void;
190
+ /**
191
+ * Handle the RTC offer from a WebRTC peer (received through the signalling server).
192
+ * @param Offer - Offer SDP from the peer.
193
+ */
194
+ handleWebRtcOffer(Offer: MessageReceive.MessageOffer): void;
195
+ /**
196
+ * Handle when the SFU provides the peer with its data channels
197
+ * @param DataChannels - The message from the SFU containing the data channels ids
198
+ */
199
+ handleWebRtcSFUPeerDatachannels(DataChannels: MessageReceive.MessagePeerDataChannels): void;
200
+ handlePostWebrtcNegotiation(): void;
201
+ /**
202
+ * When an ice Candidate is received from the Signaling server add it to the Peer Connection Client
203
+ * @param iceCandidate - Ice Candidate from Server
204
+ */
205
+ handleIceCandidate(iceCandidate: RTCIceCandidateInit): void;
206
+ /**
207
+ * Send the ice Candidate to the signaling server via websocket
208
+ * @param iceEvent - RTC Peer ConnectionIceEvent) {
209
+ */
210
+ handleSendIceCandidate(iceEvent: RTCPeerConnectionIceEvent): void;
211
+ /**
212
+ * Send the ice Candidate to the signaling server via websocket
213
+ * @param iceEvent - RTC Peer ConnectionIceEvent) {
214
+ */
215
+ handleDataChannel(datachannelEvent: RTCDataChannelEvent): void;
216
+ /**
217
+ * Send the RTC Offer Session to the Signaling server via websocket
218
+ * @param offer - RTC Session Description
219
+ */
220
+ handleSendWebRTCOffer(offer: RTCSessionDescriptionInit): void;
221
+ /**
222
+ * Send the RTC Offer Session to the Signaling server via websocket
223
+ * @param answer - RTC Session Description
224
+ */
225
+ handleSendWebRTCAnswer(answer: RTCSessionDescriptionInit): void;
226
+ /**
227
+ * Set the freeze frame overlay to the player div
228
+ */
229
+ setUpMouseAndFreezeFrame(): void;
230
+ /**
231
+ * Close the Connection to the signaling server
232
+ */
233
+ closeSignalingServer(message: string): void;
234
+ /**
235
+ * Close the peer connection
236
+ */
237
+ closePeerConnection(): void;
238
+ /**
239
+ * Close all connections
240
+ */
241
+ close(): void;
242
+ /**
243
+ * Fires a Video Stats Event in the RTC Peer Connection
244
+ */
245
+ getStats(): void;
246
+ /**
247
+ * Send a Latency Test Request to the UE Instance
248
+ */
249
+ sendLatencyTest(): void;
250
+ /**
251
+ * Send a Data Channel Latency Test Request to the UE Instance
252
+ */
253
+ sendDataChannelLatencyTest(descriptor: DataChannelLatencyTestRequest): void;
254
+ /**
255
+ * Send the MinQP encoder setting to the UE Instance.
256
+ * @param minQP - The lower bound for QP when encoding
257
+ * valid values are (1-51) where:
258
+ * 1 = Best quality but highest bitrate.
259
+ * 51 = Worst quality but lowest bitrate.
260
+ * By default the minQP is 1 meaning the encoder is free
261
+ * to aim for the best quality it can on the given network link.
262
+ */
263
+ sendEncoderMinQP(minQP: number): void;
264
+ /**
265
+ * Send the MaxQP encoder setting to the UE Instance.
266
+ * @param maxQP - The upper bound for QP when encoding
267
+ * valid values are (1-51) where:
268
+ * 1 = Best quality but highest bitrate.
269
+ * 51 = Worst quality but lowest bitrate.
270
+ * By default the maxQP is 51 meaning the encoder is free
271
+ * to drop quality as low as needed on the given network link.
272
+ */
273
+ sendEncoderMaxQP(maxQP: number): void;
274
+ /**
275
+ * Send the { WebRTC.MinBitrate: SomeNumber }} command to UE to set
276
+ * the minimum bitrate that we allow WebRTC to use
277
+ * (note setting this too high in poor networks can be problematic).
278
+ * @param minBitrate - The minimum bitrate we would like WebRTC to not fall below.
279
+ */
280
+ sendWebRTCMinBitrate(minBitrate: number): void;
281
+ /**
282
+ * Send the { WebRTC.MaxBitrate: SomeNumber }} command to UE to set
283
+ * the minimum bitrate that we allow WebRTC to use
284
+ * (note setting this too low could result in blocky video).
285
+ * @param minBitrate - The minimum bitrate we would like WebRTC to not fall below.
286
+ */
287
+ sendWebRTCMaxBitrate(maxBitrate: number): void;
288
+ /**
289
+ * Send the { WebRTC.Fps: SomeNumber }} UE 5.0+
290
+ * and { WebRTC.MaxFps } UE 4.27 command to set
291
+ * the maximum fps we would like WebRTC to stream at.
292
+ * @param fps - The maximum stream fps.
293
+ */
294
+ sendWebRTCFps(fps: number): void;
295
+ /**
296
+ * Sends the UI Descriptor `stat fps` to the UE Instance
297
+ */
298
+ sendShowFps(): void;
299
+ /**
300
+ * Send an Iframe request to the streamer
301
+ */
302
+ sendIframeRequest(): void;
303
+ /**
304
+ * Send a UIInteraction message
305
+ */
306
+ emitUIInteraction(descriptor: object | string): void;
307
+ /**
308
+ * Send a Command message
309
+ */
310
+ emitCommand(descriptor: object): void;
311
+ /**
312
+ * Send a console command message
313
+ */
314
+ emitConsoleCommand(command: string): void;
315
+ /**
316
+ * Sends a request to the UE Instance to have ownership of Quality
317
+ */
318
+ sendRequestQualityControlOwnership(): void;
319
+ /**
320
+ * Handles when a Latency Test Result are received from the UE Instance
321
+ * @param message - Latency Test Timings
322
+ */
323
+ handleLatencyTestResult(message: ArrayBuffer): void;
324
+ /**
325
+ * Handles when a Data Channel Latency Test Response is received from the UE Instance
326
+ * @param message - Data Channel Latency Test Response
327
+ */
328
+ handleDataChannelLatencyTestResponse(message: ArrayBuffer): void;
329
+ /**
330
+ * Handles when the Encoder and Web RTC Settings are received from the UE Instance
331
+ * @param message - Initial Encoder and Web RTC Settings
332
+ */
333
+ handleInitialSettings(message: ArrayBuffer): void;
334
+ /**
335
+ * Handles when the Quantization Parameter are received from the UE Instance
336
+ * @param message - Encoders Quantization Parameter
337
+ */
338
+ handleVideoEncoderAvgQP(message: ArrayBuffer): void;
339
+ /**
340
+ * Handles when the video element has been loaded with a srcObject
341
+ */
342
+ handleVideoInitialized(): void;
343
+ /**
344
+ * Flag set if the user has Quality Ownership
345
+ * @param message - Does the current client have Quality Ownership
346
+ */
347
+ onQualityControlOwnership(message: ArrayBuffer): void;
348
+ /**
349
+ * Handles when the Aggregated stats are Collected
350
+ * @param stats - Aggregated Stats
351
+ */
352
+ handleVideoStats(stats: AggregatedStats): void;
353
+ /**
354
+ * To Resize the Video Player element
355
+ */
356
+ resizePlayerStyle(): void;
357
+ setPreferredCodec(codec: string): void;
358
+ setVideoEncoderAvgQP(avgQP: number): void;
359
+ /**
360
+ * enables/disables keyboard event listeners
361
+ */
362
+ setKeyboardInputEnabled(isEnabled: boolean): void;
363
+ /**
364
+ * enables/disables mouse event listeners
365
+ */
366
+ setMouseInputEnabled(isEnabled: boolean): void;
367
+ /**
368
+ * enables/disables touch event listeners
369
+ */
370
+ setTouchInputEnabled(isEnabled: boolean): void;
371
+ /**
372
+ * enables/disables game pad event listeners
373
+ */
374
+ setGamePadInputEnabled(isEnabled: boolean): void;
375
+ registerDataChannelEventEmitters(dataChannel: DataChannelController): void;
376
+ registerMessageHandler(name: string, direction: MessageDirection, handler?: (data: ArrayBuffer | Array<number | string>) => void): void;
377
+ }
@@ -0,0 +1,26 @@
1
+ /// <reference types="webxr" />
2
+ import { WebRtcPlayerController } from '../WebRtcPlayer/WebRtcPlayerController';
3
+ export declare class WebXRController {
4
+ private xrSession;
5
+ private xrRefSpace;
6
+ private gl;
7
+ private positionLocation;
8
+ private texcoordLocation;
9
+ private resolutionLocation;
10
+ private offsetLocation;
11
+ private positionBuffer;
12
+ private texcoordBuffer;
13
+ private webRtcController;
14
+ private xrGamepadController;
15
+ private xrControllers;
16
+ onSessionStarted: EventTarget;
17
+ onSessionEnded: EventTarget;
18
+ onFrame: EventTarget;
19
+ constructor(webRtcPlayerController: WebRtcPlayerController);
20
+ xrClicked(): void;
21
+ onXrSessionEnded(): void;
22
+ onXrSessionStarted(session: XRSession): void;
23
+ onXrFrame(time: DOMHighResTimeStamp, frame: XRFrame): void;
24
+ private render;
25
+ static isSessionSupported(mode: XRSessionMode): Promise<boolean>;
26
+ }
@@ -0,0 +1,22 @@
1
+ export { WebRtcPlayerController } from './WebRtcPlayer/WebRtcPlayerController';
2
+ export { WebXRController } from './WebXR/WebXRController';
3
+ export { Config, ControlSchemeType, Flags, NumericParameters, TextParameters, OptionParameters, FlagsIds, NumericParametersIds, TextParametersIds, OptionParametersIds, AllSettings } from './Config/Config';
4
+ export { SettingBase } from './Config/SettingBase';
5
+ export { SettingFlag } from './Config/SettingFlag';
6
+ export { SettingNumber } from './Config/SettingNumber';
7
+ export { SettingOption } from './Config/SettingOption';
8
+ export { SettingText } from './Config/SettingText';
9
+ export { PixelStreaming } from './PixelStreaming/PixelStreaming';
10
+ export { AFKController as AfkLogic } from './AFK/AFKController';
11
+ export { LatencyTestResults } from './DataChannel/LatencyTestResults';
12
+ export { EncoderSettings, InitialSettings, WebRTCSettings } from './DataChannel/InitialSettings';
13
+ export { AggregatedStats } from './PeerConnectionController/AggregatedStats';
14
+ export { UnquantizedDenormalizedUnsignedCoord as UnquantizedAndDenormalizeUnsigned } from './Util/CoordinateConverter';
15
+ export { MessageDirection } from './UeInstanceMessage/StreamMessageController';
16
+ export { CandidatePairStats } from './PeerConnectionController/CandidatePairStats';
17
+ export { CandidateStat } from './PeerConnectionController/CandidateStat';
18
+ export { DataChannelStats } from './PeerConnectionController/DataChannelStats';
19
+ export { InboundAudioStats, InboundVideoStats } from './PeerConnectionController/InboundRTPStats';
20
+ export { OutBoundVideoStats } from './PeerConnectionController/OutBoundRTPStats';
21
+ export * from './Util/EventEmitter';
22
+ export * from '@epicgames-ps/lib-pixelstreamingcommon-ue5.5';
@@ -0,0 +1,35 @@
1
+ // Copyright Epic Games, Inc. All Rights Reserved.
2
+
3
+ const package = require('./package.json');
4
+ const path = require('path');
5
+ const webpack = require('webpack');
6
+
7
+ module.exports = {
8
+ entry: {
9
+ index: './src/pixelstreamingfrontend.ts'
10
+ },
11
+ module: {
12
+ rules: [
13
+ {
14
+ test: /\.tsx?$/,
15
+ loader: 'ts-loader',
16
+ exclude: [/node_modules/]
17
+ }
18
+ ]
19
+ },
20
+ resolve: {
21
+ extensions: ['.tsx', '.ts', '.js']
22
+ },
23
+ externals: {
24
+ sdp: "sdp"
25
+ },
26
+ plugins: [
27
+ new webpack.DefinePlugin({
28
+ LIBRARY_VERSION: JSON.stringify(package.version)
29
+ })
30
+ ],
31
+ output: {
32
+ path: path.resolve(__dirname, 'dist'),
33
+ globalObject: 'this'
34
+ }
35
+ };
package/webpack.dev.js ADDED
@@ -0,0 +1,35 @@
1
+ // Copyright Epic Games, Inc. All Rights Reserved.
2
+
3
+ const { merge } = require('webpack-merge');
4
+ const common = require('./webpack.common.js');
5
+
6
+ const devCommon = {
7
+ mode: 'development',
8
+ devtool: 'inline-source-map',
9
+ devServer: {
10
+ static: './dist',
11
+ }
12
+ };
13
+
14
+ module.exports = [
15
+ merge(common, devCommon, {
16
+ output: {
17
+ filename: 'lib-pixelstreamingfrontend.js',
18
+ library: {
19
+ name: 'lib-pixelstreamingfrontend', // exposed variable that will provide access to the library classes
20
+ type: 'umd'
21
+ },
22
+ },
23
+ }),
24
+ merge(common, devCommon, {
25
+ output: {
26
+ filename: 'lib-pixelstreamingfrontend.esm.js',
27
+ library: {
28
+ type: 'module'
29
+ },
30
+ },
31
+ experiments: {
32
+ outputModule: true
33
+ }
34
+ })
35
+ ];
@@ -0,0 +1,36 @@
1
+ // Copyright Epic Games, Inc. All Rights Reserved.
2
+
3
+ const { merge } = require('webpack-merge');
4
+ const common = require('./webpack.common.js');
5
+
6
+ const prodCommon = {
7
+ mode: 'production',
8
+ optimization: {
9
+ usedExports: true,
10
+ minimize: true
11
+ },
12
+ stats: 'errors-only',
13
+ };
14
+
15
+ module.exports = [
16
+ merge(common, prodCommon, {
17
+ output: {
18
+ filename: 'lib-pixelstreamingfrontend.js',
19
+ library: {
20
+ name: 'lib-pixelstreamingfrontend', // exposed variable that will provide access to the library classes
21
+ type: 'umd'
22
+ },
23
+ },
24
+ }),
25
+ merge(common, prodCommon, {
26
+ output: {
27
+ filename: 'lib-pixelstreamingfrontend.esm.js',
28
+ library: {
29
+ type: 'module'
30
+ },
31
+ },
32
+ experiments: {
33
+ outputModule: true
34
+ }
35
+ })
36
+ ];