@rongcloud/plugin-wechat-rtc
Version:
@rongcloud/plugin-wechat-rtc
89 lines • 4.23 kB
TypeScript
import { ErrorCode, IAsyncRes, IPromiseResult, KVString, RTCPluginContext, ConversationType, ISendMsgOptions, IReceivedMessage, BasicLogger, RCConnectionStatus, Codec } from '@rongcloud/engine';
import { RTCMode } from '../enums/RTCMode';
import { RTCJoinType } from '../enums/RTCJoinType';
import { RTCApiType } from '../enums/inner/RTCApiType';
import { RTCKeyMaps } from './proto';
import { IRTCUserData, IJoinRTCRoomData, IRTCRoomInfo, IRTCUsers, IRtcTokenData, IRTCJoinedInfo, IRTCNaviInfo, IPullRTCRoomStatus } from './interface';
export declare class RTCContext {
private context;
logger: BasicLogger;
private codec;
roomCreateTime: number | undefined;
userJoinTime: number | undefined;
constructor(context: RTCPluginContext, logger: BasicLogger, codec: Codec<RTCKeyMaps>);
joinRTCRoom(roomId: string, mode: RTCMode, broadcastType?: number, joinType?: RTCJoinType, innerUserDatas?: IRTCUserData, outerUserDatas?: IRTCUserData, supportNtf?: boolean): IPromiseResult<IJoinRTCRoomData>;
quitRTCRoom(roomId: string): Promise<ErrorCode>;
getRTCRoomInfo(roomId: string): IPromiseResult<IRTCRoomInfo>;
removeRTCUserInfo(roomId: string, keys: string[]): Promise<ErrorCode>;
setRTCData(roomId: string, key: string, value: string, isInner: boolean, apiType: RTCApiType, message?: {
name: string;
content: string;
}): Promise<ErrorCode>;
/**
* 全量订阅资源修改
* @param roomId 房间 Id
* @param message 向前兼容的消息内容
* @param valueInfo 全量资源数据
* @param objectName 全量 URI 消息名
*/
setRTCTotalRes(roomId: string, messageList: {
name: string;
content: string;
}[], valueInfo: string, objectName: string, mcuValInfo?: string, cdnValInfo?: string): Promise<ErrorCode>;
getRTCData(roomId: string, keys: string[], isInner: boolean, apiType: RTCApiType): IPromiseResult<KVString>;
removeRTCData(roomId: string, keys: string[], isInner: boolean, apiType: RTCApiType, message?: {
name: string;
content: string;
}): Promise<ErrorCode>;
getRTCToken(roomId: string, mode: number, broadcastType?: number): IPromiseResult<IRtcTokenData>;
setRTCState(roomId: string, report: string): Promise<ErrorCode>;
getRTCUserList(roomId: string): IPromiseResult<IRTCUsers>;
getRTCJoinedUserInfo(userId: string): Promise<IAsyncRes<IRTCJoinedInfo[]>>;
/**
* 通知拉取房间数据
* @param roomId 房间 id
* @param version 本地最大得房间数据版本号
*/
pullRTCRoomStatus(roomId: string, version: number): Promise<{
code: ErrorCode;
data?: IPullRTCRoomStatus;
}>;
decodeRtcNotify(buffer: Uint8Array): {
time: number;
type: any;
roomId: any;
};
getCurrentId(): string;
getNaviInfo(): IRTCNaviInfo | null;
getConnectionStatus(): RCConnectionStatus;
getAppkey(): string;
/** web 端发 rtcPing */
webRtcPing(roomId: string, roomMode: RTCMode, broadcastType?: number): Promise<{
code: ErrorCode;
data?: {
version: number;
};
}>;
/**
* 协议栈 rtcping 依赖 imlib 编解码数据
* web 单独走 imlib 提供的 rtcSignaling 方法,减少对 imlib 的依赖
*/
rtcPing(roomId: string, roomMode: RTCMode, broadcastType?: number): Promise<{
code: ErrorCode;
data?: {
version: number;
} | undefined;
}>;
sendMessage(conversationType: ConversationType, targetId: string, options: ISendMsgOptions): IPromiseResult<IReceivedMessage>;
registerRTCSignalListener(listener?: ((buffer: Uint8Array) => void) | undefined): void;
registerConnectionStateChangeListener(listener: (status: RCConnectionStatus, code: ErrorCode) => void): void;
registerDisconnectListener(listener: () => void): void;
registerDestroyListener(listener: () => void): void;
registerMessageListener(listener: (message: IReceivedMessage) => boolean): void;
getCoreVersion(): string;
getPluginContext(): RTCPluginContext;
reportSDKInfo(versionInfo: {
[name: string]: string;
}): void;
}
//# sourceMappingURL=RTCContext.d.ts.map