import { BehaviorSubject, Observable } from 'rxjs'; import { BrowserPermission, BrowserPermissionState } from './BrowserPermission'; export type InputDeviceStatus = 'enabled' | 'disabled' | undefined; export type TrackDisableMode = 'stop-tracks' | 'disable-tracks'; export declare abstract class DeviceManagerState { protected statusSubject: BehaviorSubject; protected optimisticStatusSubject: BehaviorSubject; protected mediaStreamSubject: BehaviorSubject; protected selectedDeviceSubject: BehaviorSubject; protected defaultConstraintsSubject: BehaviorSubject; /** * @internal */ prevStatus: InputDeviceStatus; /** * An Observable that emits the current media stream, or `undefined` if the device is currently disabled. * */ mediaStream$: Observable; /** * An Observable that emits the currently selected device */ selectedDevice$: Observable; /** * An Observable that emits the device status */ status$: Observable; /** * An Observable the reflects the requested device status. Useful for optimistic UIs */ optimisticStatus$: Observable; /** * The default constraints for the device. */ defaultConstraints$: Observable; /** * An observable that will emit `true` if browser/system permission * is granted (or at least hasn't been denied), `false` otherwise. */ hasBrowserPermission$: Observable; /** * An observable that emits with browser permission state changes. * Gives more granular visiblity than hasBrowserPermission$. */ browserPermissionState$: Observable; /** * An observable that emits `true` when SDK is prompting for browser permission * (i.e. browser's UI for allowing or disallowing device access is visible) */ isPromptingPermission$: Observable; readonly disableMode: TrackDisableMode; /** * Constructs a new InputMediaDeviceManagerState instance. * * @param disableMode the disable mode to use. * @param permission the BrowserPermission to use for querying. * `undefined` means no permission is required. */ constructor(disableMode: TrackDisableMode, permission: BrowserPermission | undefined); /** * The device status */ get status(): InputDeviceStatus; /** * The requested device status. Useful for optimistic UIs */ get optimisticStatus(): InputDeviceStatus; /** * The currently selected device */ get selectedDevice(): string | undefined; /** * The current media stream, or `undefined` if the device is currently disabled. */ get mediaStream(): MediaStream | undefined; /** * @internal * @param status */ setStatus(status: InputDeviceStatus): void; /** * @internal * @param pendingStatus */ setPendingStatus(pendingStatus: InputDeviceStatus): void; /** * Updates the `mediaStream` state variable. * * @internal * @param stream the stream to set. * @param rootStream the root stream, applicable when filters are used * as this is the stream that holds the actual deviceId information. */ setMediaStream(stream: MediaStream | undefined, rootStream: MediaStream | undefined): void; /** * @internal * @param deviceId the device id to set. */ setDevice(deviceId: string | undefined): void; /** * Gets the default constraints for the device. */ get defaultConstraints(): C | undefined; /** * Sets the default constraints for the device. * * @internal * @param constraints the constraints to set. */ setDefaultConstraints(constraints: C | undefined): void; protected abstract getDeviceIdFromStream(stream: MediaStream): string | undefined; }