@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,218 @@
1
+ import { SettingFlag } from './SettingFlag';
2
+ import { SettingNumber } from './SettingNumber';
3
+ import { SettingText } from './SettingText';
4
+ import { SettingOption } from './SettingOption';
5
+ import { EventEmitter } from '../Util/EventEmitter';
6
+ /**
7
+ * A collection of flags that can be toggled and are core to all Pixel Streaming experiences.
8
+ * These are used in the `Config.Flags` map.
9
+ */
10
+ export declare class Flags {
11
+ static AutoConnect: "AutoConnect";
12
+ static AutoPlayVideo: "AutoPlayVideo";
13
+ static AFKDetection: "TimeoutIfIdle";
14
+ static BrowserSendOffer: "OfferToReceive";
15
+ static HoveringMouseMode: "HoveringMouse";
16
+ static ForceMonoAudio: "ForceMonoAudio";
17
+ static ForceTURN: "ForceTURN";
18
+ static FakeMouseWithTouches: "FakeMouseWithTouches";
19
+ static IsQualityController: "ControlsQuality";
20
+ static MatchViewportResolution: "MatchViewportRes";
21
+ static StartVideoMuted: "StartVideoMuted";
22
+ static SuppressBrowserKeys: "SuppressBrowserKeys";
23
+ static UseMic: "UseMic";
24
+ static KeyboardInput: "KeyboardInput";
25
+ static MouseInput: "MouseInput";
26
+ static TouchInput: "TouchInput";
27
+ static GamepadInput: "GamepadInput";
28
+ static XRControllerInput: "XRControllerInput";
29
+ static WaitForStreamer: "WaitForStreamer";
30
+ }
31
+ export type FlagsKeys = Exclude<keyof typeof Flags, 'prototype'>;
32
+ export type FlagsIds = typeof Flags[FlagsKeys];
33
+ /**
34
+ * A collection of numeric parameters that are core to all Pixel Streaming experiences.
35
+ *
36
+ */
37
+ export declare class NumericParameters {
38
+ static AFKTimeoutSecs: "AFKTimeout";
39
+ static MinQP: "MinQP";
40
+ static MaxQP: "MaxQP";
41
+ static WebRTCFPS: "WebRTCFPS";
42
+ static WebRTCMinBitrate: "WebRTCMinBitrate";
43
+ static WebRTCMaxBitrate: "WebRTCMaxBitrate";
44
+ static MaxReconnectAttempts: "MaxReconnectAttempts";
45
+ static StreamerAutoJoinInterval: "StreamerAutoJoinInterval";
46
+ }
47
+ export type NumericParametersKeys = Exclude<keyof typeof NumericParameters, 'prototype'>;
48
+ export type NumericParametersIds = typeof NumericParameters[NumericParametersKeys];
49
+ /**
50
+ * A collection of textual parameters that are core to all Pixel Streaming experiences.
51
+ *
52
+ */
53
+ export declare class TextParameters {
54
+ static SignallingServerUrl: "ss";
55
+ }
56
+ export type TextParametersKeys = Exclude<keyof typeof TextParameters, 'prototype'>;
57
+ export type TextParametersIds = typeof TextParameters[TextParametersKeys];
58
+ /**
59
+ * A collection of enum based parameters that are core to all Pixel Streaming experiences.
60
+ *
61
+ */
62
+ export declare class OptionParameters {
63
+ static PreferredCodec: "PreferredCodec";
64
+ static StreamerId: "StreamerId";
65
+ }
66
+ export type OptionParametersKeys = Exclude<keyof typeof OptionParameters, 'prototype'>;
67
+ export type OptionParametersIds = typeof OptionParameters[OptionParametersKeys];
68
+ /**
69
+ * Utility types for inferring data type based on setting ID
70
+ */
71
+ export type OptionIds = FlagsIds | NumericParametersIds | TextParametersIds | OptionParametersIds;
72
+ export type OptionKeys<T> = T extends FlagsIds ? boolean : T extends NumericParametersIds ? number : T extends TextParametersIds ? string : T extends OptionParametersIds ? string : never;
73
+ export type AllSettings = {
74
+ [K in OptionIds]: OptionKeys<K>;
75
+ };
76
+ export interface ConfigParams {
77
+ /** Initial Pixel Streaming settings */
78
+ initialSettings?: Partial<AllSettings>;
79
+ /** If useUrlParams is set true, will read initial values from URL parameters and persist changed settings into URL */
80
+ useUrlParams?: boolean;
81
+ }
82
+ export declare class Config {
83
+ private flags;
84
+ private numericParameters;
85
+ private textParameters;
86
+ private optionParameters;
87
+ private _useUrlParams;
88
+ constructor(config?: ConfigParams);
89
+ /**
90
+ * True if reading configuration initial values from URL parameters, and
91
+ * persisting changes in URL when changed.
92
+ */
93
+ get useUrlParams(): boolean;
94
+ /**
95
+ * Populate the default settings for a Pixel Streaming application
96
+ */
97
+ private populateDefaultSettings;
98
+ /**
99
+ * Add a callback to fire when the numeric setting is toggled.
100
+ * @param id The id of the flag.
101
+ * @param onChangedListener The callback to fire when the numeric value changes.
102
+ */
103
+ _addOnNumericSettingChangedListener(id: NumericParametersIds, onChangedListener: (newValue: number) => void): void;
104
+ _addOnOptionSettingChangedListener(id: OptionParametersIds, onChangedListener: (newValue: string) => void): void;
105
+ /**
106
+ * @param id The id of the numeric setting we are interested in getting a value for.
107
+ * @returns The numeric value stored in the parameter with the passed id.
108
+ */
109
+ getNumericSettingValue(id: NumericParametersIds): number;
110
+ /**
111
+ * @param id The id of the text setting we are interested in getting a value for.
112
+ * @returns The text value stored in the parameter with the passed id.
113
+ */
114
+ getTextSettingValue(id: TextParametersIds): string;
115
+ /**
116
+ * Set number in the setting.
117
+ * @param id The id of the numeric setting we are interested in.
118
+ * @param value The numeric value to set.
119
+ */
120
+ setNumericSetting(id: NumericParametersIds, value: number): void;
121
+ /**
122
+ * Add a callback to fire when the flag is toggled.
123
+ * @param id The id of the flag.
124
+ * @param onChangeListener The callback to fire when the value changes.
125
+ */
126
+ _addOnSettingChangedListener(id: FlagsIds, onChangeListener: (newFlagValue: boolean) => void): void;
127
+ /**
128
+ * Add a callback to fire when the text is changed.
129
+ * @param id The id of the flag.
130
+ * @param onChangeListener The callback to fire when the value changes.
131
+ */
132
+ _addOnTextSettingChangedListener(id: TextParametersIds, onChangeListener: (newTextValue: string) => void): void;
133
+ /**
134
+ * Get the option which has the given id.
135
+ * @param id The id of the option.
136
+ * @returns The SettingOption object matching id
137
+ */
138
+ getSettingOption(id: OptionParametersIds): SettingOption;
139
+ /**
140
+ * Get the value of the configuration flag which has the given id.
141
+ * @param id The unique id for the flag.
142
+ * @returns True if the flag is enabled.
143
+ */
144
+ isFlagEnabled(id: FlagsIds): boolean;
145
+ /**
146
+ * Set flag to be enabled/disabled.
147
+ * @param id The id of the flag to toggle.
148
+ * @param flagEnabled True if the flag should be enabled.
149
+ */
150
+ setFlagEnabled(id: FlagsIds, flagEnabled: boolean): void;
151
+ /**
152
+ * Set the text setting.
153
+ * @param id The id of the setting
154
+ * @param settingValue The value to set in the setting.
155
+ */
156
+ setTextSetting(id: TextParametersIds, settingValue: string): void;
157
+ /**
158
+ * Set the option setting list of options.
159
+ * @param id The id of the setting
160
+ * @param settingOptions The values the setting could take
161
+ */
162
+ setOptionSettingOptions(id: OptionParametersIds, settingOptions: Array<string>): void;
163
+ /**
164
+ * Set option enum settings selected option.
165
+ * @param id The id of the setting
166
+ * @param settingOptions The value to select out of all the options
167
+ */
168
+ setOptionSettingValue(id: OptionParametersIds, settingValue: string): void;
169
+ /**
170
+ * Set the label for the flag.
171
+ * @param id The id of the flag.
172
+ * @param label The new label to use for the flag.
173
+ */
174
+ setFlagLabel(id: FlagsIds, label: string): void;
175
+ /**
176
+ * Set a subset of all settings in one function call.
177
+ *
178
+ * @param settings A (partial) list of settings to set
179
+ */
180
+ setSettings(settings: Partial<AllSettings>): void;
181
+ /**
182
+ * Get all settings
183
+ * @returns All setting values as an object with setting ids as keys
184
+ */
185
+ getSettings(): Partial<AllSettings>;
186
+ /**
187
+ * Get all Flag settings as an array.
188
+ * @returns All SettingFlag objects
189
+ */
190
+ getFlags(): Array<SettingFlag>;
191
+ /**
192
+ * Get all Text settings as an array.
193
+ * @returns All SettingText objects
194
+ */
195
+ getTextSettings(): Array<SettingText>;
196
+ /**
197
+ * Get all Number settings as an array.
198
+ * @returns All SettingNumber objects
199
+ */
200
+ getNumericSettings(): Array<SettingNumber>;
201
+ /**
202
+ * Get all Option settings as an array.
203
+ * @returns All SettingOption objects
204
+ */
205
+ getOptionSettings(): Array<SettingOption>;
206
+ /**
207
+ * Emit events when settings change.
208
+ * @param eventEmitter
209
+ */
210
+ _registerOnChangeEvents(eventEmitter: EventEmitter): void;
211
+ }
212
+ /**
213
+ * The enum associated with the mouse being locked or hovering
214
+ */
215
+ export declare enum ControlSchemeType {
216
+ LockedMouse = 0,
217
+ HoveringMouse = 1
218
+ }
@@ -0,0 +1,30 @@
1
+ /**
2
+ * Base class for a setting that has a text label and an arbitrary setting value it stores.
3
+ */
4
+ export declare class SettingBase {
5
+ id: string;
6
+ description: string;
7
+ _label: string;
8
+ _value: unknown;
9
+ onChange: (changedValue: unknown, setting: SettingBase) => void;
10
+ onChangeEmit: (changedValue: unknown) => void;
11
+ constructor(id: string, label: string, description: string, defaultSettingValue: unknown, defaultOnChangeListener?: (changedValue: unknown, setting: SettingBase) => void);
12
+ /**
13
+ * Set the label text for the setting.
14
+ * @param label setting label.
15
+ */
16
+ set label(inLabel: string);
17
+ /**
18
+ * @returns The label text for the setting.
19
+ */
20
+ get label(): string;
21
+ /**
22
+ * @return The setting's value.
23
+ */
24
+ get value(): unknown;
25
+ /**
26
+ * Update the setting's stored value.
27
+ * @param inValue The new value for the setting.
28
+ */
29
+ set value(inValue: unknown);
30
+ }
@@ -0,0 +1,33 @@
1
+ import type { FlagsIds } from './Config';
2
+ import { SettingBase } from './SettingBase';
3
+ /**
4
+ * A boolean flag setting object with a text label.
5
+ */
6
+ export declare class SettingFlag<CustomIds extends string = FlagsIds> extends SettingBase {
7
+ id: FlagsIds | CustomIds;
8
+ onChangeEmit: (changedValue: boolean) => void;
9
+ useUrlParams: boolean;
10
+ constructor(id: FlagsIds | CustomIds, label: string, description: string, defaultFlagValue: boolean, useUrlParams: boolean, defaultOnChangeListener?: (changedValue: unknown, setting: SettingBase) => void);
11
+ /**
12
+ * Parse the flag value from the url parameters.
13
+ * @returns True if the url parameters contains /?id, but False if /?id=false
14
+ */
15
+ getUrlParamFlag(): boolean;
16
+ /**
17
+ * Persist the setting value in URL.
18
+ */
19
+ updateURLParams(): void;
20
+ /**
21
+ * Enables this flag.
22
+ */
23
+ enable(): void;
24
+ /**
25
+ * @return The setting's value.
26
+ */
27
+ get flag(): boolean;
28
+ /**
29
+ * Update the setting's stored value.
30
+ * @param inValue The new value for the setting.
31
+ */
32
+ set flag(inValue: boolean);
33
+ }
@@ -0,0 +1,45 @@
1
+ import type { NumericParametersIds } from './Config';
2
+ import { SettingBase } from './SettingBase';
3
+ /**
4
+ * A number setting object with a text label. Min and max limit the range of allowed values.
5
+ */
6
+ export declare class SettingNumber<CustomIds extends string = NumericParametersIds> extends SettingBase {
7
+ _min: number;
8
+ _max: number;
9
+ id: NumericParametersIds | CustomIds;
10
+ onChangeEmit: (changedValue: number) => void;
11
+ useUrlParams: boolean;
12
+ constructor(id: NumericParametersIds | CustomIds, label: string, description: string, min: number, max: number, defaultNumber: number, useUrlParams: boolean, defaultOnChangeListener?: (changedValue: unknown, setting: SettingBase) => void);
13
+ /**
14
+ * Persist the setting value in URL.
15
+ */
16
+ updateURLParams(): void;
17
+ /**
18
+ * Set the number value (will be clamped within range).
19
+ */
20
+ set number(newNumber: number);
21
+ /**
22
+ * @returns The number stored.
23
+ */
24
+ get number(): number;
25
+ /**
26
+ * Clamps a number between the min and max values (inclusive).
27
+ * @param inNumber The number to clamp.
28
+ * @returns The clamped number.
29
+ */
30
+ clamp(inNumber: number): number;
31
+ /**
32
+ * Returns the minimum value
33
+ * @returns The minimum value
34
+ */
35
+ get min(): number;
36
+ /**
37
+ * Returns the maximum value
38
+ * @returns The maximum value
39
+ */
40
+ get max(): number;
41
+ /**
42
+ * Add a change listener to the number object.
43
+ */
44
+ addOnChangedListener(onChangedFunc: (newNumber: number) => void): void;
45
+ }
@@ -0,0 +1,43 @@
1
+ import type { OptionParametersIds } from './Config';
2
+ import { SettingBase } from './SettingBase';
3
+ /**
4
+ * An Option setting object with a text label. Allows you to specify an array of options and select one of them.
5
+ */
6
+ export declare class SettingOption<CustomIds extends string = OptionParametersIds> extends SettingBase {
7
+ id: OptionParametersIds | CustomIds;
8
+ onChangeEmit: (changedValue: string) => void;
9
+ _options: Array<string>;
10
+ useUrlParams: boolean;
11
+ constructor(id: OptionParametersIds | CustomIds, label: string, description: string, defaultTextValue: string, options: Array<string>, useUrlParams: boolean, defaultOnChangeListener?: (changedValue: unknown, setting: SettingBase) => void);
12
+ /**
13
+ * Parse the text value from the url parameters.
14
+ * @returns The text value parsed from the url if the url parameters contains /?id=value, but empty string if just /?id or no url param found.
15
+ */
16
+ getUrlParamText(): string;
17
+ /**
18
+ * Persist the setting value in URL.
19
+ */
20
+ updateURLParams(): void;
21
+ /**
22
+ * Add a change listener to the select element.
23
+ */
24
+ addOnChangedListener(onChangedFunc: (newValue: string) => void): void;
25
+ /**
26
+ * @returns All available options as an array
27
+ */
28
+ get options(): Array<string>;
29
+ /**
30
+ * Set options
31
+ * @param values Array of options
32
+ */
33
+ set options(values: Array<string>);
34
+ /**
35
+ * @returns Selected option as a string
36
+ */
37
+ get selected(): string;
38
+ /**
39
+ * Set selected option if it matches one of the available options
40
+ * @param value Selected option
41
+ */
42
+ set selected(value: string);
43
+ }
@@ -0,0 +1,29 @@
1
+ import type { TextParametersIds } from './Config';
2
+ import { SettingBase } from './SettingBase';
3
+ /**
4
+ * A text setting object with a text label.
5
+ */
6
+ export declare class SettingText<CustomIds extends string = TextParametersIds> extends SettingBase {
7
+ id: TextParametersIds | CustomIds;
8
+ onChangeEmit: (changedValue: string) => void;
9
+ useUrlParams: boolean;
10
+ constructor(id: TextParametersIds | CustomIds, label: string, description: string, defaultTextValue: string, useUrlParams: boolean, defaultOnChangeListener?: (changedValue: unknown, setting: SettingBase) => void);
11
+ /**
12
+ * Parse the text value from the url parameters.
13
+ * @returns The text value parsed from the url if the url parameters contains /?id=value, but empty string if just /?id or no url param found.
14
+ */
15
+ getUrlParamText(): string;
16
+ /**
17
+ * Persist the setting value in URL.
18
+ */
19
+ updateURLParams(): void;
20
+ /**
21
+ * @return The setting's value.
22
+ */
23
+ get text(): string;
24
+ /**
25
+ * Update the setting's stored value.
26
+ * @param inValue The new value for the setting.
27
+ */
28
+ set text(inValue: string);
29
+ }
@@ -0,0 +1,59 @@
1
+ /**
2
+ * Handles the Sending and Receiving of messages to the UE Instance via the Data Channel
3
+ */
4
+ export declare class DataChannelController {
5
+ dataChannel: RTCDataChannel;
6
+ peerConnection: RTCPeerConnection;
7
+ datachannelOptions: RTCDataChannelInit;
8
+ label: string;
9
+ isReceivingFreezeFrame: boolean;
10
+ /**
11
+ * return the current state of a datachannel controller instance
12
+ * @returns the current DataChannelController instance
13
+ */
14
+ getDataChannelInstance(): DataChannelController;
15
+ /**
16
+ * To Create and Set up a Data Channel
17
+ * @param peerConnection - The RTC Peer Connection
18
+ * @param label - Label of the Data Channel
19
+ * @param datachannelOptions - Optional RTC DataChannel options
20
+ */
21
+ createDataChannel(peerConnection: RTCPeerConnection, label: string, datachannelOptions?: RTCDataChannelInit): void;
22
+ setupDataChannel(): void;
23
+ /**
24
+ * Handles when the Data Channel is opened
25
+ */
26
+ handleOnOpen(ev: Event): void;
27
+ /**
28
+ * Handles when the Data Channel is closed
29
+ */
30
+ handleOnClose(ev: Event): void;
31
+ /**
32
+ * Handles when a message is received
33
+ * @param event - Message Event
34
+ */
35
+ handleOnMessage(event: MessageEvent): void;
36
+ /**
37
+ * Handles when an error is thrown
38
+ * @param event - Error Event
39
+ */
40
+ handleOnError(event: MessageEvent): void;
41
+ /**
42
+ * Override to register onOpen handler
43
+ * @param label Data channel label ("datachannel", "send-datachannel", "recv-datachannel")
44
+ * @param ev event
45
+ */
46
+ onOpen(label: string, ev: Event): void;
47
+ /**
48
+ * Override to register onClose handler
49
+ * @param label Data channel label ("datachannel", "send-datachannel", "recv-datachannel")
50
+ * @param ev event
51
+ */
52
+ onClose(label: string, ev: Event): void;
53
+ /**
54
+ * Override to register onError handler
55
+ * @param label Data channel label ("datachannel", "send-datachannel", "recv-datachannel")
56
+ * @param ev event
57
+ */
58
+ onError(label: string, ev: Event): void;
59
+ }
@@ -0,0 +1,26 @@
1
+ /// <reference types="node" />
2
+ import { DataChannelLatencyTestRecord, DataChannelLatencyTestRequest, DataChannelLatencyTestResponse, DataChannelLatencyTestResult, DataChannelLatencyTestSeq, DataChannelLatencyTestTimestamp } from "./DataChannelLatencyTestResults";
3
+ export type DataChannelLatencyTestConfig = {
4
+ duration: number;
5
+ rps: number;
6
+ requestSize: number;
7
+ responseSize: number;
8
+ };
9
+ export type DataChannelLatencyTestSink = (request: DataChannelLatencyTestRequest) => void;
10
+ export type DataChannelLatencyTestResultCallback = (result: DataChannelLatencyTestResult) => void;
11
+ export declare class DataChannelLatencyTestController {
12
+ startTime: DataChannelLatencyTestTimestamp;
13
+ sink: DataChannelLatencyTestSink;
14
+ callback: DataChannelLatencyTestResultCallback;
15
+ records: Map<DataChannelLatencyTestSeq, DataChannelLatencyTestRecord>;
16
+ seq: DataChannelLatencyTestSeq;
17
+ interval: NodeJS.Timer;
18
+ constructor(sink: DataChannelLatencyTestSink, callback: DataChannelLatencyTestResultCallback);
19
+ start(config: DataChannelLatencyTestConfig): boolean;
20
+ stop(): void;
21
+ produceResult(): DataChannelLatencyTestResult;
22
+ isRunning(): boolean;
23
+ receive(response: DataChannelLatencyTestResponse): void;
24
+ sendRequest(requestSize: number, responseSize: number): void;
25
+ createRequest(requestSize: number, responseSize: number): DataChannelLatencyTestRequest;
26
+ }
@@ -0,0 +1,46 @@
1
+ /**
2
+ * Data Channel Latency Test types
3
+ */
4
+ /**
5
+ * Unix epoch
6
+ */
7
+ export type DataChannelLatencyTestTimestamp = number;
8
+ /**
9
+ * Sequence number represented by unsigned int
10
+ */
11
+ export type DataChannelLatencyTestSeq = number;
12
+ /**
13
+ * Request sent to Streamer
14
+ */
15
+ export type DataChannelLatencyTestRequest = {
16
+ Seq: DataChannelLatencyTestSeq;
17
+ FillResponseSize: number;
18
+ Filler: string;
19
+ };
20
+ /**
21
+ * Response from the Streamer
22
+ */
23
+ export type DataChannelLatencyTestResponse = {
24
+ Seq: DataChannelLatencyTestSeq;
25
+ Filler: string;
26
+ ReceivedTimestamp: DataChannelLatencyTestTimestamp;
27
+ SentTimestamp: DataChannelLatencyTestTimestamp;
28
+ };
29
+ export type DataChannelLatencyTestResult = {
30
+ records: Map<DataChannelLatencyTestSeq, DataChannelLatencyTestRecord>;
31
+ dataChannelRtt: number;
32
+ playerToStreamerTime: number;
33
+ streamerToPlayerTime: number;
34
+ exportLatencyAsCSV: () => string;
35
+ };
36
+ export declare class DataChannelLatencyTestRecord {
37
+ seq: DataChannelLatencyTestSeq;
38
+ playerSentTimestamp: DataChannelLatencyTestTimestamp;
39
+ playerReceivedTimestamp: DataChannelLatencyTestTimestamp;
40
+ streamerReceivedTimestamp: DataChannelLatencyTestTimestamp;
41
+ streamerSentTimestamp: DataChannelLatencyTestTimestamp;
42
+ requestFillerSize: number;
43
+ responseFillerSize: number;
44
+ constructor(request: DataChannelLatencyTestRequest);
45
+ update(response: DataChannelLatencyTestResponse): void;
46
+ }
@@ -0,0 +1,21 @@
1
+ import { DataChannelController } from './DataChannelController';
2
+ /**
3
+ * A class for sending data channel messages
4
+ */
5
+ export declare class DataChannelSender {
6
+ dataChannelProvider: DataChannelController;
7
+ /**
8
+ * @param dataChannelProvider - Data channel object type
9
+ */
10
+ constructor(dataChannelProvider: DataChannelController);
11
+ canSend(): boolean;
12
+ /**
13
+ * Send Data over the Data channel to the UE Instance
14
+ * @param data - Message Data Array Buffer
15
+ */
16
+ sendData(data: ArrayBuffer): void;
17
+ /**
18
+ * An override method for resetting the Afk warning timer when data is sent over the data channel
19
+ */
20
+ resetAfkWarningTimerOnDataSend(): void;
21
+ }
@@ -0,0 +1,44 @@
1
+ /**
2
+ * Latency Test Results Data
3
+ */
4
+ export declare class InitialSettings {
5
+ PixelStreamingSettings: PixelStreamingSettings;
6
+ EncoderSettings: EncoderSettings;
7
+ WebRTCSettings: WebRTCSettings;
8
+ constructor();
9
+ /**
10
+ * Checks for compatibility with the FPS and MaxFPS stats between 4.27 and 5
11
+ */
12
+ ueCompatible(): void;
13
+ }
14
+ /**
15
+ * A class for handling Pixel Streaming details
16
+ */
17
+ export declare class PixelStreamingSettings {
18
+ AllowPixelStreamingCommands?: boolean;
19
+ DisableLatencyTest?: boolean;
20
+ }
21
+ /**
22
+ * A class for handling encoder stats
23
+ */
24
+ export declare class EncoderSettings {
25
+ TargetBitrate?: number;
26
+ MaxBitrate?: number;
27
+ MinQP?: number;
28
+ MaxQP?: number;
29
+ RateControl?: 'CBR' | 'VBR' | 'ConstQP';
30
+ FillerData?: boolean;
31
+ MultiPass?: 'DISABLED' | 'QUARTER' | 'FULL';
32
+ }
33
+ /**
34
+ * A class for handling web rtc stats
35
+ */
36
+ export declare class WebRTCSettings {
37
+ DegradationPref?: 'BALANCED' | 'MAINTAIN_FRAMERATE' | 'MAINTAIN_RESOLUTION';
38
+ MinBitrate?: number;
39
+ MaxBitrate?: number;
40
+ LowQP?: number;
41
+ HighQP?: number;
42
+ MaxFPS?: number;
43
+ FPS?: number;
44
+ }
@@ -0,0 +1,31 @@
1
+ /**
2
+ * Latency Test Results Data
3
+ */
4
+ export declare class LatencyTestResults {
5
+ ReceiptTimeMs: number;
6
+ TransmissionTimeMs: number;
7
+ PreCaptureTimeMs: number;
8
+ PostCaptureTimeMs: number;
9
+ PreEncodeTimeMs: number;
10
+ PostEncodeTimeMs: number;
11
+ EncodeMs: number;
12
+ CaptureToSendMs: number;
13
+ testStartTimeMs: number;
14
+ browserReceiptTimeMs: number;
15
+ latencyExcludingDecode: number;
16
+ testDuration: number;
17
+ networkLatency: number;
18
+ browserSendLatency: number;
19
+ frameDisplayDeltaTimeMs: number;
20
+ endToEndLatency: number;
21
+ encodeLatency: number;
22
+ /**
23
+ * Sets the Delta Time Milliseconds
24
+ * @param DeltaTimeMs - Delta Time Milliseconds
25
+ */
26
+ setFrameDisplayDeltaTime(DeltaTimeMs: number): void;
27
+ /**
28
+ * Process the encoder times and set them
29
+ */
30
+ processFields(): void;
31
+ }
@@ -0,0 +1,36 @@
1
+ /**
2
+ * A class for managing the freeze frame object
3
+ */
4
+ export declare class FreezeFrame {
5
+ protected rootDiv: HTMLElement;
6
+ protected rootElement: HTMLDivElement;
7
+ imageElement: HTMLImageElement;
8
+ freezeFrameHeight: number;
9
+ freezeFrameWidth: number;
10
+ /**
11
+ * Construct a freeze frame
12
+ * @param rootDiv the div that a freeze frame element will be injected into
13
+ */
14
+ constructor(rootDiv: HTMLElement);
15
+ /**
16
+ * Set the freeze frame element for showing
17
+ */
18
+ setElementForShow(): void;
19
+ /**
20
+ * Set the freeze frame element for hiding
21
+ */
22
+ setElementForHide(): void;
23
+ /**
24
+ * Update the freeze frames image source
25
+ * @param jpeg - the freeze frame image as a byte array data
26
+ */
27
+ updateImageElementSource(jpeg: Uint8Array): void;
28
+ /**
29
+ * Set the dimensions for the freeze frame from the element and resize it
30
+ */
31
+ setDimensionsFromElementAndResize(): void;
32
+ /**
33
+ * Resize a freeze frame element
34
+ */
35
+ resize(): void;
36
+ }