@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,53 @@
1
+ import { CoordinateConverter } from '../Util/CoordinateConverter';
2
+ import { StreamMessageController } from '../UeInstanceMessage/StreamMessageController';
3
+ import { VideoPlayer } from '../VideoPlayer/VideoPlayer';
4
+ import { ITouchController } from './ITouchController';
5
+ /**
6
+ * Handles the Touch input Events
7
+ */
8
+ export declare class TouchController implements ITouchController {
9
+ toStreamerMessagesProvider: StreamMessageController;
10
+ videoElementProvider: VideoPlayer;
11
+ coordinateConverter: CoordinateConverter;
12
+ videoElementParent: HTMLVideoElement;
13
+ fingers: number[];
14
+ fingerIds: Map<any, any>;
15
+ maxByteValue: number;
16
+ private touchEventListenerTracker;
17
+ /**
18
+ * @param toStreamerMessagesProvider - Stream message instance
19
+ * @param videoElementProvider - Video Player instance
20
+ * @param coordinateConverter - A coordinate converter instance
21
+ */
22
+ constructor(toStreamerMessagesProvider: StreamMessageController, videoElementProvider: VideoPlayer, coordinateConverter: CoordinateConverter);
23
+ /**
24
+ * Unregister all touch events
25
+ */
26
+ unregisterTouchEvents(): void;
27
+ /**
28
+ * Remember a touch command
29
+ * @param touch - the touch command
30
+ */
31
+ rememberTouch(touch: Touch): void;
32
+ /**
33
+ * Forgets a touch command
34
+ * @param touch - the touch command
35
+ */
36
+ forgetTouch(touch: Touch): void;
37
+ /**
38
+ * When a touch event starts
39
+ * @param touchEvent - the touch event being intercepted
40
+ */
41
+ onTouchStart(touchEvent: TouchEvent): void;
42
+ /**
43
+ * When a touch event ends
44
+ * @param touchEvent - the touch event being intercepted
45
+ */
46
+ onTouchEnd(touchEvent: TouchEvent): void;
47
+ /**
48
+ * when a moving touch event occurs
49
+ * @param touchEvent - the touch event being intercepted
50
+ */
51
+ onTouchMove(touchEvent: TouchEvent): void;
52
+ emitTouchData(type: string, touches: TouchList): void;
53
+ }
@@ -0,0 +1,15 @@
1
+ /// <reference types="webxr" />
2
+ import { StreamMessageController } from '../UeInstanceMessage/StreamMessageController';
3
+ import { Controller } from './GamepadTypes';
4
+ /**
5
+ * The class that handles the functionality of xrgamepads and controllers
6
+ */
7
+ export declare class XRGamepadController {
8
+ controllers: Array<Controller>;
9
+ toStreamerMessagesProvider: StreamMessageController;
10
+ /**
11
+ * @param toStreamerMessagesProvider - Stream message instance
12
+ */
13
+ constructor(toStreamerMessagesProvider: StreamMessageController);
14
+ updateStatus(source: XRInputSource, frame: XRFrame, refSpace: XRReferenceSpace): void;
15
+ }
@@ -0,0 +1,77 @@
1
+ import { InboundRTPStats, InboundVideoStats, InboundAudioStats } from './InboundRTPStats';
2
+ import { InboundTrackStats } from './InboundTrackStats';
3
+ import { DataChannelStats } from './DataChannelStats';
4
+ import { CandidateStat } from './CandidateStat';
5
+ import { CandidatePairStats } from './CandidatePairStats';
6
+ import { OutBoundRTPStats, OutBoundVideoStats } from './OutBoundRTPStats';
7
+ import { SessionStats } from './SessionStats';
8
+ import { StreamStats } from './StreamStats';
9
+ import { CodecStats } from './CodecStats';
10
+ export declare class AggregatedStats {
11
+ inboundVideoStats: InboundVideoStats;
12
+ inboundAudioStats: InboundAudioStats;
13
+ lastVideoStats: InboundVideoStats;
14
+ lastAudioStats: InboundAudioStats;
15
+ candidatePair: CandidatePairStats;
16
+ DataChannelStats: DataChannelStats;
17
+ localCandidates: Array<CandidateStat>;
18
+ remoteCandidates: Array<CandidateStat>;
19
+ outBoundVideoStats: OutBoundVideoStats;
20
+ sessionStats: SessionStats;
21
+ streamStats: StreamStats;
22
+ codecs: Map<string, string>;
23
+ constructor();
24
+ /**
25
+ * Gather all the information from the RTC Peer Connection Report
26
+ * @param rtcStatsReport - RTC Stats Report
27
+ */
28
+ processStats(rtcStatsReport: RTCStatsReport): void;
29
+ /**
30
+ * Process stream stats data from webrtc
31
+ *
32
+ * @param stat - the stats coming in from webrtc
33
+ */
34
+ handleStream(stat: StreamStats): void;
35
+ /**
36
+ * Process the Ice Candidate Pair Data
37
+ * @param stat - the stats coming in from ice candidates
38
+ */
39
+ handleCandidatePair(stat: CandidatePairStats): void;
40
+ /**
41
+ * Process the Data Channel Data
42
+ * @param stat - the stats coming in from the data channel
43
+ */
44
+ handleDataChannel(stat: DataChannelStats): void;
45
+ /**
46
+ * Process the Local Ice Candidate Data
47
+ * @param stat - local stats
48
+ */
49
+ handleLocalCandidate(stat: CandidateStat): void;
50
+ /**
51
+ * Process the Remote Ice Candidate Data
52
+ * @param stat - ice candidate stats
53
+ */
54
+ handleRemoteCandidate(stat: CandidateStat): void;
55
+ /**
56
+ * Process the Inbound RTP Audio and Video Data
57
+ * @param stat - inbound rtp stats
58
+ */
59
+ handleInBoundRTP(stat: InboundRTPStats): void;
60
+ /**
61
+ * Process the outbound RTP Audio and Video Data
62
+ * @param stat - remote outbound stats
63
+ */
64
+ handleRemoteOutBound(stat: OutBoundRTPStats): void;
65
+ /**
66
+ * Process the Inbound Video Track Data
67
+ * @param stat - video track stats
68
+ */
69
+ handleTrack(stat: InboundTrackStats): void;
70
+ handleCodec(stat: CodecStats): void;
71
+ handleSessionStatistics(videoStartTime: number, inputController: boolean | null, videoEncoderAvgQP: number): void;
72
+ /**
73
+ * Check if a value coming in from our stats is actually a number
74
+ * @param value - the number to be checked
75
+ */
76
+ isNumber(value: unknown): boolean;
77
+ }
@@ -0,0 +1,15 @@
1
+ /**
2
+ * ICE Candidate Pair Stats collected from the RTC Stats Report
3
+ */
4
+ export declare class CandidatePairStats {
5
+ bytesReceived: number;
6
+ bytesSent: number;
7
+ localCandidateId: string;
8
+ remoteCandidateId: string;
9
+ nominated: boolean;
10
+ readable: boolean;
11
+ writable: boolean;
12
+ selected: boolean;
13
+ state: string;
14
+ currentRoundTripTime: number;
15
+ }
@@ -0,0 +1,11 @@
1
+ /**
2
+ * ICE Candidate Stat collected from the RTC Stats Report
3
+ */
4
+ export declare class CandidateStat {
5
+ label: string;
6
+ id: string;
7
+ address: string;
8
+ candidateType: string;
9
+ port: number;
10
+ protocol: 'tcp' | 'udp';
11
+ }
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Codec Stats collected from the RTC Stats Report
3
+ */
4
+ export declare class CodecStats {
5
+ clockRate: number;
6
+ id: string;
7
+ mimeType: string;
8
+ payloadType: number;
9
+ sdpFmtpLine: string;
10
+ timestamp: number;
11
+ transportId: string;
12
+ type: string;
13
+ channels: number;
14
+ }
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Data Channel Stats collected from the RTC Stats Report
3
+ */
4
+ export declare class DataChannelStats {
5
+ bytesReceived: number;
6
+ bytesSent: number;
7
+ dataChannelIdentifier: number;
8
+ id: string;
9
+ label: string;
10
+ messagesReceived: number;
11
+ messagesSent: number;
12
+ protocol: string;
13
+ state: string;
14
+ timestamp: number;
15
+ }
@@ -0,0 +1,141 @@
1
+ /**
2
+ * Inbound Audio Stats collected from the RTC Stats Report
3
+ */
4
+ export declare class InboundAudioStats {
5
+ audioLevel: number;
6
+ bytesReceived: number;
7
+ codecId: string;
8
+ concealedSamples: number;
9
+ concealmentEvents: number;
10
+ fecPacketsDiscarded: number;
11
+ fecPacketsReceived: number;
12
+ headerBytesReceived: number;
13
+ id: string;
14
+ insertedSamplesForDeceleration: number;
15
+ jitter: number;
16
+ jitterBufferDelay: number;
17
+ jitterBufferEmittedCount: number;
18
+ jitterBufferMinimumDelay: number;
19
+ jitterBufferTargetDelay: number;
20
+ kind: string;
21
+ lastPacketReceivedTimestamp: number;
22
+ mediaType: string;
23
+ mid: string;
24
+ packetsDiscarded: number;
25
+ packetsLost: number;
26
+ packetsReceived: number;
27
+ removedSamplesForAcceleration: number;
28
+ silentConcealedSamples: number;
29
+ ssrc: number;
30
+ timestamp: number;
31
+ totalAudioEnergy: number;
32
+ totalSamplesDuration: number;
33
+ totalSamplesReceived: number;
34
+ trackIdentifier: string;
35
+ transportId: string;
36
+ type: string;
37
+ bitrate: number;
38
+ }
39
+ /**
40
+ * Inbound Video Stats collected from the RTC Stats Report
41
+ */
42
+ export declare class InboundVideoStats {
43
+ bytesReceived: number;
44
+ codecId: string;
45
+ firCount: number;
46
+ frameHeight: number;
47
+ frameWidth: number;
48
+ framesAssembledFromMultiplePackets: number;
49
+ framesDecoded: number;
50
+ framesDropped: number;
51
+ framesPerSecond: number;
52
+ framesReceived: number;
53
+ freezeCount: number;
54
+ googTimingFrameInfo: string;
55
+ headerBytesReceived: number;
56
+ id: string;
57
+ jitter: number;
58
+ jitterBufferDelay: number;
59
+ jitterBufferEmittedCount: number;
60
+ keyFramesDecoded: number;
61
+ kind: string;
62
+ lastPacketReceivedTimestamp: number;
63
+ mediaType: string;
64
+ mid: string;
65
+ nackCount: number;
66
+ packetsLost: number;
67
+ packetsReceived: number;
68
+ pauseCount: number;
69
+ pliCount: number;
70
+ ssrc: number;
71
+ timestamp: number;
72
+ totalAssemblyTime: number;
73
+ totalDecodeTime: number;
74
+ totalFreezesDuration: number;
75
+ totalInterFrameDelay: number;
76
+ totalPausesDuration: number;
77
+ totalProcessingDelay: number;
78
+ totalSquaredInterFrameDelay: number;
79
+ trackIdentifier: string;
80
+ transportId: string;
81
+ type: string;
82
+ bitrate: number;
83
+ }
84
+ /**
85
+ * Inbound Stats collected from the RTC Stats Report
86
+ */
87
+ export declare class InboundRTPStats {
88
+ bytesReceived: number;
89
+ codecId: string;
90
+ headerBytesReceived: number;
91
+ id: string;
92
+ jitter: number;
93
+ jitterBufferDelay: number;
94
+ jitterBufferEmittedCount: number;
95
+ kind: string;
96
+ lastPacketReceivedTimestamp: number;
97
+ mediaType: string;
98
+ mid: string;
99
+ packetsLost: number;
100
+ packetsReceived: number;
101
+ ssrc: number;
102
+ timestamp: number;
103
+ trackIdentifier: string;
104
+ transportId: string;
105
+ type: string;
106
+ audioLevel: number;
107
+ concealedSamples: number;
108
+ concealmentEvents: number;
109
+ fecPacketsDiscarded: number;
110
+ fecPacketsReceived: number;
111
+ insertedSamplesForDeceleration: number;
112
+ jitterBufferMinimumDelay: number;
113
+ jitterBufferTargetDelay: number;
114
+ packetsDiscarded: number;
115
+ removedSamplesForAcceleration: number;
116
+ silentConcealedSamples: number;
117
+ totalAudioEnergy: number;
118
+ totalSamplesDuration: number;
119
+ totalSamplesReceived: number;
120
+ firCount: number;
121
+ frameHeight: number;
122
+ frameWidth: number;
123
+ framesAssembledFromMultiplePackets: number;
124
+ framesDecoded: number;
125
+ framesDropped: number;
126
+ framesPerSecond: number;
127
+ framesReceived: number;
128
+ freezeCount: number;
129
+ googTimingFrameInfo: string;
130
+ keyFramesDecoded: number;
131
+ nackCount: number;
132
+ pauseCount: number;
133
+ pliCount: number;
134
+ totalAssemblyTime: number;
135
+ totalDecodeTime: number;
136
+ totalFreezesDuration: number;
137
+ totalInterFrameDelay: number;
138
+ totalPausesDuration: number;
139
+ totalProcessingDelay: number;
140
+ totalSquaredInterFrameDelay: number;
141
+ }
@@ -0,0 +1,32 @@
1
+ /**
2
+ * Inbound Track Stats collected from the RTC Stats Report
3
+ */
4
+ export declare class InboundTrackStats {
5
+ type: string;
6
+ kind: string;
7
+ trackIdentifier: string;
8
+ receiveToCompositeMs: number;
9
+ timestamp: number;
10
+ bytesReceived: number;
11
+ framesDecoded: number;
12
+ packetsLost: number;
13
+ bytesReceivedStart: number;
14
+ framesDecodedStart: number;
15
+ timestampStart: number;
16
+ bitrate: number;
17
+ lowBitrate: number;
18
+ highBitrate: number;
19
+ avgBitrate: number;
20
+ framerate: number;
21
+ lowFramerate: number;
22
+ highFramerate: number;
23
+ averageFrameRate: number;
24
+ framesDropped: number;
25
+ framesReceived: number;
26
+ framesDroppedPercentage: number;
27
+ frameHeight: number;
28
+ frameWidth: number;
29
+ frameHeightStart: number;
30
+ frameWidthStart: number;
31
+ jitter: number;
32
+ }
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Outbound Video Stats collected from the RTC Stats Report
3
+ */
4
+ export declare class OutBoundVideoStats {
5
+ bytesSent: number;
6
+ id: string;
7
+ localId: string;
8
+ packetsSent: number;
9
+ remoteTimestamp: number;
10
+ timestamp: number;
11
+ }
12
+ /**
13
+ * Outbound Stats collected from the RTC Stats Report
14
+ */
15
+ export declare class OutBoundRTPStats {
16
+ kind: string;
17
+ bytesSent: number;
18
+ id: string;
19
+ localId: string;
20
+ packetsSent: number;
21
+ remoteTimestamp: number;
22
+ timestamp: number;
23
+ }
@@ -0,0 +1,132 @@
1
+ import { Config } from '../Config/Config';
2
+ import { AggregatedStats } from './AggregatedStats';
3
+ /**
4
+ * Handles the Peer Connection
5
+ */
6
+ export declare class PeerConnectionController {
7
+ peerConnection: RTCPeerConnection;
8
+ aggregatedStats: AggregatedStats;
9
+ config: Config;
10
+ preferredCodec: string;
11
+ updateCodecSelection: boolean;
12
+ /**
13
+ * Create a new RTC Peer Connection client
14
+ * @param options - Peer connection Options
15
+ * @param config - The config for our PS experience.
16
+ */
17
+ constructor(options: RTCConfiguration, config: Config, preferredCodec: string);
18
+ createPeerConnection(options: RTCConfiguration, preferredCodec: string): void;
19
+ /**
20
+ * Create an offer for the Web RTC handshake and send the offer to the signaling server via websocket
21
+ * @param offerOptions - RTC Offer Options
22
+ */
23
+ createOffer(offerOptions: RTCOfferOptions, config: Config): Promise<void>;
24
+ /**
25
+ *
26
+ */
27
+ receiveOffer(offer: RTCSessionDescriptionInit, config: Config): Promise<void>;
28
+ /**
29
+ * Set the Remote Descriptor from the signaling server to the RTC Peer Connection
30
+ * @param answer - RTC Session Descriptor from the Signaling Server
31
+ */
32
+ receiveAnswer(answer: RTCSessionDescriptionInit): void;
33
+ /**
34
+ * Generate Aggregated Stats and then fire a onVideo Stats event
35
+ */
36
+ generateStats(): void;
37
+ /**
38
+ * Close The Peer Connection
39
+ */
40
+ close(): void;
41
+ /**
42
+ * Modify the Session Descriptor
43
+ * @param sdp - Session Descriptor as a string
44
+ * @param useMic - Is the microphone in use
45
+ * @returns A modified Session Descriptor
46
+ */
47
+ mungeSDP(sdp: string, useMic: boolean): string;
48
+ /**
49
+ * When a Ice Candidate is received add to the RTC Peer Connection
50
+ * @param iceCandidate - RTC Ice Candidate from the Signaling Server
51
+ */
52
+ handleOnIce(iceCandidate: RTCIceCandidate): void;
53
+ /**
54
+ * When the RTC Peer Connection Signaling server state Changes
55
+ * @param state - Signaling Server State Change Event
56
+ */
57
+ handleSignalStateChange(state: Event): void;
58
+ /**
59
+ * Handle when the Ice Connection State Changes
60
+ * @param state - Ice Connection State
61
+ */
62
+ handleIceConnectionStateChange(state: Event): void;
63
+ /**
64
+ * Handle when the Ice Gathering State Changes
65
+ * @param state - Ice Gathering State Change
66
+ */
67
+ handleIceGatheringStateChange(state: Event): void;
68
+ /**
69
+ * Activates the onTrack method
70
+ * @param event - The webRtc track event
71
+ */
72
+ handleOnTrack(event: RTCTrackEvent): void;
73
+ /**
74
+ * Activates the onPeerIceCandidate
75
+ * @param event - The peer ice candidate
76
+ */
77
+ handleIceCandidate(event: RTCPeerConnectionIceEvent): void;
78
+ /**
79
+ * Activates the onDataChannel
80
+ * @param event - The peer's data channel
81
+ */
82
+ handleDataChannel(event: RTCDataChannelEvent): void;
83
+ /**
84
+ * An override method for onTrack for use outside of the PeerConnectionController
85
+ * @param trackEvent - The webRtc track event
86
+ */
87
+ onTrack(trackEvent: RTCTrackEvent): void;
88
+ /**
89
+ * An override method for onIceConnectionStateChange for use outside of the PeerConnectionController
90
+ * @param event - The webRtc iceconnectionstatechange event
91
+ */
92
+ onIceConnectionStateChange(event: Event): void;
93
+ /**
94
+ * An override method for onPeerIceCandidate for use outside of the PeerConnectionController
95
+ * @param peerConnectionIceEvent - The peer ice candidate
96
+ */
97
+ onPeerIceCandidate(peerConnectionIceEvent: RTCPeerConnectionIceEvent): void;
98
+ /**
99
+ * An override method for onDataChannel for use outside of the PeerConnectionController
100
+ * @param datachannelEvent - The peer's data channel
101
+ */
102
+ onDataChannel(datachannelEvent: RTCDataChannelEvent): void;
103
+ /**
104
+ * Setup tracks on the RTC Peer Connection
105
+ * @param useMic - is mic in use
106
+ */
107
+ setupTransceiversAsync(useMic: boolean): Promise<void>;
108
+ /**
109
+ * And override event for when the video stats are fired
110
+ * @param event - Aggregated Stats
111
+ */
112
+ onVideoStats(event: AggregatedStats): void;
113
+ /**
114
+ * Event to send the RTC offer to the Signaling server
115
+ * @param offer - RTC Offer
116
+ */
117
+ onSendWebRTCOffer(offer: RTCSessionDescriptionInit): void;
118
+ /**
119
+ * Event to send the RTC Answer to the Signaling server
120
+ * @param answer - RTC Answer
121
+ */
122
+ onSendWebRTCAnswer(answer: RTCSessionDescriptionInit): void;
123
+ /**
124
+ * An override for showing the Peer connection connecting Overlay
125
+ */
126
+ showTextOverlayConnecting(): void;
127
+ /**
128
+ * An override for showing the Peer connection Failed overlay
129
+ */
130
+ showTextOverlaySetupFailure(): void;
131
+ parseAvailableCodecs(rtcSessionDescription: RTCSessionDescriptionInit): Array<string>;
132
+ }
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Session statistics
3
+ */
4
+ export declare class SessionStats {
5
+ runTime: string;
6
+ controlsStreamInput: string;
7
+ videoEncoderAvgQP: number;
8
+ }
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Class to hold the stream stats data coming in from webRtc
3
+ */
4
+ export declare class StreamStats {
5
+ id: string;
6
+ streamIdentifier: string;
7
+ timestamp: number;
8
+ trackIds: string[];
9
+ }