@epicgames-ps/lib-pixelstreamingfrontend-ue5.5 0.0.8 → 0.0.10
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 +3 -5
- package/src/Config/Config.ts +30 -30
- package/src/DataChannel/DataChannelLatencyTestController.ts +3 -3
- package/src/Inputs/GamepadController.ts +6 -1
- package/src/UI/OnScreenKeyboard.ts +1 -4
- package/src/WebRtcPlayer/WebRtcPlayerController.ts +20 -22
- package/src/WebXR/WebXRController.ts +1 -1
- package/types/Inputs/GamepadController.d.ts +1 -1
- package/types/WebRtcPlayer/WebRtcPlayerController.d.ts +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@epicgames-ps/lib-pixelstreamingfrontend-ue5.5",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.10",
|
|
4
4
|
"description": "Frontend library for Unreal Engine 5.5 Pixel Streaming",
|
|
5
5
|
"main": "dist/lib-pixelstreamingfrontend.js",
|
|
6
6
|
"module": "dist/lib-pixelstreamingfrontend.esm.js",
|
|
@@ -16,11 +16,10 @@
|
|
|
16
16
|
"spellcheck": "cspell \"{README.md,.github/*.md,src/**/*.ts}\""
|
|
17
17
|
},
|
|
18
18
|
"devDependencies": {
|
|
19
|
-
"@epicgames-ps/lib-pixelstreamingcommon-ue5.5": "^0.0.
|
|
19
|
+
"@epicgames-ps/lib-pixelstreamingcommon-ue5.5": "^0.0.12",
|
|
20
20
|
"@types/jest": "27.5.1",
|
|
21
21
|
"@types/webxr": "^0.5.1",
|
|
22
|
-
"@typescript-eslint/eslint-plugin": "^
|
|
23
|
-
"@typescript-eslint/parser": "^5.16.0",
|
|
22
|
+
"@typescript-eslint/eslint-plugin": "^6.21.0",
|
|
24
23
|
"cspell": "^4.1.0",
|
|
25
24
|
"eslint": "^8.11.0",
|
|
26
25
|
"jest": "^27.5.1",
|
|
@@ -46,4 +45,3 @@
|
|
|
46
45
|
"access": "public"
|
|
47
46
|
}
|
|
48
47
|
}
|
|
49
|
-
|
package/src/Config/Config.ts
CHANGED
|
@@ -181,7 +181,7 @@ export class Config {
|
|
|
181
181
|
TextParameters.SignallingServerUrl,
|
|
182
182
|
'Signalling url',
|
|
183
183
|
'Url of the signalling server',
|
|
184
|
-
settings &&
|
|
184
|
+
settings && Object.prototype.hasOwnProperty.call(settings, TextParameters.SignallingServerUrl) ?
|
|
185
185
|
settings[TextParameters.SignallingServerUrl] :
|
|
186
186
|
(location.protocol === 'https:' ? 'wss://' : 'ws://') +
|
|
187
187
|
window.location.hostname +
|
|
@@ -200,7 +200,7 @@ export class Config {
|
|
|
200
200
|
OptionParameters.StreamerId,
|
|
201
201
|
'Streamer ID',
|
|
202
202
|
'The ID of the streamer to stream.',
|
|
203
|
-
settings &&
|
|
203
|
+
settings && Object.prototype.hasOwnProperty.call(settings, OptionParameters.StreamerId) ?
|
|
204
204
|
settings[OptionParameters.StreamerId] :
|
|
205
205
|
'',
|
|
206
206
|
[],
|
|
@@ -218,7 +218,7 @@ export class Config {
|
|
|
218
218
|
'Preferred Codec',
|
|
219
219
|
'The preferred codec to be used during codec negotiation',
|
|
220
220
|
'H264 level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=42e01f',
|
|
221
|
-
settings &&
|
|
221
|
+
settings && Object.prototype.hasOwnProperty.call(settings, OptionParameters.PreferredCodec) ?
|
|
222
222
|
[settings[OptionParameters.PreferredCodec]] :
|
|
223
223
|
(function (): Array<string> {
|
|
224
224
|
const browserSupportedCodecs: Array<string> = [];
|
|
@@ -257,7 +257,7 @@ export class Config {
|
|
|
257
257
|
Flags.AutoConnect,
|
|
258
258
|
'Auto connect to stream',
|
|
259
259
|
'Whether we should attempt to auto connect to the signalling server or show a click to start prompt.',
|
|
260
|
-
settings &&
|
|
260
|
+
settings && Object.prototype.hasOwnProperty.call(settings, Flags.AutoConnect) ?
|
|
261
261
|
settings[Flags.AutoConnect] :
|
|
262
262
|
false,
|
|
263
263
|
useUrlParams
|
|
@@ -270,7 +270,7 @@ export class Config {
|
|
|
270
270
|
Flags.AutoPlayVideo,
|
|
271
271
|
'Auto play video',
|
|
272
272
|
'When video is ready automatically start playing it as opposed to showing a play button.',
|
|
273
|
-
settings &&
|
|
273
|
+
settings && Object.prototype.hasOwnProperty.call(settings, Flags.AutoPlayVideo) ?
|
|
274
274
|
settings[Flags.AutoPlayVideo] :
|
|
275
275
|
true,
|
|
276
276
|
useUrlParams
|
|
@@ -283,7 +283,7 @@ export class Config {
|
|
|
283
283
|
Flags.BrowserSendOffer,
|
|
284
284
|
'Browser send offer',
|
|
285
285
|
'Browser will initiate the WebRTC handshake by sending the offer to the streamer',
|
|
286
|
-
settings &&
|
|
286
|
+
settings && Object.prototype.hasOwnProperty.call(settings, Flags.BrowserSendOffer) ?
|
|
287
287
|
settings[Flags.BrowserSendOffer] :
|
|
288
288
|
false,
|
|
289
289
|
useUrlParams
|
|
@@ -296,7 +296,7 @@ export class Config {
|
|
|
296
296
|
Flags.UseMic,
|
|
297
297
|
'Use microphone',
|
|
298
298
|
'Make browser request microphone access and open an input audio track.',
|
|
299
|
-
settings &&
|
|
299
|
+
settings && Object.prototype.hasOwnProperty.call(settings, Flags.UseMic) ?
|
|
300
300
|
settings[Flags.UseMic] :
|
|
301
301
|
false,
|
|
302
302
|
useUrlParams
|
|
@@ -309,7 +309,7 @@ export class Config {
|
|
|
309
309
|
Flags.StartVideoMuted,
|
|
310
310
|
'Start video muted',
|
|
311
311
|
'Video will start muted if true.',
|
|
312
|
-
settings &&
|
|
312
|
+
settings && Object.prototype.hasOwnProperty.call(settings, Flags.StartVideoMuted) ?
|
|
313
313
|
settings[Flags.StartVideoMuted] :
|
|
314
314
|
false,
|
|
315
315
|
useUrlParams
|
|
@@ -322,7 +322,7 @@ export class Config {
|
|
|
322
322
|
Flags.SuppressBrowserKeys,
|
|
323
323
|
'Suppress browser keys',
|
|
324
324
|
'Suppress certain browser keys that we use in UE, for example F5 to show shader complexity instead of refresh the page.',
|
|
325
|
-
settings &&
|
|
325
|
+
settings && Object.prototype.hasOwnProperty.call(settings, Flags.SuppressBrowserKeys) ?
|
|
326
326
|
settings[Flags.SuppressBrowserKeys] :
|
|
327
327
|
true,
|
|
328
328
|
useUrlParams
|
|
@@ -335,7 +335,7 @@ export class Config {
|
|
|
335
335
|
Flags.IsQualityController,
|
|
336
336
|
'Is quality controller?',
|
|
337
337
|
'True if this peer controls stream quality',
|
|
338
|
-
settings &&
|
|
338
|
+
settings && Object.prototype.hasOwnProperty.call(settings, Flags.IsQualityController) ?
|
|
339
339
|
settings[Flags.IsQualityController] :
|
|
340
340
|
true,
|
|
341
341
|
useUrlParams
|
|
@@ -348,7 +348,7 @@ export class Config {
|
|
|
348
348
|
Flags.ForceMonoAudio,
|
|
349
349
|
'Force mono audio',
|
|
350
350
|
'Force browser to request mono audio in the SDP',
|
|
351
|
-
settings &&
|
|
351
|
+
settings && Object.prototype.hasOwnProperty.call(settings, Flags.ForceMonoAudio) ?
|
|
352
352
|
settings[Flags.ForceMonoAudio] :
|
|
353
353
|
false,
|
|
354
354
|
useUrlParams
|
|
@@ -361,7 +361,7 @@ export class Config {
|
|
|
361
361
|
Flags.ForceTURN,
|
|
362
362
|
'Force TURN',
|
|
363
363
|
'Only generate TURN/Relayed ICE candidates.',
|
|
364
|
-
settings &&
|
|
364
|
+
settings && Object.prototype.hasOwnProperty.call(settings, Flags.ForceTURN) ?
|
|
365
365
|
settings[Flags.ForceTURN] :
|
|
366
366
|
false,
|
|
367
367
|
useUrlParams
|
|
@@ -374,7 +374,7 @@ export class Config {
|
|
|
374
374
|
Flags.AFKDetection,
|
|
375
375
|
'AFK if idle',
|
|
376
376
|
'Timeout the experience if user is AFK for a period.',
|
|
377
|
-
settings &&
|
|
377
|
+
settings && Object.prototype.hasOwnProperty.call(settings, Flags.AFKDetection) ?
|
|
378
378
|
settings[Flags.AFKDetection] :
|
|
379
379
|
false,
|
|
380
380
|
useUrlParams
|
|
@@ -387,7 +387,7 @@ export class Config {
|
|
|
387
387
|
Flags.MatchViewportResolution,
|
|
388
388
|
'Match viewport resolution',
|
|
389
389
|
'Pixel Streaming will be instructed to dynamically resize the video stream to match the size of the video element.',
|
|
390
|
-
settings &&
|
|
390
|
+
settings && Object.prototype.hasOwnProperty.call(settings, Flags.MatchViewportResolution) ?
|
|
391
391
|
settings[Flags.MatchViewportResolution] :
|
|
392
392
|
false,
|
|
393
393
|
useUrlParams
|
|
@@ -400,7 +400,7 @@ export class Config {
|
|
|
400
400
|
Flags.HoveringMouseMode,
|
|
401
401
|
'Control Scheme: Locked Mouse',
|
|
402
402
|
'Either locked mouse, where the pointer is consumed by the video and locked to it, or hovering mouse, where the mouse is not consumed.',
|
|
403
|
-
settings &&
|
|
403
|
+
settings && Object.prototype.hasOwnProperty.call(settings, Flags.HoveringMouseMode) ?
|
|
404
404
|
settings[Flags.HoveringMouseMode] :
|
|
405
405
|
false,
|
|
406
406
|
useUrlParams,
|
|
@@ -416,7 +416,7 @@ export class Config {
|
|
|
416
416
|
Flags.FakeMouseWithTouches,
|
|
417
417
|
'Fake mouse with touches',
|
|
418
418
|
'A single finger touch is converted into a mouse event. This allows a non-touch application to be controlled partially via a touch device.',
|
|
419
|
-
settings &&
|
|
419
|
+
settings && Object.prototype.hasOwnProperty.call(settings, Flags.FakeMouseWithTouches) ?
|
|
420
420
|
settings[Flags.FakeMouseWithTouches] :
|
|
421
421
|
true,
|
|
422
422
|
useUrlParams
|
|
@@ -429,7 +429,7 @@ export class Config {
|
|
|
429
429
|
Flags.KeyboardInput,
|
|
430
430
|
'Keyboard input',
|
|
431
431
|
'If enabled, send keyboard events to streamer',
|
|
432
|
-
settings &&
|
|
432
|
+
settings && Object.prototype.hasOwnProperty.call(settings, Flags.KeyboardInput) ?
|
|
433
433
|
settings[Flags.KeyboardInput] :
|
|
434
434
|
true,
|
|
435
435
|
useUrlParams
|
|
@@ -442,7 +442,7 @@ export class Config {
|
|
|
442
442
|
Flags.MouseInput,
|
|
443
443
|
'Mouse input',
|
|
444
444
|
'If enabled, send mouse events to streamer',
|
|
445
|
-
settings &&
|
|
445
|
+
settings && Object.prototype.hasOwnProperty.call(settings, Flags.MouseInput) ?
|
|
446
446
|
settings[Flags.MouseInput] :
|
|
447
447
|
true,
|
|
448
448
|
useUrlParams
|
|
@@ -455,7 +455,7 @@ export class Config {
|
|
|
455
455
|
Flags.TouchInput,
|
|
456
456
|
'Touch input',
|
|
457
457
|
'If enabled, send touch events to streamer',
|
|
458
|
-
settings &&
|
|
458
|
+
settings && Object.prototype.hasOwnProperty.call(settings, Flags.TouchInput) ?
|
|
459
459
|
settings[Flags.TouchInput] :
|
|
460
460
|
true,
|
|
461
461
|
useUrlParams
|
|
@@ -468,7 +468,7 @@ export class Config {
|
|
|
468
468
|
Flags.GamepadInput,
|
|
469
469
|
'Gamepad input',
|
|
470
470
|
'If enabled, send gamepad events to streamer',
|
|
471
|
-
settings &&
|
|
471
|
+
settings && Object.prototype.hasOwnProperty.call(settings, Flags.GamepadInput) ?
|
|
472
472
|
settings[Flags.GamepadInput] :
|
|
473
473
|
true,
|
|
474
474
|
useUrlParams
|
|
@@ -481,7 +481,7 @@ export class Config {
|
|
|
481
481
|
Flags.XRControllerInput,
|
|
482
482
|
'XR controller input',
|
|
483
483
|
'If enabled, send XR controller events to streamer',
|
|
484
|
-
settings &&
|
|
484
|
+
settings && Object.prototype.hasOwnProperty.call(settings, Flags.XRControllerInput) ?
|
|
485
485
|
settings[Flags.XRControllerInput] :
|
|
486
486
|
true,
|
|
487
487
|
useUrlParams
|
|
@@ -494,7 +494,7 @@ export class Config {
|
|
|
494
494
|
Flags.WaitForStreamer,
|
|
495
495
|
'Wait for streamer',
|
|
496
496
|
'Will continue trying to connect to the first streamer available.',
|
|
497
|
-
settings &&
|
|
497
|
+
settings && Object.prototype.hasOwnProperty.call(settings, Flags.WaitForStreamer) ?
|
|
498
498
|
settings[Flags.WaitForStreamer] :
|
|
499
499
|
true,
|
|
500
500
|
useUrlParams
|
|
@@ -513,7 +513,7 @@ export class Config {
|
|
|
513
513
|
'The time (in seconds) it takes for the application to time out if AFK timeout is enabled.',
|
|
514
514
|
0 /*min*/,
|
|
515
515
|
600 /*max*/,
|
|
516
|
-
settings &&
|
|
516
|
+
settings && Object.prototype.hasOwnProperty.call(settings, NumericParameters.AFKTimeoutSecs) ?
|
|
517
517
|
settings[NumericParameters.AFKTimeoutSecs] :
|
|
518
518
|
120, /*value*/
|
|
519
519
|
useUrlParams
|
|
@@ -528,7 +528,7 @@ export class Config {
|
|
|
528
528
|
'Maximum number of reconnects the application will attempt when a streamer disconnects.',
|
|
529
529
|
0 /*min*/,
|
|
530
530
|
999 /*max*/,
|
|
531
|
-
settings &&
|
|
531
|
+
settings && Object.prototype.hasOwnProperty.call(settings, NumericParameters.MaxReconnectAttempts) ?
|
|
532
532
|
settings[NumericParameters.MaxReconnectAttempts] :
|
|
533
533
|
3, /*value*/
|
|
534
534
|
useUrlParams
|
|
@@ -543,7 +543,7 @@ export class Config {
|
|
|
543
543
|
'The lower bound for the quantization parameter (QP) of the encoder. 0 = Best quality, 51 = worst quality.',
|
|
544
544
|
0 /*min*/,
|
|
545
545
|
51 /*max*/,
|
|
546
|
-
settings &&
|
|
546
|
+
settings && Object.prototype.hasOwnProperty.call(settings, NumericParameters.MinQP) ?
|
|
547
547
|
settings[NumericParameters.MinQP] :
|
|
548
548
|
0, /*value*/
|
|
549
549
|
useUrlParams
|
|
@@ -558,7 +558,7 @@ export class Config {
|
|
|
558
558
|
'The upper bound for the quantization parameter (QP) of the encoder. 0 = Best quality, 51 = worst quality.',
|
|
559
559
|
0 /*min*/,
|
|
560
560
|
51 /*max*/,
|
|
561
|
-
settings &&
|
|
561
|
+
settings && Object.prototype.hasOwnProperty.call(settings, NumericParameters.MaxQP) ?
|
|
562
562
|
settings[NumericParameters.MaxQP] :
|
|
563
563
|
51, /*value*/
|
|
564
564
|
useUrlParams
|
|
@@ -573,7 +573,7 @@ export class Config {
|
|
|
573
573
|
'The maximum FPS that WebRTC will try to transmit frames at.',
|
|
574
574
|
1 /*min*/,
|
|
575
575
|
999 /*max*/,
|
|
576
|
-
settings &&
|
|
576
|
+
settings && Object.prototype.hasOwnProperty.call(settings, NumericParameters.WebRTCFPS) ?
|
|
577
577
|
settings[NumericParameters.WebRTCFPS] :
|
|
578
578
|
60, /*value*/
|
|
579
579
|
useUrlParams
|
|
@@ -588,7 +588,7 @@ export class Config {
|
|
|
588
588
|
'The minimum bitrate that WebRTC should use.',
|
|
589
589
|
0 /*min*/,
|
|
590
590
|
500000 /*max*/,
|
|
591
|
-
settings &&
|
|
591
|
+
settings && Object.prototype.hasOwnProperty.call(settings, NumericParameters.WebRTCMinBitrate) ?
|
|
592
592
|
settings[NumericParameters.WebRTCMinBitrate] :
|
|
593
593
|
0, /*value*/
|
|
594
594
|
useUrlParams
|
|
@@ -603,7 +603,7 @@ export class Config {
|
|
|
603
603
|
'The maximum bitrate that WebRTC should use.',
|
|
604
604
|
0 /*min*/,
|
|
605
605
|
500000 /*max*/,
|
|
606
|
-
settings &&
|
|
606
|
+
settings && Object.prototype.hasOwnProperty.call(settings, NumericParameters.WebRTCMaxBitrate) ?
|
|
607
607
|
settings[NumericParameters.WebRTCMaxBitrate] :
|
|
608
608
|
0, /*value*/
|
|
609
609
|
useUrlParams
|
|
@@ -618,7 +618,7 @@ export class Config {
|
|
|
618
618
|
'Delay between retries when waiting for an available streamer.',
|
|
619
619
|
500 /*min*/,
|
|
620
620
|
900000 /*max*/,
|
|
621
|
-
settings &&
|
|
621
|
+
settings && Object.prototype.hasOwnProperty.call(settings, NumericParameters.StreamerAutoJoinInterval) ?
|
|
622
622
|
settings[NumericParameters.StreamerAutoJoinInterval] :
|
|
623
623
|
3000, /*value*/
|
|
624
624
|
useUrlParams
|
|
@@ -105,15 +105,15 @@ export class DataChannelLatencyTestController {
|
|
|
105
105
|
);
|
|
106
106
|
return;
|
|
107
107
|
}
|
|
108
|
-
|
|
108
|
+
const record = this.records.get(response.Seq);
|
|
109
109
|
if (record) {
|
|
110
110
|
record.update(response);
|
|
111
111
|
}
|
|
112
112
|
}
|
|
113
113
|
|
|
114
114
|
sendRequest(requestSize: number, responseSize: number) {
|
|
115
|
-
|
|
116
|
-
|
|
115
|
+
const request = this.createRequest(requestSize, responseSize);
|
|
116
|
+
const record = new DataChannelLatencyTestRecord(request);
|
|
117
117
|
this.records.set(record.seq, record);
|
|
118
118
|
this.sink(request);
|
|
119
119
|
}
|
|
@@ -260,7 +260,7 @@ export class GamePadController {
|
|
|
260
260
|
// Default Functionality: Do Nothing
|
|
261
261
|
}
|
|
262
262
|
|
|
263
|
-
onBeforeUnload(
|
|
263
|
+
onBeforeUnload(_: Event) {
|
|
264
264
|
// When a user navigates away from the page, we need to inform UE of all the disconnecting
|
|
265
265
|
// controllers
|
|
266
266
|
for(const controller of this.controllers) {
|
|
@@ -285,6 +285,8 @@ declare global {
|
|
|
285
285
|
}
|
|
286
286
|
}
|
|
287
287
|
|
|
288
|
+
/* eslint-disable @typescript-eslint/no-duplicate-enum-values */
|
|
289
|
+
|
|
288
290
|
/**
|
|
289
291
|
* Gamepad layout codes enum
|
|
290
292
|
*/
|
|
@@ -312,3 +314,6 @@ export enum gamepadLayout {
|
|
|
312
314
|
RightStickHorizontal = 2,
|
|
313
315
|
RightStickVertical = 3
|
|
314
316
|
}
|
|
317
|
+
|
|
318
|
+
/* eslint-enable @typescript-eslint/no-duplicate-enum-values */
|
|
319
|
+
|
|
@@ -35,10 +35,7 @@ export class OnScreenKeyboard {
|
|
|
35
35
|
* @returns unquantizeAndDenormalizeUnsigned object
|
|
36
36
|
*/
|
|
37
37
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
38
|
-
unquantizeAndDenormalizeUnsigned(
|
|
39
|
-
x: number,
|
|
40
|
-
y: number
|
|
41
|
-
): UnquantizedDenormalizedUnsignedCoord {
|
|
38
|
+
unquantizeAndDenormalizeUnsigned(x: number, y: number): UnquantizedDenormalizedUnsignedCoord {
|
|
42
39
|
return null;
|
|
43
40
|
}
|
|
44
41
|
|
|
@@ -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,
|
|
@@ -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
|
|
@@ -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
|