import { CheckResult } from 'trtc-js-sdk'; import { Subscribe } from '../../utils/subscribe'; import { RTCEventType } from './eventType'; import { RTCType } from './type'; /** * rtc 协议接口 * @interface * @extends Subscribe */ export interface RTCProtocol extends Subscribe { /** * 是否已经加入房间 * @type {boolean} */ joined: boolean; /** * 麦克风状态 * @type {boolean} */ micro: boolean; /** * 语音房间ID * @type {string} */ voiceId: string; /** * rtc 实现类型 * @type {RTCType} */ type: RTCType; /** * 检查rtc的系统依赖是否满足 * @returns {Promise} 返回一个Promise,表示检查结果 */ checkRequirement?(): Promise; /** * 加入房间。 * @param {Object} options - 加入房间的选项 * @param {string} options.voiceId - 语音房间ID * @param {string} options.userId - 用户ID * @param {string|number|undefined} options.roomId - 房间ID * @param {RTCType} options.type - RTC类型 * @returns {Promise} 返回一个Promise,表示是否成功加入房间 */ join(options: { voiceId: string; userId: string; roomId: string | number | undefined; type: RTCType; }): Promise; /** * 重新加入房间。 * @returns {Promise} 返回一个Promise,表示是否成功重新加入房间 */ reJoin?(): Promise; /** * 离开房间。 * @returns {Promise} 返回一个Promise,表示是否成功离开房间 */ quit(): Promise; /** * 监测麦克风授权。 * @returns {Promise} 返回一个Promise,表示麦克风是否被授权 */ detectMicro(): Promise; /** * 关闭\开启 本地麦克风。 * @param {boolean} [flag] - 是否开启麦克风,默认为切换当前状态 * @returns {Promise} 返回一个Promise,表示操作是否成功 */ toggleMicro(flag?: boolean): Promise; /** * 震动。 * @returns {void} */ shock?(): void; }