@rongcloud/plugin-rtc 5.5.4-alpha.3 → 5.5.5-beem-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  /*
2
- * RCRTC - v5.5.4-alpha.3
3
- * CommitId - 3f61ac223f73eedac265c308f3a0f311af3985a7
4
- * Sun Oct 09 2022 21:12:19 GMT+0800 (China Standard Time)
2
+ * RCRTC - v5.5.5-beem-alpha.1
3
+ * CommitId - 4807d9272db7b224e762a75df11762453a730f9e
4
+ * Thu Oct 13 2022 21:01:14 GMT+0800 (China Standard Time)
5
5
  * ©2020 RongCloud, Inc. All rights reserved.
6
6
  */
7
7
  import { EventEmitter, BasicLogger, INaviInfo, RTCPluginContext, AbsCodec, IPromiseResult, ErrorCode, KVString, IRuntime, IAsyncRes, ConnectionStatus, ConversationType, ISendMsgOptions, IReceivedMessage, EnableLogL, IPluginGenerator } from '@rongcloud/engine';
@@ -540,11 +540,11 @@ declare enum RCRTCPingResult {
540
540
  */
541
541
  declare enum RCRTCLiveRole {
542
542
  /**
543
- * 主播
543
+ * 主播降级
544
544
  */
545
545
  ANCHOR = 1,
546
546
  /**
547
- * 观众
547
+ * 观众升级
548
548
  */
549
549
  AUDIENCE = 2
550
550
  }
@@ -1255,8 +1255,9 @@ declare enum RTCIdentityChangeType {
1255
1255
  }
1256
1256
 
1257
1257
  declare const keymaps: {
1258
- readonly RtcInput: readonly ["roomType", "broadcastType", "extraInnerData", "needSysChatroom", "identityChangeType", "joinType", "innerDatas", "outerDatas"];
1259
- readonly RtcUserListOutput: readonly ["users", "token", "sessionId", "roomInfo"];
1258
+ readonly RtcInput: readonly ["roomType", "broadcastType", "extraInnerData", "needSysChatroom", "identityChangeType", "joinType", "innerDatas", "outerDatas", "supportNtf"];
1259
+ readonly RtcOutput: readonly ["version"];
1260
+ readonly RtcUserListOutput: readonly ["users", "token", "sessionId", "roomInfo", "version"];
1260
1261
  readonly SetUserStatusInput: readonly ["status"];
1261
1262
  readonly RtcSetDataInput: readonly ["interior", "target", "key", "value", "objectName", "content"];
1262
1263
  readonly RtcUserSetDataInput: readonly ["valueInfo", "objectName", "content"];
@@ -1280,13 +1281,15 @@ declare const keymaps: {
1280
1281
  readonly RtcCancelInviteInput: readonly ["invitedUserId", "invitedRoomId", "inviteInfo", "inviteSessionId"];
1281
1282
  readonly RtcInviteAnswerInput: readonly ["inviteUserId", "answerCode", "inviteRoomId", "inviteSessionId", "content", "key", "value"];
1282
1283
  readonly RtcEndInviteInput: readonly ["inviteRoomId", "inviteSessionId", "inviteContent", "inviteRoomKeys"];
1284
+ readonly RtcRoomStatusInput: readonly ["version"];
1285
+ readonly RtcRoomStatusOutput: readonly ["bFullStatus", "version", "usersData", "roomStatus"];
1283
1286
  readonly RtcReportSDKInput: readonly ["sdkInfo"];
1284
1287
  readonly RCRTCPBPolaris: readonly ["type", "appKey", "sessionId", "roomId", "roomCreateTime", "userId", "userRole", "joinTime", "signalDataCenter", "r1Info", "r2Info", "r3Info", "r4Info"];
1285
1288
  readonly RCRTCPBR1Info: readonly ["joinTime", "rtcVersion", "imVersion", "platform", "device", "os", "browserName", "browserVersion"];
1286
1289
  readonly RCRTCPBR2Info: readonly ["joinTime", "sendTime", "rtcActionType", "rtcActionStatus", "trackId"];
1287
1290
  readonly RCRTCPBR3Info: readonly ["info"];
1288
1291
  readonly RCRTCPBR4Info: readonly ["info"];
1289
- readonly RCRTCPBStatusInfo: readonly ["joinTime", "totalBitRate", "appCPUUsage", "systemCPUUsage", "systemCPUFrequency", "networkStatus", "googleRTTNetwork", "ipAddress", "useReceiveBroadBand", "useSendBroadBand", "packetLossCount", "streams"];
1292
+ readonly RCRTCPBStatusInfo: readonly ["joinTime", "receiveTime", "totalBitRate", "appCPUUsage", "systemCPUUsage", "systemCPUFrequency", "networkStatus", "googleRTTNetwork", "ipAddress", "useReceiveBroadBand", "useSendBroadBand", "packetLossCount", "streams"];
1290
1293
  readonly RCRTCPBStreamInfo: readonly ["trackId", "codeName", "volume", "samplingRate", "bitRate", "packetLossRate", "frameRate", "resolution", "blockTime", "jitterData", "nAckCount", "pliCount", "googleRTTTotalTime", "isReceiveFirstFrameRate", "codeType", "isEnabled"];
1291
1294
  };
1292
1295
  declare type RTCKeyMaps = typeof keymaps;
@@ -1356,6 +1359,7 @@ interface IJoinRTCRoomData extends IRTCUsers {
1356
1359
  codeFormat?: string;
1357
1360
  roomCreateTime?: number;
1358
1361
  userJoinTime?: number;
1362
+ version: number;
1359
1363
  }
1360
1364
  interface IReqRoomPKOptions {
1361
1365
  /**
@@ -1545,6 +1549,15 @@ declare class RTCContext {
1545
1549
  endRoomPK(options: IEndRoomPKOptions): Promise<ErrorCode>;
1546
1550
  getRTCJoinedUserInfo(userId: string): Promise<IAsyncRes<IRTCJoinedInfo[]>>;
1547
1551
  pullRTCRoomEntry(roomId: string): Promise<IAsyncRes<IChrmKVPullData>>;
1552
+ /**
1553
+ * 通知拉取房间数据
1554
+ * @param roomId 房间 id
1555
+ * @param version 本地最大得房间数据版本号
1556
+ */
1557
+ pullRTCRoomStatus(roomId: string, version: number): Promise<{
1558
+ code: ErrorCode;
1559
+ data?: IPullRTCRoomStatus;
1560
+ }>;
1548
1561
  decodeRtcNotify(buffer: Uint8Array): {
1549
1562
  time: number;
1550
1563
  type: any;
@@ -1554,7 +1567,23 @@ declare class RTCContext {
1554
1567
  getNaviInfo(): IRTCNaviInfo | null;
1555
1568
  getConnectionStatus(): ConnectionStatus;
1556
1569
  getAppkey(): string;
1557
- rtcPing(roomId: string, roomMode: number, broadcastType?: number): Promise<ErrorCode>;
1570
+ /** web 端发 rtcPing */
1571
+ webRtcPing(roomId: string, roomMode: RTCMode, broadcastType?: number): Promise<{
1572
+ code: ErrorCode;
1573
+ data?: {
1574
+ version: number;
1575
+ };
1576
+ }>;
1577
+ /**
1578
+ * 协议栈 rtcping 依赖 imlib 编解码数据
1579
+ * web 单独走 imlib 提供的 rtcSignaling 方法,减少对 imlib 的依赖
1580
+ */
1581
+ rtcPing(roomId: string, roomMode: RTCMode, broadcastType?: number): Promise<{
1582
+ code: ErrorCode;
1583
+ data?: {
1584
+ version: number;
1585
+ } | undefined;
1586
+ }> | Promise<IAsyncRes<any>>;
1558
1587
  sendMessage(conversationType: ConversationType, targetId: string, options: ISendMsgOptions): IPromiseResult<IReceivedMessage>;
1559
1588
  registerRTCSignalListener(listener?: ((buffer: Uint8Array) => void) | undefined): void;
1560
1589
  registerConnectionStateChangeListener(listener: (status: ConnectionStatus) => void): void;
@@ -1907,6 +1936,7 @@ declare abstract class ReadableStore {
1907
1936
  protected _CDNUris: ICDNUris | null;
1908
1937
  protected _CDNEnable: boolean;
1909
1938
  protected _destroyed: boolean;
1939
+ protected _roomStatusVersion: number;
1910
1940
  constructor(context: RTCContext, service: RCMediaService, peerMgr: RCRTCPeerCManager, roomId: string, crtUserId: string, roomMode: RTCMode, polarisReport: PolarisHttpReporter, isUpgrade?: boolean | undefined, isMainRoom?: boolean | undefined);
1911
1941
  get useMutilPeerC(): boolean;
1912
1942
  getResourcesByUserId(userId: string): IPublishedResource[] | undefined;
@@ -1927,6 +1957,7 @@ declare abstract class ReadableStore {
1927
1957
  getTrackState(trackId: string): 0 | 1;
1928
1958
  getCDNEnable(): boolean;
1929
1959
  getCDNUris(): ICDNUris | null;
1960
+ getRoomStatusVersion(): number;
1930
1961
  }
1931
1962
  declare class Store extends ReadableStore {
1932
1963
  private _initRemoteTracks;
@@ -1941,6 +1972,7 @@ declare class Store extends ReadableStore {
1941
1972
  setCDNUris(uris: ICDNUris | null): void;
1942
1973
  resetSubscribedList(subscribeList: ISubscribeAttr[]): void;
1943
1974
  resetCollectSubscribeList(collectSubscribeList: ISubscribeAttr[]): void;
1975
+ setRoomStatusVersion(version: number): void;
1944
1976
  }
1945
1977
 
1946
1978
  declare enum CommandPriority {
@@ -2228,6 +2260,11 @@ declare abstract class RCAbstractRoom extends EventEmitter {
2228
2260
  * 是否使用多 peerConnection
2229
2261
  */
2230
2262
  _useMutilPeerC?: boolean | undefined, _clientSessionId?: string);
2263
+ /**
2264
+ * 拉取房间数据
2265
+ * @param roomId 房间 id
2266
+ */
2267
+ private _startPullRTCRoomStatus;
2231
2268
  __innerInit(mode: RTCMode, joinType?: RTCJoinType, livingType?: RCLivingType, innerUserDatas?: IRTCUserData, outerUserDatas?: IRTCUserData): Promise<{
2232
2269
  code: RCRTCCode | ErrorCode;
2233
2270
  data?: IJoinRTCRoomData;
@@ -3048,6 +3085,28 @@ declare class RCRTCPeerConnection extends EventEmitter {
3048
3085
  isDestroyed(): boolean;
3049
3086
  }
3050
3087
 
3088
+ /**
3089
+ * 通知拉取到的房间增量数据列表中每一项数据的动作
3090
+ */
3091
+ declare enum PullRoomStatusEvent {
3092
+ /**
3093
+ * 人员加入
3094
+ */
3095
+ JOIN = 0,
3096
+ /**
3097
+ * 人员离开
3098
+ */
3099
+ LEAVE = 1,
3100
+ /**
3101
+ * 人员离线
3102
+ */
3103
+ OFFLINE = 2,
3104
+ /**
3105
+ * 资源变动
3106
+ */
3107
+ RESOURCECHANGE = 3
3108
+ }
3109
+
3051
3110
  interface IRCTrackBitrate {
3052
3111
  /**
3053
3112
  * 最大码率
@@ -3441,6 +3500,10 @@ interface IR3R4CommonInfo {
3441
3500
  * 用户加入房间的时间
3442
3501
  */
3443
3502
  joinTime?: number;
3503
+ /**
3504
+ * 用户发布数据流的时间(毫秒),暂时由客户端生成,后期如果有问题服务端做兜底处理
3505
+ */
3506
+ receiveTime?: number;
3444
3507
  /**
3445
3508
  * 总码率
3446
3509
  */
@@ -3705,6 +3768,7 @@ interface IRCRTCInitOptions {
3705
3768
  * 观众拉内置 CDN 资源时是否使用 https,默认为 RCInnerCDNPullIsHttps.HTTPS
3706
3769
  */
3707
3770
  pullInnerCDNUseHttps?: RCInnerCDNPullIsHttps;
3771
+ signalRetryTime?: number;
3708
3772
  /**
3709
3773
  * 音频降噪处理
3710
3774
  * - workletModule 默认值为 https://cdn.ronghub.com/plugin-rtc/wasm/5.0.0-alpha.1/process-worklet.js
@@ -3864,6 +3928,79 @@ interface IChrmKVPullData {
3864
3928
  isFullUpdate?: boolean;
3865
3929
  syncTime?: number;
3866
3930
  }
3931
+ /**
3932
+ * 通知拉取到的房间数据
3933
+ */
3934
+ interface IPullRTCRoomStatus {
3935
+ /**
3936
+ * 是否是全量数据
3937
+ */
3938
+ bFullStatus: boolean;
3939
+ /**
3940
+ * 当前房间的最大版本号
3941
+ */
3942
+ version: number;
3943
+ /**
3944
+ * 如果是全量数据,usersData 不为空,给的是房间全部的人以及发布的资源
3945
+ */
3946
+ usersData: IPullRTCRoomUsersData[];
3947
+ /**
3948
+ * 房间增量数据
3949
+ */
3950
+ roomStatus: IRoomStatus[];
3951
+ }
3952
+ /**
3953
+ * 通知拉取到的房间增量数据
3954
+ */
3955
+ interface IRoomStatus {
3956
+ /**
3957
+ * 用户 id
3958
+ */
3959
+ userId: string;
3960
+ /**
3961
+ * 本次变更的动作类型
3962
+ */
3963
+ event: PullRoomStatusEvent;
3964
+ /**
3965
+ * 本次变更的版本号
3966
+ */
3967
+ time: number;
3968
+ /**
3969
+ * 用户变更的资源,event 为人员加入或资源变动时有值
3970
+ * key 包含 uris、cdn_uris、mcu_uris
3971
+ * value 为字符串数组
3972
+ */
3973
+ userData: {
3974
+ key: string;
3975
+ value: string;
3976
+ }[];
3977
+ /**
3978
+ * 切换角色,0 代表非切换身份发生的加入、退出房间行为
3979
+ */
3980
+ switchRoleType: RCRTCLiveRole | 0;
3981
+ /**
3982
+ * 额外的信息
3983
+ */
3984
+ extra: string;
3985
+ }
3986
+ /**
3987
+ * 通知拉取到的房间全量数据
3988
+ */
3989
+ interface IPullRTCRoomUsersData {
3990
+ /**
3991
+ * 用户 id
3992
+ */
3993
+ userId: string;
3994
+ /**
3995
+ * 房间内所有资源数据
3996
+ * key 包含 uris、cdn_uris、mcu_uris
3997
+ * value 为字符串数组
3998
+ */
3999
+ userData: {
4000
+ key: string;
4001
+ value: string;
4002
+ }[];
4003
+ }
3867
4004
 
3868
4005
  /**
3869
4006
  * 自定义合流布局时,背景图片填充方式
@@ -4399,7 +4536,7 @@ declare class RCMediaStreamCapture {
4399
4536
  declare class RCRTCClient extends RCMediaStreamCapture {
4400
4537
  protected readonly _context: RTCContext;
4401
4538
  private readonly _runtime;
4402
- private readonly _options;
4539
+ private _options;
4403
4540
  private readonly _service;
4404
4541
  constructor(_context: RTCContext, _runtime: IRuntime, _options: IRCRTCInitOptions);
4405
4542
  private _handleMessage;
@@ -4418,14 +4555,15 @@ declare class RCRTCClient extends RCMediaStreamCapture {
4418
4555
  getCurrentId(): string;
4419
4556
  private _crtRoom;
4420
4557
  /**
4421
- * 加入普通音视频房间
4422
- * @param roomId
4423
- * @param joinType 多端处理方式
4424
- * @param outerUserDatas 业务层设置人员属性
4425
- * @param useMutilPeerC 是否使用多 peerConnection 发布资源
4426
- * @param roomType 加入房间的类型 默认参数 RTCMode.RTC
4558
+ * > 加入普通音视频房间,返回房间对象、code、userIds、tracks
4559
+ * @param {string} roomId - 房间号
4560
+ * @param {RTCJoinType} [joinType] - 要加入的房间类型。
4561
+ * @param {IRTCUserData} [outerUserDatas] - 加入房间的用户的用户数据。
4562
+ * @param {boolean} [useMutilPeerC] - 是否使用多点连接,默认为false,即使用单点连接。
4563
+ * @param {RTCMode} roomType - RTCMode = RTCMode.RTC,
4564
+ * @param {number} signalRetryTime - 重新连接信令服务器的时间间隔。
4427
4565
  */
4428
- joinRTCRoom(roomId: string, joinType?: RTCJoinType, outerUserDatas?: IRTCUserData, useMutilPeerC?: boolean, roomType?: RTCMode): Promise<{
4566
+ joinRTCRoom(roomId: string, joinType?: RTCJoinType, outerUserDatas?: IRTCUserData, useMutilPeerC?: boolean, roomType?: RTCMode, signalRetryTime?: number): Promise<{
4429
4567
  room?: RCRTCRoom;
4430
4568
  code: RCRTCCode;
4431
4569
  userIds?: string[];