@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,259 @@
1
+ import { Config } from '../Config/Config';
2
+ import { LatencyTestResults } from '../DataChannel/LatencyTestResults';
3
+ import { AggregatedStats } from '../PeerConnectionController/AggregatedStats';
4
+ import { WebRtcPlayerController } from '../WebRtcPlayer/WebRtcPlayerController';
5
+ import { InitialSettings } from '../DataChannel/InitialSettings';
6
+ import { PixelStreamingEvent } from '../Util/EventEmitter';
7
+ import { MessageReceive } from '@epicgames-ps/lib-pixelstreamingcommon-ue5.5';
8
+ import { WebXRController } from '../WebXR/WebXRController';
9
+ import { MessageDirection } from '../UeInstanceMessage/StreamMessageController';
10
+ import { DataChannelLatencyTestConfig, DataChannelLatencyTestController } from "../DataChannel/DataChannelLatencyTestController";
11
+ import { DataChannelLatencyTestResponse } from "../DataChannel/DataChannelLatencyTestResults";
12
+ export interface PixelStreamingOverrides {
13
+ /** The DOM elment where Pixel Streaming video and user input event handlers are attached to.
14
+ * You can give an existing DOM element here. If not given, the library will create a new div element
15
+ * that is not attached anywhere. In this case you can later get access to this new element and
16
+ * attach it to your web page. */
17
+ videoElementParent?: HTMLElement;
18
+ }
19
+ /**
20
+ * The key class for the browser side of a Pixel Streaming application, it includes:
21
+ * WebRTC handling, XR support, input handling, and emitters for lifetime and state change events.
22
+ * Users are encouraged to use this class as is, through composition, or extend it. In any case,
23
+ * this will likely be the core of your Pixel Streaming experience in terms of functionality.
24
+ */
25
+ export declare class PixelStreaming {
26
+ protected _webRtcController: WebRtcPlayerController;
27
+ protected _webXrController: WebXRController;
28
+ protected _dataChannelLatencyTestController: DataChannelLatencyTestController;
29
+ /**
30
+ * Configuration object. You can read or modify config through this object. Whenever
31
+ * the configuration is changed, the library will emit a `settingsChanged` event.
32
+ */
33
+ config: Config;
34
+ private _videoElementParent;
35
+ private allowConsoleCommands;
36
+ private onScreenKeyboardHelper;
37
+ private _videoStartTime;
38
+ private _inputController;
39
+ private _eventEmitter;
40
+ /**
41
+ * @param config - A newly instantiated config object
42
+ * @param overrides - Parameters to override default behaviour
43
+ * returns the base Pixel streaming object
44
+ */
45
+ constructor(config: Config, overrides?: PixelStreamingOverrides);
46
+ /**
47
+ * Gets the element that contains the video stream element.
48
+ */
49
+ get videoElementParent(): HTMLElement;
50
+ /**
51
+ * Configure the settings with on change listeners and any additional per experience settings.
52
+ */
53
+ private configureSettings;
54
+ /**
55
+ * Activate the on screen keyboard when receiving the command from the streamer
56
+ * @param command - the keyboard command
57
+ */
58
+ _activateOnScreenKeyboard(command: MessageReceive.MessageOnScreenKeyboard): void;
59
+ /**
60
+ * Set the input control ownership
61
+ * @param inputControlOwnership - does the user have input control ownership
62
+ */
63
+ _onInputControlOwnership(inputControlOwnership: boolean): void;
64
+ /**
65
+ * Instantiate the WebRTCPlayerController interface to provide WebRTCPlayerController functionality within this class and set up anything that requires it
66
+ * @param webRtcPlayerController - a WebRtcPlayerController controller instance
67
+ */
68
+ private setWebRtcPlayerController;
69
+ /**
70
+ * Connect to signaling server.
71
+ */
72
+ connect(): void;
73
+ /**
74
+ * Reconnects to the signaling server. If connection is up, disconnects first
75
+ * before establishing a new connection
76
+ */
77
+ reconnect(): void;
78
+ /**
79
+ * Disconnect from the signaling server and close open peer connections.
80
+ */
81
+ disconnect(): void;
82
+ /**
83
+ * Play the stream. Can be called only after a peer connection has been established.
84
+ */
85
+ play(): void;
86
+ /**
87
+ * Auto connect if AutoConnect flag is enabled
88
+ */
89
+ private checkForAutoConnect;
90
+ /**
91
+ * Will unmute the microphone track which is sent to Unreal Engine.
92
+ * By default, will only unmute an existing mic track.
93
+ *
94
+ * @param forceEnable Can be used for cases when this object wasn't initialized with a mic track.
95
+ * If this parameter is true, the connection will be restarted with a microphone.
96
+ * Warning: this takes some time, as a full renegotiation and reconnection will happen.
97
+ */
98
+ unmuteMicrophone(forceEnable?: boolean): void;
99
+ muteMicrophone(): void;
100
+ private setMicrophoneMuted;
101
+ /**
102
+ * Emit an event on auto connecting
103
+ */
104
+ _onWebRtcAutoConnect(): void;
105
+ /**
106
+ * Set up functionality to happen when receiving a webRTC answer
107
+ */
108
+ _onWebRtcSdp(): void;
109
+ /**
110
+ * Emits a StreamLoading event
111
+ */
112
+ _onStreamLoading(): void;
113
+ /**
114
+ * Event fired when the video is disconnected - emits given eventString or an override
115
+ * message from webRtcController if one has been set
116
+ * @param eventString - a string describing why the connection closed
117
+ * @param allowClickToReconnect - true if we want to allow the user to retry the connection with a click
118
+ */
119
+ _onDisconnect(eventString: string, allowClickToReconnect: boolean): void;
120
+ /**
121
+ * Handles when Web Rtc is connecting
122
+ */
123
+ _onWebRtcConnecting(): void;
124
+ /**
125
+ * Handles when Web Rtc has connected
126
+ */
127
+ _onWebRtcConnected(): void;
128
+ /**
129
+ * Handles when Web Rtc fails to connect
130
+ */
131
+ _onWebRtcFailed(): void;
132
+ /**
133
+ * Handle when the Video has been Initialized
134
+ */
135
+ _onVideoInitialized(): void;
136
+ /**
137
+ * Set up functionality to happen when receiving latency test results
138
+ * @param latency - latency test results object
139
+ */
140
+ _onLatencyTestResult(latencyTimings: LatencyTestResults): void;
141
+ _onDataChannelLatencyTestResponse(response: DataChannelLatencyTestResponse): void;
142
+ /**
143
+ * Set up functionality to happen when receiving video statistics
144
+ * @param videoStats - video statistics as a aggregate stats object
145
+ */
146
+ _onVideoStats(videoStats: AggregatedStats): void;
147
+ /**
148
+ * Set up functionality to happen when calculating the average video encoder qp
149
+ * @param QP - the quality number of the stream
150
+ */
151
+ _onVideoEncoderAvgQP(QP: number): void;
152
+ /**
153
+ * Set up functionality to happen when receiving and handling initial settings for the UE app
154
+ * @param settings - initial UE app settings
155
+ */
156
+ _onInitialSettings(settings: InitialSettings): void;
157
+ /**
158
+ * Set up functionality to happen when setting quality control ownership of a stream
159
+ * @param hasQualityOwnership - does this user have quality ownership of the stream true / false
160
+ */
161
+ _onQualityControlOwnership(hasQualityOwnership: boolean): void;
162
+ _onPlayerCount(playerCount: number): void;
163
+ /**
164
+ * Request a connection latency test.
165
+ * NOTE: There are plans to refactor all request* functions. Expect changes if you use this!
166
+ * @returns
167
+ */
168
+ requestLatencyTest(): boolean;
169
+ /**
170
+ * Request a data channel latency test.
171
+ * NOTE: There are plans to refactor all request* functions. Expect changes if you use this!
172
+ */
173
+ requestDataChannelLatencyTest(config: DataChannelLatencyTestConfig): boolean;
174
+ /**
175
+ * Request for the UE application to show FPS counter.
176
+ * NOTE: There are plans to refactor all request* functions. Expect changes if you use this!
177
+ * @returns
178
+ */
179
+ requestShowFps(): boolean;
180
+ /**
181
+ * Request for a new IFrame from the UE application.
182
+ * NOTE: There are plans to refactor all request* functions. Expect changes if you use this!
183
+ * @returns
184
+ */
185
+ requestIframe(): boolean;
186
+ /**
187
+ * Send data to UE application. The data will be run through JSON.stringify() so e.g. strings
188
+ * and any serializable plain JSON objects with no recurrence can be sent.
189
+ * @returns true if succeeded, false if rejected
190
+ */
191
+ emitUIInteraction(descriptor: object | string): boolean;
192
+ /**
193
+ * Send a command to UE application. Blocks ConsoleCommand descriptors unless UE
194
+ * has signaled that it allows console commands.
195
+ * @returns true if succeeded, false if rejected
196
+ */
197
+ emitCommand(descriptor: object): boolean;
198
+ /**
199
+ * Send a console command to UE application. Only allowed if UE has signaled that it allows
200
+ * console commands.
201
+ * @returns true if succeeded, false if rejected
202
+ */
203
+ emitConsoleCommand(command: string): boolean;
204
+ /**
205
+ * Add a UE -> browser response event listener
206
+ * @param name - The name of the response handler
207
+ * @param listener - The method to be activated when a message is received
208
+ */
209
+ addResponseEventListener(name: string, listener: (response: string) => void): void;
210
+ /**
211
+ * Remove a UE -> browser response event listener
212
+ * @param name - The name of the response handler
213
+ */
214
+ removeResponseEventListener(name: string): void;
215
+ /**
216
+ * Dispatch a new event.
217
+ * @param e event
218
+ * @returns
219
+ */
220
+ dispatchEvent(e: PixelStreamingEvent): boolean;
221
+ /**
222
+ * Register an event handler.
223
+ * @param type event name
224
+ * @param listener event handler function
225
+ */
226
+ addEventListener<T extends PixelStreamingEvent['type'], E extends PixelStreamingEvent & {
227
+ type: T;
228
+ }>(type: T, listener: (e: Event & E) => void): void;
229
+ /**
230
+ * Remove an event handler.
231
+ * @param type event name
232
+ * @param listener event handler function
233
+ */
234
+ removeEventListener<T extends PixelStreamingEvent['type'], E extends PixelStreamingEvent & {
235
+ type: T;
236
+ }>(type: T, listener: (e: Event & E) => void): void;
237
+ /**
238
+ * Enable/disable XR mode.
239
+ */
240
+ toggleXR(): void;
241
+ /**
242
+ * Pass in a function to generate a signalling server URL.
243
+ * This function is useful if you need to programmatically construct your signalling server URL.
244
+ * @param signallingUrlBuilderFunc A function that generates a signalling server url.
245
+ */
246
+ setSignallingUrlBuilder(signallingUrlBuilderFunc: () => string): void;
247
+ /**
248
+ * Public getter for the websocket controller. Access to this property allows you to send
249
+ * custom websocket messages.
250
+ */
251
+ get signallingProtocol(): import("@epicgames-ps/lib-pixelstreamingcommon-ue5.5").SignallingProtocol;
252
+ /**
253
+ * Public getter for the webXrController controller. Used for all XR features.
254
+ */
255
+ get webXrController(): WebXRController;
256
+ registerMessageHandler(name: string, direction: MessageDirection, handler?: (data: ArrayBuffer | Array<number | string>) => void): void;
257
+ get toStreamerHandlers(): Map<string, (messageData?: (string | number)[]) => void>;
258
+ isReconnecting(): boolean;
259
+ }
@@ -0,0 +1,31 @@
1
+ import { UnquantizedDenormalizedUnsignedCoord } from '../Util/CoordinateConverter';
2
+ import { MessageReceive } from '@epicgames-ps/lib-pixelstreamingcommon-ue5.5';
3
+ /**
4
+ * Class for handling on screen keyboard usage
5
+ */
6
+ export declare class OnScreenKeyboard {
7
+ editTextButton: HTMLButtonElement;
8
+ hiddenInput: HTMLInputElement;
9
+ /**
10
+ *
11
+ * @param videoElementParent The div element the video player is injected into
12
+ */
13
+ constructor(videoElementParent: HTMLElement);
14
+ /**
15
+ * An override for unquantizeAndDenormalizeUnsigned
16
+ * @param x the x axis point
17
+ * @param y the y axis point
18
+ * @returns unquantizeAndDenormalizeUnsigned object
19
+ */
20
+ unquantizeAndDenormalizeUnsigned(x: number, y: number): UnquantizedDenormalizedUnsignedCoord;
21
+ /**
22
+ * Creates on screen keyboard helpers
23
+ * @param videoElementParent The div element the video player i injected into
24
+ */
25
+ createOnScreenKeyboardHelpers(videoElementParent: HTMLElement): void;
26
+ /**
27
+ * Shows the on screen keyboard
28
+ * @param command the command received via the data channel containing keyboard positions
29
+ */
30
+ showOnScreenKeyboard(command: MessageReceive.MessageOnScreenKeyboard): void;
31
+ }
@@ -0,0 +1,19 @@
1
+ export declare class ResponseController {
2
+ responseEventListeners: Map<string, (response: string) => void>;
3
+ /**
4
+ * Add a response event listener to the response map
5
+ * @param name - The name of the response
6
+ * @param listener - The method to be activated when the response is selected
7
+ */
8
+ addResponseEventListener(name: string, listener: (response: string) => void): void;
9
+ /**
10
+ * Remove a response event listener to the response map
11
+ * @param name - The name of the response
12
+ */
13
+ removeResponseEventListener(name: string): void;
14
+ /**
15
+ * Handle a response when receiving one form the streamer
16
+ * @param message - Data received from the data channel with the command in question
17
+ */
18
+ onResponse(message: ArrayBuffer): void;
19
+ }
@@ -0,0 +1,18 @@
1
+ import { DataChannelSender } from '../DataChannel/DataChannelSender';
2
+ import { StreamMessageController } from './StreamMessageController';
3
+ export declare class SendMessageController {
4
+ toStreamerMessagesMapProvider: StreamMessageController;
5
+ dataChannelSender: DataChannelSender;
6
+ /**
7
+ * @param dataChannelSender - Data channel instance
8
+ * @param toStreamerMessagesMapProvider - Stream Messages instance
9
+ */
10
+ constructor(dataChannelSender: DataChannelSender, toStreamerMessagesMapProvider: StreamMessageController);
11
+ /**
12
+ * Send a message to the streamer through the data channel
13
+ * @param messageType - the type of message we are sending
14
+ * @param messageData - the message data we are sending over the data channel
15
+ * @returns - nil
16
+ */
17
+ sendMessageToStreamer(messageType: string, messageData?: Array<number | string>): void;
18
+ }
@@ -0,0 +1,29 @@
1
+ export declare class ToStreamerMessage {
2
+ id: number;
3
+ structure?: Array<string>;
4
+ }
5
+ export declare class StreamMessageController {
6
+ toStreamerHandlers: Map<string, (messageData?: Array<number | string> | undefined) => void>;
7
+ fromStreamerHandlers: Map<string, (messageType: string, messageData?: ArrayBuffer | undefined) => void>;
8
+ toStreamerMessages: Map<string, ToStreamerMessage>;
9
+ fromStreamerMessages: Map<number, string>;
10
+ constructor();
11
+ /**
12
+ * Populate the Default message protocol
13
+ */
14
+ populateDefaultProtocol(): void;
15
+ /**
16
+ * Register a message handler
17
+ * @param messageDirection - the direction of the message; toStreamer or fromStreamer
18
+ * @param messageType - the type of the message
19
+ * @param messageHandler - the function or method to be executed when this handler is called
20
+ */
21
+ registerMessageHandler(messageDirection: MessageDirection, messageType: string, messageHandler: (messageData?: unknown | undefined) => void): void;
22
+ }
23
+ /**
24
+ * The enum for message directions
25
+ */
26
+ export declare enum MessageDirection {
27
+ ToStreamer = 0,
28
+ FromStreamer = 1
29
+ }
@@ -0,0 +1,32 @@
1
+ import { SendMessageController } from './SendMessageController';
2
+ export declare class ToStreamerMessagesController {
3
+ sendMessageController: SendMessageController;
4
+ /**
5
+ * @param sendMessageController - Stream message controller instance
6
+ */
7
+ constructor(sendMessageController: SendMessageController);
8
+ /**
9
+ * Send Request to Take Quality Control to the UE Instance
10
+ */
11
+ SendRequestQualityControl(): void;
12
+ /**
13
+ * Send Max FPS Request to the UE Instance
14
+ */
15
+ SendMaxFpsRequest(): void;
16
+ /**
17
+ * Send Average Bitrate Request to the UE Instance
18
+ */
19
+ SendAverageBitrateRequest(): void;
20
+ /**
21
+ * Send a Start Streaming Message to the UE Instance
22
+ */
23
+ SendStartStreaming(): void;
24
+ /**
25
+ * Send a Stop Streaming Message to the UE Instance
26
+ */
27
+ SendStopStreaming(): void;
28
+ /**
29
+ * Send a Request Initial Settings to the UE Instance
30
+ */
31
+ SendRequestInitialSettings(): void;
32
+ }
@@ -0,0 +1,100 @@
1
+ import { VideoPlayer } from '../VideoPlayer/VideoPlayer';
2
+ /**
3
+ * Converts coordinates from element relative coordinates to values normalized within the value range of a short (and back again)
4
+ */
5
+ export declare class CoordinateConverter {
6
+ videoElementProvider: VideoPlayer;
7
+ videoElementParent: HTMLElement;
8
+ videoElement: HTMLVideoElement;
9
+ ratio: number;
10
+ normalizeAndQuantizeUnsignedFunc: (x: number, y: number) => NormalizedQuantizedUnsignedCoord;
11
+ normalizeAndQuantizeSignedFunc: (x: number, y: number) => NormalizedQuantizedSignedCoord;
12
+ denormalizeAndUnquantizeUnsignedFunc: (x: number, y: number) => UnquantizedDenormalizedUnsignedCoord;
13
+ /**
14
+ * @param videoElementProvider - the div element that the video player will be injected into
15
+ */
16
+ constructor(videoElementProvider: VideoPlayer);
17
+ /**
18
+ * The surface method for setterNormalizeAndQuantizeUnsigned
19
+ * @param x - x axis point
20
+ * @param y - y axis point
21
+ */
22
+ normalizeAndQuantizeUnsigned(x: number, y: number): NormalizedQuantizedUnsignedCoord;
23
+ /**
24
+ * The surface method for setterUnquantizeAndDenormalizeUnsigned
25
+ * @param x - x axis point
26
+ * @param y - y axis point
27
+ */
28
+ unquantizeAndDenormalizeUnsigned(x: number, y: number): UnquantizedDenormalizedUnsignedCoord;
29
+ /**
30
+ * The surface method for setterNormalizeAndQuantizeSigned
31
+ * @param x - x axis point
32
+ * @param y - y axis point
33
+ */
34
+ normalizeAndQuantizeSigned(x: number, y: number): NormalizedQuantizedSignedCoord;
35
+ /**
36
+ * set up the Normalize And Quantize methods based on the aspect ratio and the video player ratio
37
+ */
38
+ setupNormalizeAndQuantize(): void;
39
+ /**
40
+ * normalizeAndQuantizeUnsigned for playerAspectRatio > videoAspectRatio
41
+ * @param x - x axis point
42
+ * @param y - y axis point
43
+ */
44
+ normalizeAndQuantizeUnsignedPlayerBigger(x: number, y: number): NormalizedQuantizedUnsignedCoord;
45
+ /**
46
+ * unquantizeAndDenormalizeUnsigned for playerAspectRatio > videoAspectRatio
47
+ * @param x - x axis point
48
+ * @param y - y axis point
49
+ */
50
+ denormalizeAndUnquantizeUnsignedPlayerBigger(x: number, y: number): UnquantizedDenormalizedUnsignedCoord;
51
+ /**
52
+ * normalizeAndQuantizeSigned for playerAspectRatio > videoAspectRatio
53
+ * @param x - x axis point
54
+ * @param y - y axis point
55
+ */
56
+ normalizeAndQuantizeSignedPlayerBigger(x: number, y: number): NormalizedQuantizedSignedCoord;
57
+ /**
58
+ * normalizeAndQuantizeUnsigned for playerAspectRatio <= videoAspectRatio
59
+ * @param x - x axis point
60
+ * @param y - y axis point
61
+ */
62
+ normalizeAndQuantizeUnsignedPlayerSmaller(x: number, y: number): NormalizedQuantizedUnsignedCoord;
63
+ /**
64
+ * unquantizeAndDenormalizeUnsigned for playerAspectRatio <= videoAspectRatio
65
+ * @param x - x axis point
66
+ * @param y - y axis point
67
+ */
68
+ denormalizeAndUnquantizeUnsignedPlayerSmaller(x: number, y: number): UnquantizedDenormalizedUnsignedCoord;
69
+ /**
70
+ * normalizeAndQuantizeSigned for playerAspectRatio <= videoAspectRatio
71
+ * @param x - x axis point
72
+ * @param y - y axis point
73
+ */
74
+ normalizeAndQuantizeSignedPlayerSmaller(x: number, y: number): NormalizedQuantizedSignedCoord;
75
+ }
76
+ /**
77
+ * A class for NormalizeAndQuantizeUnsigned objects
78
+ */
79
+ export declare class NormalizedQuantizedUnsignedCoord {
80
+ inRange: boolean;
81
+ x: number;
82
+ y: number;
83
+ constructor(inRange: boolean, x: number, y: number);
84
+ }
85
+ /**
86
+ * A class for UnquantizedAndDenormalizeUnsigned objects
87
+ */
88
+ export declare class UnquantizedDenormalizedUnsignedCoord {
89
+ x: number;
90
+ y: number;
91
+ constructor(x: number, y: number);
92
+ }
93
+ /**
94
+ * A class for NormalizedQuantizedSignedCoord objects
95
+ */
96
+ export declare class NormalizedQuantizedSignedCoord {
97
+ x: number;
98
+ y: number;
99
+ constructor(x: number, y: number);
100
+ }