@yang__yj/pixelstreaming-core 1.0.0

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 (65) hide show
  1. package/library/dist/lib-pixelstreamingfrontend.esm.js +1 -0
  2. package/library/dist/lib-pixelstreamingfrontend.js +1 -0
  3. package/library/types/AFK/AFKController.d.ts +39 -0
  4. package/library/types/Config/Config.d.ts +217 -0
  5. package/library/types/Config/SettingBase.d.ts +30 -0
  6. package/library/types/Config/SettingFlag.d.ts +33 -0
  7. package/library/types/Config/SettingNumber.d.ts +45 -0
  8. package/library/types/Config/SettingOption.d.ts +43 -0
  9. package/library/types/Config/SettingText.d.ts +29 -0
  10. package/library/types/DataChannel/DataChannelController.d.ts +59 -0
  11. package/library/types/DataChannel/DataChannelSender.d.ts +21 -0
  12. package/library/types/DataChannel/InitialSettings.d.ts +44 -0
  13. package/library/types/DataChannel/LatencyTestResults.d.ts +31 -0
  14. package/library/types/FreezeFrame/FreezeFrame.d.ts +36 -0
  15. package/library/types/FreezeFrame/FreezeFrameController.d.ts +37 -0
  16. package/library/types/Inputs/FakeTouchController.d.ts +61 -0
  17. package/library/types/Inputs/GamepadController.d.ts +84 -0
  18. package/library/types/Inputs/GamepadTypes.d.ts +8 -0
  19. package/library/types/Inputs/HoveringMouseEvents.d.ts +56 -0
  20. package/library/types/Inputs/IMouseEvents.d.ts +53 -0
  21. package/library/types/Inputs/ITouchController.d.ts +24 -0
  22. package/library/types/Inputs/InputClassesFactory.d.ts +54 -0
  23. package/library/types/Inputs/KeyboardController.d.ts +57 -0
  24. package/library/types/Inputs/LockedMouseEvents.d.ts +80 -0
  25. package/library/types/Inputs/MouseButtons.d.ts +22 -0
  26. package/library/types/Inputs/MouseController.d.ts +75 -0
  27. package/library/types/Inputs/SpecialKeyCodes.d.ts +14 -0
  28. package/library/types/Inputs/TouchController.d.ts +53 -0
  29. package/library/types/Inputs/XRGamepadController.d.ts +15 -0
  30. package/library/types/Logger/Logger.d.ts +38 -0
  31. package/library/types/PeerConnectionController/AggregatedStats.d.ts +77 -0
  32. package/library/types/PeerConnectionController/CandidatePairStats.d.ts +15 -0
  33. package/library/types/PeerConnectionController/CandidateStat.d.ts +11 -0
  34. package/library/types/PeerConnectionController/CodecStats.d.ts +14 -0
  35. package/library/types/PeerConnectionController/DataChannelStats.d.ts +15 -0
  36. package/library/types/PeerConnectionController/InboundRTPStats.d.ts +141 -0
  37. package/library/types/PeerConnectionController/InboundTrackStats.d.ts +32 -0
  38. package/library/types/PeerConnectionController/OutBoundRTPStats.d.ts +23 -0
  39. package/library/types/PeerConnectionController/PeerConnectionController.d.ts +132 -0
  40. package/library/types/PeerConnectionController/SessionStats.d.ts +8 -0
  41. package/library/types/PeerConnectionController/StreamStats.d.ts +9 -0
  42. package/library/types/PixelStreaming/PixelStreaming.d.ts +234 -0
  43. package/library/types/UI/OnScreenKeyboard.d.ts +31 -0
  44. package/library/types/UeInstanceMessage/ResponseController.d.ts +19 -0
  45. package/library/types/UeInstanceMessage/SendDescriptorController.d.ts +28 -0
  46. package/library/types/UeInstanceMessage/SendMessageController.d.ts +18 -0
  47. package/library/types/UeInstanceMessage/StreamMessageController.d.ts +31 -0
  48. package/library/types/UeInstanceMessage/ToStreamerMessagesController.d.ts +32 -0
  49. package/library/types/UeInstanceMessage/TwoWayMap.d.ts +32 -0
  50. package/library/types/Util/CoordinateConverter.d.ts +100 -0
  51. package/library/types/Util/EventEmitter.d.ts +374 -0
  52. package/library/types/Util/EventListenerTracker.d.ts +14 -0
  53. package/library/types/Util/FileUtil.d.ts +32 -0
  54. package/library/types/Util/WebGLUtils.d.ts +4 -0
  55. package/library/types/Util/WebXRUtils.d.ts +9 -0
  56. package/library/types/VideoPlayer/StreamController.d.ts +24 -0
  57. package/library/types/VideoPlayer/VideoPlayer.d.ts +76 -0
  58. package/library/types/WebRtcPlayer/WebRtcPlayerController.d.ts +374 -0
  59. package/library/types/WebSockets/MessageReceive.d.ts +78 -0
  60. package/library/types/WebSockets/MessageSend.d.ts +98 -0
  61. package/library/types/WebSockets/SignallingProtocol.d.ts +15 -0
  62. package/library/types/WebSockets/WebSocketController.d.ts +96 -0
  63. package/library/types/WebXR/WebXRController.d.ts +26 -0
  64. package/library/types/pixelstreamingfrontend.d.ts +25 -0
  65. package/package.json +18 -0
@@ -0,0 +1,76 @@
1
+ import { Config } from '../Config/Config';
2
+ /**
3
+ * Extra types for the HTMLElement
4
+ */
5
+ declare global {
6
+ interface HTMLElement {
7
+ mozRequestPointerLock?(): void;
8
+ }
9
+ }
10
+ /**
11
+ * The video player html element
12
+ */
13
+ export declare class VideoPlayer {
14
+ private config;
15
+ private videoElement;
16
+ private orientationChangeTimeout;
17
+ private lastTimeResized;
18
+ onMatchViewportResolutionCallback: (width: number, height: number) => void;
19
+ onResizePlayerCallback: () => void;
20
+ resizeTimeoutHandle: number;
21
+ /**
22
+ * @param videoElementParent the html div the the video player will be injected into
23
+ * @param config the applications configuration. We're interested in the startVideoMuted flag
24
+ */
25
+ constructor(videoElementParent: HTMLElement, config: Config);
26
+ /**
27
+ * Sets up the video element with any application config and plays the video element.
28
+ * @returns A promise for if playing the video was successful or not.
29
+ */
30
+ play(): Promise<void>;
31
+ /**
32
+ * @returns True if the video element is paused.
33
+ */
34
+ isPaused(): boolean;
35
+ /**
36
+ * @returns - whether the video element is playing.
37
+ */
38
+ isVideoReady(): boolean;
39
+ /**
40
+ * @returns True if the video element has a valid video source (srcObject).
41
+ */
42
+ hasVideoSource(): boolean;
43
+ /**
44
+ * Get the current context of the html video element
45
+ * @returns - the current context of the video element
46
+ */
47
+ getVideoElement(): HTMLVideoElement;
48
+ /**
49
+ * Get the current context of the html video elements parent
50
+ * @returns - the current context of the video elements parent
51
+ */
52
+ getVideoParentElement(): HTMLElement;
53
+ /**
54
+ * Set the Video Elements src object tracks to enable
55
+ * @param enabled - Enable Tracks on the Src Object
56
+ */
57
+ setVideoEnabled(enabled: boolean): void;
58
+ /**
59
+ * An override for when the video has been initialized with a srcObject
60
+ */
61
+ onVideoInitialized(): void;
62
+ /**
63
+ * On the orientation change of a window clear the timeout
64
+ */
65
+ onOrientationChange(): void;
66
+ /**
67
+ * Resizes the player style based on the window height and width
68
+ * @returns - nil if requirements are satisfied
69
+ */
70
+ resizePlayerStyle(): void;
71
+ /**
72
+ * Resizes the player element to fill the parent element
73
+ */
74
+ resizePlayerStyleToFillParentElement(): void;
75
+ updateVideoStreamSize(): void;
76
+ }
@@ -0,0 +1,374 @@
1
+ import { WebSocketController } from '../WebSockets/WebSocketController';
2
+ import { StreamController } from '../VideoPlayer/StreamController';
3
+ import { MessageAnswer, MessageOffer, MessageConfig, MessageStreamerList } from '../WebSockets/MessageReceive';
4
+ import { FreezeFrameController } from '../FreezeFrame/FreezeFrameController';
5
+ import { AFKController } from '../AFK/AFKController';
6
+ import { DataChannelController } from '../DataChannel/DataChannelController';
7
+ import { PeerConnectionController } from '../PeerConnectionController/PeerConnectionController';
8
+ import { KeyboardController } from '../Inputs/KeyboardController';
9
+ import { AggregatedStats } from '../PeerConnectionController/AggregatedStats';
10
+ import { Config } from '../Config/Config';
11
+ import { FileTemplate } from '../Util/FileUtil';
12
+ import { InputClassesFactory } from '../Inputs/InputClassesFactory';
13
+ import { VideoPlayer } from '../VideoPlayer/VideoPlayer';
14
+ import { StreamMessageController } from '../UeInstanceMessage/StreamMessageController';
15
+ import { ResponseController } from '../UeInstanceMessage/ResponseController';
16
+ import * as MessageReceive from '../WebSockets/MessageReceive';
17
+ import { SendDescriptorController } from '../UeInstanceMessage/SendDescriptorController';
18
+ import { SendMessageController } from '../UeInstanceMessage/SendMessageController';
19
+ import { ToStreamerMessagesController } from '../UeInstanceMessage/ToStreamerMessagesController';
20
+ import { MouseController } from '../Inputs/MouseController';
21
+ import { GamePadController } from '../Inputs/GamepadController';
22
+ import { DataChannelSender } from '../DataChannel/DataChannelSender';
23
+ import { CoordinateConverter, UnquantizedDenormalizedUnsignedCoord } from '../Util/CoordinateConverter';
24
+ import { PixelStreaming } from '../PixelStreaming/PixelStreaming';
25
+ import { ITouchController } from '../Inputs/ITouchController';
26
+ /**
27
+ * Entry point for the WebRTC Player
28
+ */
29
+ export declare class WebRtcPlayerController {
30
+ config: Config;
31
+ responseController: ResponseController;
32
+ sdpConstraints: RTCOfferOptions;
33
+ webSocketController: WebSocketController;
34
+ sendrecvDataChannelController: DataChannelController;
35
+ recvDataChannelController: DataChannelController;
36
+ dataChannelSender: DataChannelSender;
37
+ datachannelOptions: RTCDataChannelInit;
38
+ videoPlayer: VideoPlayer;
39
+ streamController: StreamController;
40
+ peerConnectionController: PeerConnectionController;
41
+ inputClassesFactory: InputClassesFactory;
42
+ freezeFrameController: FreezeFrameController;
43
+ shouldShowPlayOverlay: boolean;
44
+ afkController: AFKController;
45
+ videoElementParentClientRect: DOMRect;
46
+ latencyStartTime: number;
47
+ pixelStreaming: PixelStreaming;
48
+ streamMessageController: StreamMessageController;
49
+ sendDescriptorController: SendDescriptorController;
50
+ sendMessageController: SendMessageController;
51
+ toStreamerMessagesController: ToStreamerMessagesController;
52
+ keyboardController: KeyboardController;
53
+ mouseController: MouseController;
54
+ touchController: ITouchController;
55
+ gamePadController: GamePadController;
56
+ coordinateConverter: CoordinateConverter;
57
+ isUsingSFU: boolean;
58
+ isQualityController: boolean;
59
+ statsTimerHandle: number;
60
+ file: FileTemplate;
61
+ preferredCodec: string;
62
+ peerConfig: RTCConfiguration;
63
+ videoAvgQp: number;
64
+ shouldReconnect: boolean;
65
+ isReconnecting: boolean;
66
+ reconnectAttempt: number;
67
+ subscribedStream: string | null;
68
+ signallingUrlBuilder: () => string;
69
+ disconnectMessageOverride: string;
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
+ * Restart the stream automatically without refreshing the page
119
+ */
120
+ restartStreamAutomatically(): 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: MessageConfig): void;
180
+ /**
181
+ * Handles when the signalling server gives us the list of streamer ids.
182
+ */
183
+ handleStreamerListMessage(messageStreamerList: MessageStreamerList): void;
184
+ /**
185
+ * Handle the RTC Answer from the signaling server
186
+ * @param Answer - Answer SDP from the peer.
187
+ */
188
+ handleWebRtcAnswer(Answer: MessageAnswer): void;
189
+ /**
190
+ * Handle the RTC offer from a WebRTC peer (received through the signalling server).
191
+ * @param Offer - Offer SDP from the peer.
192
+ */
193
+ handleWebRtcOffer(Offer: MessageOffer): void;
194
+ /**
195
+ * Handle when the SFU provides the peer with its data channels
196
+ * @param DataChannels - The message from the SFU containing the data channels ids
197
+ */
198
+ handleWebRtcSFUPeerDatachannels(DataChannels: MessageReceive.MessagePeerDataChannels): void;
199
+ handlePostWebrtcNegotiation(): void;
200
+ /**
201
+ * When an ice Candidate is received from the Signaling server add it to the Peer Connection Client
202
+ * @param iceCandidate - Ice Candidate from Server
203
+ */
204
+ handleIceCandidate(iceCandidate: RTCIceCandidateInit): void;
205
+ /**
206
+ * Send the ice Candidate to the signaling server via websocket
207
+ * @param iceEvent - RTC Peer ConnectionIceEvent) {
208
+ */
209
+ handleSendIceCandidate(iceEvent: RTCPeerConnectionIceEvent): void;
210
+ /**
211
+ * Send the ice Candidate to the signaling server via websocket
212
+ * @param iceEvent - RTC Peer ConnectionIceEvent) {
213
+ */
214
+ handleDataChannel(datachannelEvent: RTCDataChannelEvent): void;
215
+ /**
216
+ * Send the RTC Offer Session to the Signaling server via websocket
217
+ * @param offer - RTC Session Description
218
+ */
219
+ handleSendWebRTCOffer(offer: RTCSessionDescriptionInit): void;
220
+ /**
221
+ * Send the RTC Offer Session to the Signaling server via websocket
222
+ * @param answer - RTC Session Description
223
+ */
224
+ handleSendWebRTCAnswer(answer: RTCSessionDescriptionInit): void;
225
+ /**
226
+ * Set the freeze frame overlay to the player div
227
+ */
228
+ setUpMouseAndFreezeFrame(): void;
229
+ /**
230
+ * Close the Connection to the signaling server
231
+ */
232
+ closeSignalingServer(): void;
233
+ /**
234
+ * Close the peer connection
235
+ */
236
+ closePeerConnection(): void;
237
+ /**
238
+ * Close all connections
239
+ */
240
+ close(): void;
241
+ /**
242
+ * Fires a Video Stats Event in the RTC Peer Connection
243
+ */
244
+ getStats(): void;
245
+ /**
246
+ * Send a Latency Test Request to the UE Instance
247
+ */
248
+ sendLatencyTest(): void;
249
+ /**
250
+ * Send the MinQP encoder setting to the UE Instance.
251
+ * @param minQP - The lower bound for QP when encoding
252
+ * valid values are (1-51) where:
253
+ * 1 = Best quality but highest bitrate.
254
+ * 51 = Worst quality but lowest bitrate.
255
+ * By default the minQP is 1 meaning the encoder is free
256
+ * to aim for the best quality it can on the given network link.
257
+ */
258
+ sendEncoderMinQP(minQP: number): void;
259
+ /**
260
+ * Send the MaxQP encoder setting to the UE Instance.
261
+ * @param maxQP - The upper bound for QP when encoding
262
+ * valid values are (1-51) where:
263
+ * 1 = Best quality but highest bitrate.
264
+ * 51 = Worst quality but lowest bitrate.
265
+ * By default the maxQP is 51 meaning the encoder is free
266
+ * to drop quality as low as needed on the given network link.
267
+ */
268
+ sendEncoderMaxQP(maxQP: number): void;
269
+ /**
270
+ * Send the { WebRTC.MinBitrate: SomeNumber }} command to UE to set
271
+ * the minimum bitrate that we allow WebRTC to use
272
+ * (note setting this too high in poor networks can be problematic).
273
+ * @param minBitrate - The minimum bitrate we would like WebRTC to not fall below.
274
+ */
275
+ sendWebRTCMinBitrate(minBitrate: number): void;
276
+ /**
277
+ * Send the { WebRTC.MaxBitrate: SomeNumber }} command to UE to set
278
+ * the minimum bitrate that we allow WebRTC to use
279
+ * (note setting this too low could result in blocky video).
280
+ * @param minBitrate - The minimum bitrate we would like WebRTC to not fall below.
281
+ */
282
+ sendWebRTCMaxBitrate(maxBitrate: number): void;
283
+ /**
284
+ * Send the { WebRTC.Fps: SomeNumber }} UE 5.0+
285
+ * and { WebRTC.MaxFps } UE 4.27 command to set
286
+ * the maximum fps we would like WebRTC to stream at.
287
+ * @param fps - The maximum stream fps.
288
+ */
289
+ sendWebRTCFps(fps: number): void;
290
+ /**
291
+ * Sends the UI Descriptor `stat fps` to the UE Instance
292
+ */
293
+ sendShowFps(): void;
294
+ /**
295
+ * Send an Iframe request to the streamer
296
+ */
297
+ sendIframeRequest(): void;
298
+ /**
299
+ * Send a UIInteraction message
300
+ */
301
+ emitUIInteraction(descriptor: object | string): void;
302
+ /**
303
+ * Send a Command message
304
+ */
305
+ emitCommand(descriptor: object): void;
306
+ /**
307
+ * Send a console command message
308
+ */
309
+ emitConsoleCommand(command: string): void;
310
+ /**
311
+ * Sends a request to the UE Instance to have ownership of Quality
312
+ */
313
+ sendRequestQualityControlOwnership(): void;
314
+ /**
315
+ * Handles when a Latency Test Result are received from the UE Instance
316
+ * @param message - Latency Test Timings
317
+ */
318
+ handleLatencyTestResult(message: ArrayBuffer): void;
319
+ /**
320
+ * Handles when the Encoder and Web RTC Settings are received from the UE Instance
321
+ * @param message - Initial Encoder and Web RTC Settings
322
+ */
323
+ handleInitialSettings(message: ArrayBuffer): void;
324
+ /**
325
+ * Handles when the Quantization Parameter are received from the UE Instance
326
+ * @param message - Encoders Quantization Parameter
327
+ */
328
+ handleVideoEncoderAvgQP(message: ArrayBuffer): void;
329
+ /**
330
+ * Handles when the video element has been loaded with a srcObject
331
+ */
332
+ handleVideoInitialized(): void;
333
+ /**
334
+ * Flag set if the user has Quality Ownership
335
+ * @param message - Does the current client have Quality Ownership
336
+ */
337
+ onQualityControlOwnership(message: ArrayBuffer): void;
338
+ /**
339
+ * Handles when the Aggregated stats are Collected
340
+ * @param stats - Aggregated Stats
341
+ */
342
+ handleVideoStats(stats: AggregatedStats): void;
343
+ /**
344
+ * To Resize the Video Player element
345
+ */
346
+ resizePlayerStyle(): void;
347
+ /**
348
+ * Get the overridden disconnect message
349
+ */
350
+ getDisconnectMessageOverride(): string;
351
+ /**
352
+ * Set the override for the disconnect message
353
+ */
354
+ setDisconnectMessageOverride(message: string): void;
355
+ setPreferredCodec(codec: string): void;
356
+ setVideoEncoderAvgQP(avgQP: number): void;
357
+ /**
358
+ * enables/disables keyboard event listeners
359
+ */
360
+ setKeyboardInputEnabled(isEnabled: boolean): void;
361
+ /**
362
+ * enables/disables mouse event listeners
363
+ */
364
+ setMouseInputEnabled(isEnabled: boolean): void;
365
+ /**
366
+ * enables/disables touch event listeners
367
+ */
368
+ setTouchInputEnabled(isEnabled: boolean): void;
369
+ /**
370
+ * enables/disables game pad event listeners
371
+ */
372
+ setGamePadInputEnabled(isEnabled: boolean): void;
373
+ registerDataChannelEventEmitters(dataChannel: DataChannelController): void;
374
+ }
@@ -0,0 +1,78 @@
1
+ /**
2
+ * 将接收到的消息类型
3
+ */
4
+ export declare enum MessageRecvTypes {
5
+ CONFIG = "config",
6
+ STREAMER_LIST = "streamerList",
7
+ PLAYER_COUNT = "playerCount",
8
+ OFFER = "offer",
9
+ ANSWER = "answer",
10
+ ICE_CANDIDATE = "iceCandidate",
11
+ PEER_DATA_CHANNELS = "peerDataChannels",
12
+ PING = "ping",
13
+ WARNING = "warning"
14
+ }
15
+ /**
16
+ * Concrete Received Message wrapper
17
+ */
18
+ export declare class MessageRecv {
19
+ type: string;
20
+ id: string;
21
+ }
22
+ /**
23
+ * Authentication Required Message wrapper
24
+ */
25
+ export declare class MessageAuthRequired extends MessageRecv {
26
+ }
27
+ /**
28
+ * Config Message Wrapper
29
+ */
30
+ export declare class MessageConfig extends MessageRecv {
31
+ peerConnectionOptions: RTCConfiguration;
32
+ }
33
+ /**
34
+ * Streamer List Message Wrapper
35
+ */
36
+ export declare class MessageStreamerList extends MessageRecv {
37
+ ids: string[];
38
+ }
39
+ /**
40
+ * Player Count Message wrapper
41
+ */
42
+ export declare class MessagePlayerCount extends MessageRecv {
43
+ count: number;
44
+ }
45
+ /**
46
+ * Web RTC offer Answer Message wrapper
47
+ */
48
+ export declare class MessageAnswer extends MessageRecv {
49
+ sdp: string;
50
+ }
51
+ /**
52
+ * WebRTC sdp offer Message wrapper.
53
+ */
54
+ export declare class MessageOffer extends MessageRecv {
55
+ sdp: string;
56
+ sfu?: boolean;
57
+ defaultToHover?: string;
58
+ }
59
+ /**
60
+ * Ice Candidate Message wrapper
61
+ */
62
+ export declare class MessageIceCandidate extends MessageRecv {
63
+ candidate: RTCIceCandidateInit;
64
+ }
65
+ /**
66
+ * Peer Data Channels Message wrapper
67
+ */
68
+ export declare class MessagePeerDataChannels extends MessageRecv {
69
+ recvStreamId: number;
70
+ sendStreamId: number;
71
+ type: string;
72
+ }
73
+ export declare class MessageOnScreenKeyboard {
74
+ command: string;
75
+ showOnScreenKeyboard: boolean;
76
+ x: number;
77
+ y: number;
78
+ }
@@ -0,0 +1,98 @@
1
+ /**
2
+ * The Send Types that are pushed from the signaling server
3
+ */
4
+ export declare enum MessageSendTypes {
5
+ LIST_STREAMERS = "listStreamers",
6
+ SUBSCRIBE = "subscribe",
7
+ UNSUBSCRIBE = "unsubscribe",
8
+ ICE_CANDIDATE = "iceCandidate",
9
+ OFFER = "offer",
10
+ ANSWER = "answer",
11
+ DATACHANNELREQUEST = "dataChannelRequest",
12
+ SFURECVDATACHANNELREADY = "peerDataChannelsReady",
13
+ PONG = "pong"
14
+ }
15
+ /**
16
+ * A Wrapper for the message to send to the signaling server
17
+ */
18
+ export declare class MessageSend implements Send {
19
+ type: string;
20
+ peerConnectionOptions: object;
21
+ /**
22
+ * Turns the wrapper into a JSON String
23
+ * @returns - JSON String of the Message to send
24
+ */
25
+ payload(): string;
26
+ }
27
+ export interface Send {
28
+ /**
29
+ * Turns the wrapper into a JSON String
30
+ * @returns - JSON String of the Message to send
31
+ */
32
+ payload: () => string;
33
+ }
34
+ export declare class MessageListStreamers extends MessageSend {
35
+ constructor();
36
+ }
37
+ export declare class MessageSubscribe extends MessageSend {
38
+ streamerId: string;
39
+ constructor(streamerid: string);
40
+ }
41
+ export declare class MessageUnsubscribe extends MessageSend {
42
+ constructor();
43
+ }
44
+ /**
45
+ * Instance Request Message Wrapper
46
+ */
47
+ export declare class MessagePong extends MessageSend {
48
+ time: number;
49
+ constructor(time: number);
50
+ }
51
+ /**
52
+ * Web RTC Offer message wrapper
53
+ */
54
+ export declare class MessageWebRTCOffer extends MessageSend {
55
+ sdp: string;
56
+ /**
57
+ * @param offer - Generated Web RTC Offer
58
+ */
59
+ constructor(offer?: RTCSessionDescriptionInit);
60
+ }
61
+ /**
62
+ * Web RTC Answer message wrapper
63
+ */
64
+ export declare class MessageWebRTCAnswer extends MessageSend {
65
+ sdp: string;
66
+ /**
67
+ * @param answer - Generated Web RTC Offer
68
+ */
69
+ constructor(answer?: RTCSessionDescriptionInit);
70
+ }
71
+ /**
72
+ * Web RTC Data channel request message wrapper
73
+ */
74
+ export declare class MessageWebRTCDatachannelRequest extends MessageSend {
75
+ constructor();
76
+ }
77
+ /**
78
+ * Web RTC SFU Data channel ready message wrapper
79
+ */
80
+ export declare class MessageSFURecvDataChannelReady extends MessageSend {
81
+ constructor();
82
+ }
83
+ /**
84
+ * RTC Ice Candidate Wrapper
85
+ */
86
+ export declare class MessageIceCandidate implements Send {
87
+ candidate: RTCIceCandidate;
88
+ type: MessageSendTypes;
89
+ /**
90
+ * @param candidate - RTC Ice Candidate
91
+ */
92
+ constructor(candidate: RTCIceCandidate);
93
+ /**
94
+ * Turns the wrapper into a JSON String
95
+ * @returns - JSON String of the Message to send
96
+ */
97
+ payload(): string;
98
+ }
@@ -0,0 +1,15 @@
1
+ import { WebSocketController } from './WebSocketController';
2
+ /**
3
+ * Signalling protocol for handling messages from the signalling server.
4
+ */
5
+ export declare class SignallingProtocol {
6
+ private FromUEMessageHandlers;
7
+ constructor();
8
+ addMessageHandler(messageId: string, messageHandler: (payload: string) => void): void;
9
+ handleMessage(messageId: string, messageData: string): void;
10
+ /**
11
+ * Setup any default signalling message handling, these can be overridden or additional handlers added with `addMessageHandler`.
12
+ * @param websocketController The controller to setup these handlers on.
13
+ */
14
+ static setupDefaultHandlers(websocketController: WebSocketController): void;
15
+ }