/** * XY WebRTC SDK Device Type * * Created at : 2024-06-07 17:19:09 * Last modified : 2024-06-07 17:25:44 */ /** * 采集权限状态 * * @param GRANTED granted - 已授权 * @param DENIED denied - 已拒绝 * @param PROMPT prompt - 询问中 * @param UNKNOWN unknown - 未知 * @param FAILED failed - 失败 */ export declare enum PermissionType { 'GRANTED' = "granted", 'DENIED' = "denied", 'PROMPT' = "prompt", 'UNKNOWN' = "unknown", 'FAILED' = "failed" } /** * 设备类型 * * @param AUDIOINPUT audioinput - 麦克风设备 * @param AUDIOOUTPUT audiooutput - 扬声器设备 * @param VIDEOINPUT videoinput - 摄像头设备 */ export declare enum DEVICE_KIND { 'AUDIOINPUT' = "audioInput", 'AUDIOOUTPUT' = "audioOutput", 'VIDEOINPUT' = "videoInput" } /** * 设备基本信息 * * @property { string } deviceId - 设备ID,切换设备时,需要使用此值 * @property { string } label - 设备名称 * @property { string } groupId - 设备分组 * @property { 'audioinput' | 'audiooutput' | 'videoinput' } kind - 设备类型 */ export type IDevice = { deviceId: string; label: string; kind: DEVICE_KIND; groupId: string; }; /** * 设备信息 * * @property { boolean } isSelected - 是否选中此设备 * @property { boolean } isDefault - 是否是默认设备 * @property { string } key - 设备唯一ID */ export interface IDeviceInfo extends IDevice { isSelected?: boolean; isDefault?: boolean; key?: string; } /** * 设备列表:麦克风、扬声器、摄像头 * * @property { IDeviceInfo[] } audioInputList - 麦克风列表 * @property { IDeviceInfo[] } audioOutputList - 扬声器列表 * @property { IDeviceInfo[] } videoInList - 摄像头列表 */ export interface IDeviceList { audioInputList: IDeviceInfo[]; audioOutputList: IDeviceInfo[]; videoInputList: IDeviceInfo[]; } /** * 指定设备的状态 * * @property INIT - 未设置指定设备,是默认值,不针对采集标记状态 * @property UNKNOWN - 指定设备:未知采集状态 * @property NORMAL - 指定设备:采集正常 * @property FAILED - 指定设备:采集失败 * @property LOST - 指定设备:设备丢失 */ export declare enum SpecifiedState { 'INIT' = "INIT", 'UNKNOWN' = "UNKNOWN", 'NORMAL' = "NORMAL", 'FAILED' = "FAILED", 'LOST' = "LOST" } /** * 用户指定设备配置 * * @property { boolean } isDefault - 是否当前是系统默认选项 * @property { string } deviceId - 设备ID * @property { SpecifiedState } state - 指定设备ID采集状态 */ export type ISpecifiedDeviceConfig = { isDefault: boolean; deviceId: string; state: SpecifiedState; }; /** * 当前设备模式 * * @param SYSTEM system - 系统默认模式 * @param SPECIFIED specified - 指定设备模式 */ export declare enum XYDeviceMode { 'SYSTEM' = "SYSTEM", 'SPECIFIED' = "SPECIFIED" } /** * 当前设备模式 * * @property { XYDeviceMode } audioInput - 麦克风设备 * @property { XYDeviceMode } audioOutput - 扬声器设备 * @property { XYDeviceMode } videoInput - 摄像头设备 */ export interface XYCurrentDeviceMode { audioInput: XYDeviceMode; audioOutput: XYDeviceMode; videoInput: XYDeviceMode; } /** * 用户指定设备信息 * * @property { ISpecifiedDeviceConfig } audioInput - 麦克风设备 * @property { ISpecifiedDeviceConfig } audioOutput - 扬声器设备 * @property { ISpecifiedDeviceConfig } videoInput - 摄像头设备 */ export type ISpecifiedDevice = { audioInput: ISpecifiedDeviceConfig; audioOutput: ISpecifiedDeviceConfig; videoInput: ISpecifiedDeviceConfig; }; /** * 当前已选择设备信息 * * @property { IDeviceInfo | null } audioInput - 麦克风列表设备 * @property { IDeviceInfo | null } audioOutput - 扬声器列表设备 * @property { IDeviceInfo | null } videoInput - 摄像头列表设备 */ export interface ISelectedDevice { audioInput: IDeviceInfo | null; videoInput: IDeviceInfo | null; audioOutput: IDeviceInfo | null; } /** * 当前已选择设备信息 * * @property { string } audioInput - 麦克风设备ID * @property { string } audioOutput - 扬声器设备ID * @property { string } videoInput - 摄像头设备ID */ export type IDeviceId = { audioInput: string; videoInput: string; audioOutput: string; }; /** * 设备变化后的最新列表数据和需要切换设备数据 * * @property { ISelectedDevice } nextDevice - 自动切换的设备数据 * @property { IDeviceList } detail - 最新设备列表数据,包含麦克风、扬声器、摄像头 */ export interface IDeviceManagerChangeValue { nextDevice: ISelectedDevice; detail: IDeviceList; } /** * 当前麦克风/摄像头权限 * * @property { PermissionType } microphone - 麦克风权限 * @property { PermissionType } camera - 摄像头权限 */ export interface ICurrentPermission { microphone: PermissionType; camera: PermissionType; } /** * 计算默认设备函数参数 * * @property { ISpecifiedDeviceConfig } specifiedDevice - 用户指定的设备信息 * @property { IDeviceInfo | null } sysDefaultDevice - 系统默认设备信息 * @property { IDeviceInfo[] } curList - 当前设备列表 * @property { IDeviceInfo[] } preList - 上一次设备列表 * */ export interface IDefaultDeviceIdParams { specifiedDevice: ISpecifiedDeviceConfig; sysDefaultDevice: IDeviceInfo | null; curList: IDeviceInfo[]; preList: IDeviceInfo[]; } /** * 正在使用的设备函数参数 * * @property { DEVICE_KIND } kind - 设备类型 * @property { string } deviceId - 设备ID */ export interface IUsedDeviceParams { kind: DEVICE_KIND; deviceId: string; } /** * 指定设备信息 * * @property { DEVICE_KIND } kind - 设备类型 * @property { string } deviceId - 设备ID * @property { boolean } isDefault - 是否是默认设备 */ export interface ISetSpecDevice extends IUsedDeviceParams { isDefault: boolean; } /** * 更新指定设备采集状态 */ export interface ISpecStateParams { kind: DEVICE_KIND; state: SpecifiedState; } /** * 缓存设备Label名称 */ export interface IDeviceLabelMap { [key: string]: string; }