import { RTCEventType } from '../typings/rtc/eventType'; import { RTCProtocol } from '../typings/rtc/protocol'; import { RTCType } from '../typings/rtc/type'; import { Subscribe } from '../utils/subscribe'; /** * RTC 基础抽象类 * * 所有 RTC 实现的基类,定义了 RTC 协议的基本接口。 * 子类需要实现所有抽象方法和属性。 * * @example * ```typescript * class MyRTC extends CoreRTC { * joined = false * micro = false * voiceId = '' * type = RTCType.Custom * * async join(options) { * // 实现加入房间逻辑 * } * * async quit() { * // 实现退出房间逻辑 * } * * // 实现其他抽象方法... * } * ``` */ export declare abstract class CoreRTC extends Subscribe implements RTCProtocol { /** * 是否已加入语音房间 */ abstract joined: boolean; /** * 麦克风是否开启 */ abstract micro: boolean; /** * 当前语音房间ID */ abstract voiceId: string; /** * RTC 实现类型 */ abstract type: RTCType; /** * 加入语音房间 * * @param options 加入房间的选项 * @param options.voiceId 语音房间ID * @param options.userId 用户ID * @param options.roomId 房间ID(可选) * @param options.type RTC类型 * @returns Promise 是否成功加入房间 */ abstract join(options: { voiceId: string; userId: string; roomId: string | number | undefined; type: RTCType; }): Promise; /** * 退出语音房间 * * @returns Promise 是否成功退出房间 */ abstract quit(): Promise; /** * 检测麦克风权限 * * @returns Promise 是否有麦克风权限 */ abstract detectMicro(): Promise; /** * 切换麦克风状态 * * @param flag 是否开启麦克风,不传则切换当前状态 * @returns Promise 是否操作成功 */ abstract toggleMicro(flag?: boolean): Promise; /** * 震动(如果设备支持) */ abstract shock(): void; }