import { AgoraRtcMediaSourceState } from '../../../../core/rtc/type'; import { AgoraObservable } from '../../../../imports'; import { AgoraElectronSourceStatusMask } from './../type'; export declare enum RectifySourceStateResultAction { None = 0, StartCapture = 1, StopCapture = 2 } export type RectifySourceStateResult = { action: RectifySourceStateResultAction; sourceId: string; }; export interface RectifySourceStateParams { sourceId: string; isSourceCapture: boolean; } /** * 设备状态管理的基类 * 负责封装公共的属性和方法 * * @class SourceStateControlImpl * @description 提供模型的基础能力,子类可扩展具体业务逻辑 * @see loopback-state-control - 继承自 SourceStateControl 的loopback状态管理 * @see media-state-control - 继承自 SourceStateControl 的camera状态管理 * @see microphone-state-control - 继承自 SourceStateControl 的microphone状态管理 */ export interface SourceStateControlObserver { onSourceStateUpdated(sourceId: string, sourceStateEnabled: boolean): void; onSourceErrorOccurred(sourceId: string): void; } export interface SourceStateControl { get sourceIdList(): string[]; startSourceTest(sourceId: string): void; stopSourceTest(sourceId: string): void; openSource(sourceId: string): void; closeSource(sourceId: string): void; /** * Reset source state to OFF without notifying observers. * Used when RTC capture has been stopped but we cannot trigger upper layer callbacks yet. */ resetSourceSilently(sourceId: string): void; occurSourceError(sourceId: string): void; getSourceState(sourceId: string): AgoraRtcMediaSourceState; getSourceEnabledState(sourceId: string): boolean; addObserver(observer: SourceStateControlObserver): void; removeObserver(observer: SourceStateControlObserver): void; getSourceCaptureEnabled(sourceId: string): boolean; release(): void; } export declare class SourceStateControlImpl implements SourceStateControl { protected logger: import("agora-foundation/lib/logger/type").Logger; protected readonly observable: AgoraObservable; protected _sourceBitMaskMapping: Map; get sourceIdList(): string[]; release(): void; addObserver(observer: SourceStateControlObserver): void; removeObserver(observer: SourceStateControlObserver): void; startSourceTest(sourceId: string): void; stopSourceTest(sourceId: string): void; openSource(sourceId: string): void; closeSource(sourceId: string): void; resetSourceSilently(sourceId: string): void; occurSourceError(sourceId: string): void; getSourceState(sourceId: string): AgoraRtcMediaSourceState; getSourceEnabledState(sourceId: string): boolean; getSourceCaptureEnabled(sourceId: string): boolean; private _getSourceState; protected _getSourceBitmask(sourceId: string): AgoraElectronSourceStatusMask; private _getSourceEnabledState; private _updateSourceMask; }