import { SettingFlag } from './SettingFlag'; import { SettingNumber } from './SettingNumber'; import { SettingText } from './SettingText'; import { SettingOption } from './SettingOption'; import { PixelStreamingEventEmitter } from '../Util/EventEmitter'; /** * A collection of flags that can be toggled and are core to all Pixel Streaming experiences. * These are used in the `Config.Flags` map. */ export declare class Flags { static AutoConnect: "AutoConnect"; static AutoPlayVideo: "AutoPlayVideo"; static AFKDetection: "TimeoutIfIdle"; static HoveringMouseMode: "HoveringMouse"; static ForceMonoAudio: "ForceMonoAudio"; static ForceTURN: "ForceTURN"; static FakeMouseWithTouches: "FakeMouseWithTouches"; static IsQualityController: "ControlsQuality"; static MatchViewportResolution: "MatchViewportRes"; static StartVideoMuted: "StartVideoMuted"; static SuppressBrowserKeys: "SuppressBrowserKeys"; static UseMic: "UseMic"; static UseModalForTextInput: "UseModalForTextInput"; static UseCamera: "UseCamera"; static KeyboardInput: "KeyboardInput"; static MouseInput: "MouseInput"; static MouseDoubleClickAutoRelease: "MouseDoubleClickAutoRelease"; static TouchInput: "TouchInput"; static GamepadInput: "GamepadInput"; static XRControllerInput: "XRControllerInput"; static AutoEnterVR: "AutoEnterVR"; static WaitForStreamer: "WaitForStreamer"; static HideUI: "HideUI"; static EnableCaptureTimeExt: "EnableCaptureTimeExt"; static BrowserSendOffer: "BrowserSendOffer"; static LatencyCSV: "LatencyCSV"; } export type FlagsKeys = Exclude; export type FlagsIds = (typeof Flags)[FlagsKeys]; export declare const isFlagId: (id: string) => id is FlagsIds; /** * A collection of numeric parameters that are core to all Pixel Streaming experiences. * */ export declare class NumericParameters { static AFKTimeoutSecs: "AFKTimeout"; static AFKCountdownSecs: "AFKCountdown"; static MinQP: "MinQP"; static MaxQP: "MaxQP"; static MinQuality: "MinQuality"; static MaxQuality: "MaxQuality"; static CompatQualityMin: "CompatQualityMin"; static CompatQualityMax: "CompatQualityMax"; static WebRTCFPS: "WebRTCFPS"; static WebRTCMinBitrate: "WebRTCMinBitrate"; static WebRTCMaxBitrate: "WebRTCMaxBitrate"; static MaxReconnectAttempts: "MaxReconnectAttempts"; static StreamerAutoJoinInterval: "StreamerAutoJoinInterval"; static KeepaliveDelay: "KeepaliveDelay"; static ViewportResScale: "ViewportResScale"; } export type NumericParametersKeys = Exclude; export type NumericParametersIds = (typeof NumericParameters)[NumericParametersKeys]; export declare const isNumericId: (id: string) => id is NumericParametersIds; /** * A collection of textual parameters that are core to all Pixel Streaming experiences. * */ export declare class TextParameters { static SignallingServerUrl: "ss"; } export type TextParametersKeys = Exclude; export type TextParametersIds = (typeof TextParameters)[TextParametersKeys]; export declare const isTextId: (id: string) => id is TextParametersIds; /** * A collection of enum based parameters that are core to all Pixel Streaming experiences. * */ export declare class OptionParameters { static PreferredCodec: "PreferredCodec"; static StreamerId: "StreamerId"; static PreferredQuality: "PreferredQuality"; } export type OptionParametersKeys = Exclude; export type OptionParametersIds = (typeof OptionParameters)[OptionParametersKeys]; export declare const isOptionId: (id: string) => id is OptionParametersIds; /** * Utility types for inferring data type based on setting ID */ export type OptionIds = FlagsIds | NumericParametersIds | TextParametersIds | OptionParametersIds; export type OptionKeys = T extends FlagsIds ? boolean : T extends NumericParametersIds ? number : T extends TextParametersIds ? string : T extends OptionParametersIds ? string : never; export type AllSettings = { [K in OptionIds]: OptionKeys; }; export interface ConfigParams { /** Initial Pixel Streaming settings */ initialSettings?: Partial; /** If useUrlParams is set true, will read initial values from URL parameters and persist changed settings into URL */ useUrlParams?: boolean; /** If webSocketProtocols is set the protocols will be passed to the websocket constructor */ webSocketProtocols?: string | string[]; } export declare class Config { private flags; private numericParameters; private textParameters; private optionParameters; private _useUrlParams; private _webSocketProtocols?; constructor(config?: ConfigParams); /** * True if reading configuration initial values from URL parameters, and * persisting changes in URL when changed. */ get useUrlParams(): boolean; /** * Gets a protocol or list of protocols to pass to the websocket if set. */ get webSocketProtocols(): string | string[]; /** * Populate the default settings for a Pixel Streaming application */ private populateDefaultSettings; /** * Add a callback to fire when the numeric setting is toggled. * @param id The id of the flag. * @param onChangedListener The callback to fire when the numeric value changes. */ _addOnNumericSettingChangedListener(id: NumericParametersIds, onChangedListener: (newValue: number) => void): void; _addOnOptionSettingChangedListener(id: OptionParametersIds, onChangedListener: (newValue: string) => void): void; /** * @param id The id of the numeric setting we are interested in getting a value for. * @returns The numeric value stored in the parameter with the passed id. */ getNumericSettingValue(id: NumericParametersIds): number; /** * @param id The id of the numeric setting to check for. * @returns True if the numeric setting is registered in this Config. */ hasNumericSetting(id: NumericParametersIds): boolean; /** * @param id The id of the text setting we are interested in getting a value for. * @returns The text value stored in the parameter with the passed id. */ getTextSettingValue(id: TextParametersIds): string; /** * Set number in the setting. * @param id The id of the numeric setting we are interested in. * @param value The numeric value to set. */ setNumericSetting(id: NumericParametersIds, value: number): void; /** * Add a callback to fire when the flag is toggled. * @param id The id of the flag. * @param onChangeListener The callback to fire when the value changes. */ _addOnSettingChangedListener(id: FlagsIds, onChangeListener: (newFlagValue: boolean) => void): void; /** * Add a callback to fire when the text is changed. * @param id The id of the flag. * @param onChangeListener The callback to fire when the value changes. */ _addOnTextSettingChangedListener(id: TextParametersIds, onChangeListener: (newTextValue: string) => void): void; /** * Get the option which has the given id. * @param id The id of the option. * @returns The SettingOption object matching id */ getSettingOption(id: OptionParametersIds): SettingOption; /** * Get the value of the configuration flag which has the given id. * @param id The unique id for the flag. * @returns True if the flag is enabled. */ isFlagEnabled(id: FlagsIds): boolean; /** * Set flag to be enabled/disabled. * @param id The id of the flag to toggle. * @param flagEnabled True if the flag should be enabled. */ setFlagEnabled(id: FlagsIds, flagEnabled: boolean): void; /** * Set the text setting. * @param id The id of the setting * @param settingValue The value to set in the setting. */ setTextSetting(id: TextParametersIds, settingValue: string): void; /** * Set the option setting list of options. * @param id The id of the setting * @param settingOptions The values the setting could take */ setOptionSettingOptions(id: OptionParametersIds, settingOptions: Array): void; /** * Set option enum settings selected option. * @param id The id of the setting * @param settingOptions The value to select out of all the options */ setOptionSettingValue(id: OptionParametersIds, settingValue: string): void; /** * Set the label for the flag. * @param id The id of the flag. * @param label The new label to use for the flag. */ setFlagLabel(id: FlagsIds, label: string): void; /** * Set a subset of all settings in one function call. * * @param settings A (partial) list of settings to set */ setSettings(settings: Partial): void; /** * Get all settings * @returns All setting values as an object with setting ids as keys */ getSettings(): Partial; /** * Get all Flag settings as an array. * @returns All SettingFlag objects */ getFlags(): Array; /** * Get all Text settings as an array. * @returns All SettingText objects */ getTextSettings(): Array; /** * Get all Number settings as an array. * @returns All SettingNumber objects */ getNumericSettings(): Array; /** * Get all Option settings as an array. * @returns All SettingOption objects */ getOptionSettings(): Array; /** * Emit events when settings change. * @param eventEmitter */ _registerOnChangeEvents(eventEmitter: PixelStreamingEventEmitter): void; } /** * The enum associated with the mouse being locked or hovering */ export declare enum ControlSchemeType { LockedMouse = 0, HoveringMouse = 1 }