@rongcloud/plugin-rtc 5.3.0-rtc-roompk.1 → 5.3.0

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,10 +1,10 @@
1
1
  /*
2
- * RCRTC - v5.3.0-rtc-roompk.1
3
- * CommitId - 381b45b74bd1cee88cf1e6e79108809734bb17ea
4
- * Sat Dec 25 2021 01:21:26 GMT+0800 (China Standard Time)
2
+ * RCRTC - v5.3.0
3
+ * CommitId - 0fcc19dd9364cd4effa9d9ad18172b0519bb4419
4
+ * Fri Jan 07 2022 16:25:27 GMT+0800 (China Standard Time)
5
5
  * ©2020 RongCloud, Inc. All rights reserved.
6
6
  */
7
- import { EventEmitter, LogLevel, RTCMode, IRuntime, RTCPluginContext, IServerRTCRoomEntry, IReceivedMessage, IJoinRTCRoomData, KVString, RTCJoinType, IRTCJoinedInfo, IPluginGenerator } from '@rongcloud/engine';
7
+ import { EventEmitter, LogLevel, RTCMode, IRuntime, RTCPluginContext, IServerRTCRoomEntry, IReceivedMessage, ErrorCode, IJoinRTCRoomData, KVString, RTCJoinType, IRTCJoinedInfo, IPluginGenerator } from '@rongcloud/engine';
8
8
  export { RTCJoinType } from '@rongcloud/engine';
9
9
 
10
10
  /**
@@ -912,7 +912,10 @@ interface IAudioLevelChangeHandler {
912
912
  declare type RoomData = {
913
913
  [userId: string]: IPublishedResource[];
914
914
  };
915
- interface IReqRoomPKOptions {
915
+ /**
916
+ * 业务层发起连麦、响应连麦可选参数定义
917
+ */
918
+ interface IReqResPKOptions {
916
919
  autoMix?: boolean;
917
920
  extra?: string;
918
921
  }
@@ -936,12 +939,18 @@ interface IPKInviteeBaseInfo {
936
939
  */
937
940
  inviteeUserId: string;
938
941
  }
942
+ /**
943
+ * 业务层监听收到连麦邀请、取消连麦的字段
944
+ */
939
945
  interface IPKInviteInfo extends IPKInviterBaseInfo {
940
946
  /**
941
947
  * 邀请额外信息
942
948
  */
943
949
  extra?: string;
944
950
  }
951
+ /**
952
+ * 业务层监听收到连麦应答的字段
953
+ */
945
954
  interface IPKInviteAnswerInfo extends IPKInviterBaseInfo, IPKInviteeBaseInfo {
946
955
  /**
947
956
  * 是否同意邀请
@@ -952,6 +961,9 @@ interface IPKInviteAnswerInfo extends IPKInviterBaseInfo, IPKInviteeBaseInfo {
952
961
  */
953
962
  extra?: string;
954
963
  }
964
+ /**
965
+ * 业务层监听收到连麦结束的字段
966
+ */
955
967
  interface IPKEndInfo {
956
968
  /**
957
969
  * 发起结束的房间 ID
@@ -963,18 +975,12 @@ interface IPKEndInfo {
963
975
  endUserId: string;
964
976
  }
965
977
  /**
966
- * 观众加房间返回给客户的数据
978
+ * 观众加房间返回给客户的 CDN 信息
967
979
  */
968
- interface IAudienceJoinRoomResInfo {
969
- remoteUserIds: string[];
970
- remoteRTCTracks: RCRemoteTrack[];
971
- remoteMCUTracks: RCRemoteTrack[];
972
- remoteTracks: RCRemoteTrack[];
973
- CDNUris: {
974
- resolution?: RCResolution;
975
- fps?: RCFrameRate;
976
- CDNEnable?: boolean;
977
- };
980
+ interface IJoinResCDNInfo {
981
+ resolution?: RCResolution;
982
+ fps?: RCFrameRate;
983
+ CDNEnable?: boolean;
978
984
  }
979
985
 
980
986
  declare enum RCInnerCDNPushMode {
@@ -2088,11 +2094,11 @@ declare class RCRTCPeerConnection extends EventEmitter {
2088
2094
  declare type IOnRecvPKMsg = (msg: IReceivedMessage) => void;
2089
2095
  interface IRoomPKEventListener {
2090
2096
  /**
2091
- * 收到连麦 PK 邀请
2097
+ * 收到连麦邀请
2092
2098
  */
2093
2099
  onRequestJoinOtherRoom: (info: IPKInviteInfo) => {};
2094
2100
  /**
2095
- * 收到连麦 PK 邀请取消
2101
+ * 收到取消连麦邀请
2096
2102
  */
2097
2103
  onCancelRequestOtherRoom: (info: IPKInviteInfo) => {};
2098
2104
  /**
@@ -2150,50 +2156,70 @@ declare class RCLivingPKHandler {
2150
2156
  */
2151
2157
  _onLeavePKRoom: (roomId: string) => void);
2152
2158
  private _callAppListener;
2159
+ /**
2160
+ * 收到连麦邀请
2161
+ */
2153
2162
  private _onInvite;
2163
+ /**
2164
+ * 收到取消连麦
2165
+ */
2154
2166
  private _onCancelInvite;
2155
2167
  private _onInviteTimeout;
2168
+ /**
2169
+ * 收到响应连麦
2170
+ */
2156
2171
  private _onInviteAnswer;
2172
+ /**
2173
+ * 收到连麦结束
2174
+ */
2157
2175
  private _onPKEnd;
2158
2176
  /**
2159
2177
  * 处理跨房间连麦相关消息
2160
2178
  */
2161
2179
  private _onRecvPKMsg;
2162
2180
  /**
2163
- * 跨房间连麦 PK 事件注册
2181
+ * 注册跨房间连麦监听事件
2164
2182
  */
2165
2183
  registerRoomPKEventListener(listener: IRoomPKEventListener): void;
2166
2184
  /**
2167
2185
  * 发起跨房间连麦请求
2168
- * @param inviteeRoomId 被邀请者所处的房间 ID
2169
- * @param inviteeUserId 被邀请者 ID
2170
- * @param options.autoMix 被邀请者的发布的资源在服务侧是否自动合流
2171
- * @param options.extra 拓展字段,用于邀请数据透传
2186
+ * @param inviteeRoomId 被邀请者所处的房间 roomId
2187
+ * @param inviteeUserId 被邀请者 userId
2188
+ * @param options.autoMix 是否要把邀请者发布的资源,合并到被邀请者房间内的 MCU 流中
2189
+ * @param options.extra 拓展字段,可随邀请连麦消息透传给被邀请者
2172
2190
  */
2173
- requestJoinOtherRoom(inviteeRoomId: string, inviteeUserId: string, options?: IReqRoomPKOptions): Promise<{
2174
- code: RCRTCCode;
2191
+ requestJoinOtherRoom(inviteeRoomId: string, inviteeUserId: string, options?: IReqResPKOptions): Promise<{
2192
+ code: RCRTCCode | ErrorCode;
2175
2193
  }>;
2176
2194
  /**
2177
- * 取消跨房间连麦 PK 请求
2195
+ * 取消跨房间连麦请求
2196
+ * @param inviteeRoomId 被邀请者所处的房间 roomId
2197
+ * @param inviteeUserId 被邀请者 userId
2198
+ * @param extra 附加信息,可随取消邀请连麦消息透传给被邀请者
2178
2199
  */
2179
2200
  cancelRequestJoinOtherRoom(inviteeRoomId: string, inviteeUserId: string, extra?: string): Promise<{
2180
- code: RCRTCCode;
2201
+ code: RCRTCCode | ErrorCode;
2181
2202
  }>;
2182
2203
  /**
2183
- * 跨房间连麦 PK 响应
2204
+ * 响应跨房间连麦请求
2205
+ * @param inviterRoomId 邀请者所处的房间 roomId
2206
+ * @param inviterUserId 邀请者 userId
2207
+ * @param agree 是否同意连麦
2208
+ * @param options.autoMix 是否要把被邀请者发布的资源,合并到邀请者房间内的 MCU 流中
2209
+ * @param options.extra 附加信息,可随响应连麦消息透传给邀请者
2184
2210
  */
2185
- responseJoinOtherRoom(inviterRoomId: string, inviterUserId: string, agree: boolean, options?: IReqRoomPKOptions): Promise<{
2186
- code: RCRTCCode;
2211
+ responseJoinOtherRoom(inviterRoomId: string, inviterUserId: string, agree: boolean, options?: IReqResPKOptions): Promise<{
2212
+ code: RCRTCCode | ErrorCode;
2187
2213
  }>;
2188
2214
  /**
2189
- * 结束跨房间连麦 PK
2190
- * @param roomId 需要退出 PK 的房间 ID
2215
+ * 结束跨房间连麦
2216
+ * @param roomId 需要结束连麦的房间 roomId
2191
2217
  */
2192
2218
  private _quitRoomPK;
2193
2219
  private _relaseCrtRoom;
2194
2220
  /**
2195
- * 加入 PK 直播房间
2196
- * @roomId PK 房间 ID
2221
+ * 加入副直播房间
2222
+ * @roomId 副房间的 roomId
2197
2223
  */
2198
2224
  joinOtherRoom(roomId: string): Promise<{
2199
2225
  code: RCRTCCode;
@@ -2203,14 +2229,16 @@ declare class RCLivingPKHandler {
2203
2229
  CDNEnable?: boolean;
2204
2230
  }>;
2205
2231
  /**
2206
- * 退出 PK 直播房间房间
2207
- * @param room 要离开的 PK 房间 room 实例
2232
+ * 退出副房间
2233
+ * @param room 要退出的副房间的 room 实例
2234
+ * @param isQuitPK 是否要结束连麦
2208
2235
  */
2209
2236
  leaveOtherRoom(room: RCLivingRoom, isQuitPK?: boolean): Promise<{
2210
2237
  code: RCRTCCode;
2211
2238
  }>;
2212
2239
  /**
2213
- * 获取 _PKInfo
2240
+ * 获取连麦信息
2241
+ * @param roomId 连麦房间的 roomId
2214
2242
  */
2215
2243
  getPKInfo(roomId: string): {
2216
2244
  inviteSessionId: string;
@@ -2221,7 +2249,7 @@ declare class RCLivingPKHandler {
2221
2249
  inviteeUserAutoMix?: boolean | undefined;
2222
2250
  };
2223
2251
  /**
2224
- * 获取已加入的 PK 房间
2252
+ * 获取已加入的副房间
2225
2253
  */
2226
2254
  getJoinedPKRooms(): {
2227
2255
  [roomId: string]: RCLivingRoom;
@@ -2453,6 +2481,14 @@ declare abstract class RCAbstractRoom {
2453
2481
  liveUrl?: string;
2454
2482
  }>;
2455
2483
  private __publish;
2484
+ /**
2485
+ * 获取跨房间连麦需携带参数 pushOtherRooms 的值
2486
+ */
2487
+ protected _getPushOtherRoomsParams(): {
2488
+ roomId: string;
2489
+ sessionId: string;
2490
+ autoMix: boolean;
2491
+ }[] | undefined;
2456
2492
  /**
2457
2493
  * ice 断线后,尝试重新走 exchange
2458
2494
  */
@@ -2569,15 +2605,18 @@ declare abstract class RCAbstractRoom {
2569
2605
  * 销毁远端资源
2570
2606
  */
2571
2607
  private _removeRemoteTracks;
2608
+ /**
2609
+ * 存储连麦监听事件
2610
+ */
2572
2611
  private _onRecvPKMsg;
2573
2612
  /**
2574
2613
  * 注册 PK 业务监听方法
2575
2614
  */
2576
- protected _registerPKMsgListener(listener: IOnRecvPKMsg): void;
2615
+ protected _registerPKMsgListener(listener: IOnRecvPKMsg | null): void;
2577
2616
  /**
2578
2617
  * 退出 PK 房间
2579
2618
  */
2580
- protected _quitPKRoom(): void;
2619
+ protected _quitAllPKRoom(): void;
2581
2620
  }
2582
2621
 
2583
2622
  /**
@@ -2778,7 +2817,9 @@ declare class RCLivingRoom extends RCAbstractRoom {
2778
2817
  /**
2779
2818
  * 获取 MCU 配置构建对象
2780
2819
  */
2781
- getMCUConfigBuilder(): RCMCUConfigBuilder;
2820
+ getMCUConfigBuilder(): RCMCUConfigBuilder | {
2821
+ code: RCRTCCode;
2822
+ };
2782
2823
  /**
2783
2824
  * 接收 MCU 配置并向 MediaServer 提交
2784
2825
  * @param data
@@ -2849,23 +2890,26 @@ declare class RCLivingRoom extends RCAbstractRoom {
2849
2890
  * 加入 PK 房间回调
2850
2891
  */
2851
2892
  private _onJoinedPKRoom;
2893
+ /**
2894
+ * 离开 PK 房间后,如果参与过连麦,pushOtherRooms 需去掉退出的连麦房间配置,重新和 mediaServer 交互
2895
+ */
2852
2896
  private _onLeavePKRoom;
2853
2897
  /**
2854
2898
  * 携带 pushOtherRooms 与 mediaServer 重新交互
2855
- * @param roomId 副房间 roomId
2856
2899
  */
2857
2900
  private _exchangeWithPushOtherRoom;
2858
2901
  /**
2859
2902
  * 获取 PK 业务处理器
2903
+ * @since version 5.3.0
2860
2904
  */
2861
2905
  getRoomPKHandler(): {
2862
2906
  code: RCRTCCode;
2863
2907
  roomPKHandler?: RCLivingPKHandler;
2864
2908
  };
2865
2909
  /**
2866
- * 退出 PK 房间
2910
+ * 退出所有连麦房间
2867
2911
  */
2868
- protected _quitPKRoom(): void;
2912
+ protected _quitAllPKRoom(): void;
2869
2913
  }
2870
2914
 
2871
2915
  /**
@@ -2952,6 +2996,10 @@ declare class RCRTCClient {
2952
2996
  private readonly _service;
2953
2997
  constructor(_context: RTCPluginContext, _runtime: IRuntime, _options: IRCRTCInitOptions);
2954
2998
  private _handleMessage;
2999
+ /**
3000
+ * 获取加入的连麦房间
3001
+ */
3002
+ private _getJoinedPKRoomList;
2955
3003
  /**
2956
3004
  * 获取当前用户 Id,若 IM 未连接,这返回 `''`
2957
3005
  * @returns
@@ -2987,7 +3035,6 @@ declare class RCRTCClient {
2987
3035
  * 获取直播观众客户端
2988
3036
  */
2989
3037
  getAudienceClient(): RCAudienceClient;
2990
- private _getJoinedPKRooms;
2991
3038
  private _onIMStatusChange;
2992
3039
  private _onIMDisconnect;
2993
3040
  private _onIMUninit;
@@ -3098,7 +3145,10 @@ declare class RCRTCClient {
3098
3145
  joinLivingRoomAsAudience(roomId: string, livingType: RCLivingType): Promise<{
3099
3146
  room?: RCAudienceLivingRoom;
3100
3147
  code: RCRTCCode;
3101
- remoteInfo?: IAudienceJoinRoomResInfo;
3148
+ userIds?: string[];
3149
+ RTCTracks?: RCRemoteTrack[];
3150
+ MCUTracks?: RCRemoteTrack[];
3151
+ CDNUris?: IJoinResCDNInfo;
3102
3152
  }>;
3103
3153
  /**
3104
3154
  * 观众退出并销毁当前房间实例,退出后该房间的所有方法将不可用
@@ -3113,6 +3163,8 @@ declare class RCRTCClient {
3113
3163
  upgradeToAnchorRoom(room: RCAudienceLivingRoom): Promise<{
3114
3164
  room?: RCLivingRoom;
3115
3165
  code: RCRTCCode;
3166
+ userIds?: string[];
3167
+ tracks?: RCRemoteTrack[];
3116
3168
  }>;
3117
3169
  /**
3118
3170
  * 降级为观众房间
@@ -3121,7 +3173,10 @@ declare class RCRTCClient {
3121
3173
  downgradeToAudienceRoom(room: RCLivingRoom): Promise<{
3122
3174
  room?: RCAudienceLivingRoom;
3123
3175
  code: RCRTCCode;
3124
- remoteInfo?: IAudienceJoinRoomResInfo;
3176
+ userIds?: string[];
3177
+ RTCTracks?: RCRemoteTrack[];
3178
+ MCUTracks?: RCRemoteTrack[];
3179
+ CDNUris?: IJoinResCDNInfo;
3125
3180
  }>;
3126
3181
  /**
3127
3182
  * 获取在房间内用户信息
@@ -3180,4 +3235,4 @@ declare const helper: {
3180
3235
  ifSupportScreenShare: typeof ifSupportScreenShare;
3181
3236
  };
3182
3237
 
3183
- export { BackgroundPictureFillMode, ICameraVideoProfile, IMCUOutputConfig, IMCUOutputVideoConfig, IMicphoneAudioProfile, IPKEndInfo, IPKInviteAnswerInfo, IPKInviteInfo, IPublishAttrs, IPublishedResource, IRCCandidatePairStat, IRCRTCInitOptions, IRCRTCReportListener, IRCRTCStateReport, IRCTrackStat, IRoomEventListener, IRoomPKEventListener, ISubscribeAttr, IVideoProfile, MixLayoutMode, MixVideoRenderMode, RCAbstractRoom, RCAudienceClient, RCAudienceLivingRoom, RCCameraVideoTrack, RCFrameRate, RCInnerCDNPullIsHttps, RCInnerCDNPullKind, RCKickReason, RCLivingRoom, RCLivingType, RCLocalAudioTrack, RCLocalFileAudioTrack, RCLocalFileTrack, RCLocalFileVideoTrack, RCLocalTrack, RCLocalVideoTrack, RCMCUConfigBuilder, RCMediaType, RCMicphoneAudioTrack, RCRTCClient, RCRTCCode, RCRTCLiveRole, RCRTCPingResult, RCRTCRoom, RCRemoteAudioTrack, RCRemoteTrack, RCRemoteVideoTrack, RCResolution, RCScreenVideoTrack, RCTag, RCTrack, device, helper, installer };
3238
+ export { BackgroundPictureFillMode, ICameraVideoProfile, IMCUOutputConfig, IMCUOutputVideoConfig, IMicphoneAudioProfile, IPKEndInfo, IPKInviteAnswerInfo, IPKInviteInfo, IPublishAttrs, IPublishedResource, IRCCandidatePairStat, IRCRTCInitOptions, IRCRTCReportListener, IRCRTCStateReport, IRCTrackStat, IReqResPKOptions, IRoomEventListener, IRoomPKEventListener, ISubscribeAttr, IVideoProfile, MixLayoutMode, MixVideoRenderMode, RCAbstractRoom, RCAudienceClient, RCAudienceLivingRoom, RCCameraVideoTrack, RCFrameRate, RCInnerCDNPullIsHttps, RCInnerCDNPullKind, RCKickReason, RCLivingRoom, RCLivingType, RCLocalAudioTrack, RCLocalFileAudioTrack, RCLocalFileTrack, RCLocalFileVideoTrack, RCLocalTrack, RCLocalVideoTrack, RCMCUConfigBuilder, RCMediaType, RCMicphoneAudioTrack, RCRTCClient, RCRTCCode, RCRTCLiveRole, RCRTCPingResult, RCRTCRoom, RCRemoteAudioTrack, RCRemoteTrack, RCRemoteVideoTrack, RCResolution, RCScreenVideoTrack, RCTag, RCTrack, device, helper, installer };