@rongcloud/plugin-rtc 5.4.0 → 5.4.1-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.4.0
3
- * CommitId - 562068f2adb928d8219691b74b411d02855494db
4
- * Mon May 09 2022 17:05:01 GMT+0800 (China Standard Time)
2
+ * RCRTC - v5.4.1-alpha.1
3
+ * CommitId - ef361465533e3461fd5625b413b1b5053e2fa20e
4
+ * Mon Jun 06 2022 15:31:43 GMT+0800 (China Standard Time)
5
5
  * ©2020 RongCloud, Inc. All rights reserved.
6
6
  */
7
7
  import { EventEmitter, IReceivedMessage, RTCPluginContext, IRuntime, ErrorCode, RTCMode, IJoinRTCRoomData, KVString, IServerRTCRoomEntry, LogLevel, RTCJoinType, IRTCUserData, IRTCJoinedInfo, IPluginGenerator } from '@rongcloud/engine';
@@ -493,6 +493,7 @@ declare class RCLivingPKHandler {
493
493
  * 退出 PK 房间回调
494
494
  */
495
495
  private readonly _onLeavePKRoom;
496
+ protected readonly _clientSessionId?: string | undefined;
496
497
  /**
497
498
  * PK 邀请超时时间,默认 30s
498
499
  */
@@ -518,7 +519,7 @@ declare class RCLivingPKHandler {
518
519
  /**
519
520
  * 退出 PK 房间回调
520
521
  */
521
- _onLeavePKRoom: (roomId: string) => void);
522
+ _onLeavePKRoom: (roomId: string) => void, _clientSessionId?: string | undefined);
522
523
  private _callAppListener;
523
524
  /**
524
525
  * 收到连麦邀请
@@ -609,7 +610,10 @@ declare class RCLivingPKHandler {
609
610
  inviteSessionId: string;
610
611
  inviterRoomId: string;
611
612
  inviterUserId: string;
612
- inviterUserAutoMix?: boolean | undefined;
613
+ inviterUserAutoMix?: boolean | undefined; /**
614
+ * 加入副直播房间
615
+ * @roomId 副房间的 roomId
616
+ */
613
617
  inviteeRoomId: string;
614
618
  inviteeUserAutoMix?: boolean | undefined;
615
619
  };
@@ -643,7 +647,7 @@ declare class RCRTCPeerCManager {
643
647
  */
644
648
  private readonly _polarisReport?;
645
649
  /**
646
- * 存储创建的所有 peerC,key 为 pcName
650
+ * 存储创建的所有 peerC,key 为 pcName,/exchange 请求中 request header 中的 Peer-Connection-Id 值
647
651
  */
648
652
  private _mutilPeerC;
649
653
  constructor(
@@ -709,10 +713,6 @@ declare class RCRTCPeerCManager {
709
713
  * 获取某一个 peerC
710
714
  */
711
715
  getPCItemByPCName(pcName: string): {
712
- /**
713
- * /exchange 请求中 request header 中的 Peer-Connection-Id 值
714
- */
715
- pcId: string;
716
716
  /**
717
717
  * RCRTCPeerConnection 对象
718
718
  */
@@ -747,10 +747,6 @@ declare class RCRTCPeerCManager {
747
747
  */
748
748
  getMutilPeerCData(): {
749
749
  [key: string]: {
750
- /**
751
- * /exchange 请求中 request header 中的 Peer-Connection-Id 值
752
- */
753
- pcId: string;
754
750
  /**
755
751
  * RCRTCPeerConnection 对象
756
752
  */
@@ -804,6 +800,7 @@ declare abstract class RCAbstractRoom {
804
800
  * 是否使用多 peerConnection
805
801
  */
806
802
  protected readonly _useMutilPeerC?: boolean | undefined;
803
+ protected readonly _clientSessionId?: string | undefined;
807
804
  /**
808
805
  * 房间资源数据
809
806
  */
@@ -848,7 +845,7 @@ declare abstract class RCAbstractRoom {
848
845
  /**
849
846
  * 是否使用多 peerConnection
850
847
  */
851
- _useMutilPeerC?: boolean | undefined);
848
+ _useMutilPeerC?: boolean | undefined, _clientSessionId?: string | undefined);
852
849
  private _initRemoteTracks;
853
850
  private _handlePingResult;
854
851
  /**
@@ -999,6 +996,11 @@ declare abstract class RCAbstractRoom {
999
996
  * 退出并销毁当前房间实例,退出后该房间的所有方法将不可用
1000
997
  */
1001
998
  __destroy(quitRoom: boolean): Promise<void>;
999
+ /**
1000
+ * 退出房间之前禁用所有远端资源,避免退出动作耗时过长,
1001
+ * 导致在未完全退出的过程中仍能听到房间内的声音问题
1002
+ */
1003
+ private _muteRemoteTracksBeforeQuit;
1002
1004
  private _leaveHandle;
1003
1005
  /**
1004
1006
  * 释放 PCManager 上的资源
@@ -1034,11 +1036,11 @@ declare abstract class RCAbstractRoom {
1034
1036
  * ice 断线后,尝试重新走 exchange
1035
1037
  */
1036
1038
  protected _reTryExchange(pcName: string, isPub: boolean): Promise<void>;
1037
- protected _exchangeHandle(body: IExchangeReqBody, pcId: string): Promise<{
1039
+ protected _exchangeHandle(body: IExchangeReqBody, pcName: string): Promise<{
1038
1040
  code: RCRTCCode;
1039
1041
  data?: IExchangeResponse | undefined;
1040
1042
  }>;
1041
- protected _getRTCReqestHeaders(pcId?: string): IRTCReqHeader;
1043
+ protected _getRTCReqestHeaders(pcName: string): IRTCReqHeader;
1042
1044
  /**
1043
1045
  * 获取 exchange 接口的请求体数据
1044
1046
  * @param subscribeList 订阅清单
@@ -1158,6 +1160,7 @@ declare abstract class RCAbstractRoom {
1158
1160
  * 退出 PK 房间
1159
1161
  */
1160
1162
  protected _quitAllPKRoom(): void;
1163
+ getClientSessionId(): string | undefined;
1161
1164
  }
1162
1165
 
1163
1166
  declare class RCLocalMediaStream {
@@ -1247,6 +1250,7 @@ declare class RCAudienceLivingRoom {
1247
1250
  private readonly _joinResData;
1248
1251
  readonly _livingType: RCLivingType;
1249
1252
  private _useMutilPeerC?;
1253
+ protected readonly _clientSessionId?: string | undefined;
1250
1254
  private readonly _service;
1251
1255
  /**
1252
1256
  * 主播列表
@@ -1284,7 +1288,7 @@ declare class RCAudienceLivingRoom {
1284
1288
  /**
1285
1289
  * 使用的 peerConnection 对应 id
1286
1290
  */
1287
- private _pcId;
1291
+ private _pcName;
1288
1292
  /**
1289
1293
  * peerConnection 管理类
1290
1294
  */
@@ -1292,7 +1296,7 @@ declare class RCAudienceLivingRoom {
1292
1296
  constructor(_context: RTCPluginContext, _runtime: IRuntime, _initOptions: IRCRTCInitOptions, _roomId: string, _joinResData: {
1293
1297
  token: string;
1294
1298
  kvEntries: IServerRTCRoomEntry[];
1295
- }, _livingType: RCLivingType, _useMutilPeerC?: boolean | undefined);
1299
+ }, _livingType: RCLivingType, _useMutilPeerC?: boolean | undefined, _clientSessionId?: string | undefined);
1296
1300
  /**
1297
1301
  * 解析服务端返回的 KV 数据,赋值 room 内数据
1298
1302
  */
@@ -1474,6 +1478,7 @@ declare class RCAudienceLivingRoom {
1474
1478
  resolution?: undefined;
1475
1479
  fps?: undefined;
1476
1480
  };
1481
+ getClientSessionId(): string | undefined;
1477
1482
  }
1478
1483
 
1479
1484
  /**
@@ -1508,7 +1513,7 @@ declare class PolarisReporter {
1508
1513
  * @param resourceId userId_11_1_tiny 改为 userId_11_tiny_video
1509
1514
  */
1510
1515
  private _getPolarisTrackId;
1511
- sendR3R4Data(data: IInnerRCRTCStateReport): void;
1516
+ sendR3R4Data(data: IInnerRCRTCStateReport): Promise<boolean>;
1512
1517
  /**
1513
1518
  * 加入房间
1514
1519
  */
@@ -1543,6 +1548,7 @@ declare class RCRTCPeerConnection extends EventEmitter {
1543
1548
  private pubLocalTracks;
1544
1549
  private _reTryExchangeTimer;
1545
1550
  private _reportStatsTimer;
1551
+ private _reportR3R4ToPolarisTimer;
1546
1552
  constructor(
1547
1553
  /**
1548
1554
  * peerConnection 对应名称
@@ -1597,6 +1603,14 @@ declare class RCRTCPeerConnection extends EventEmitter {
1597
1603
  * @todo
1598
1604
  */
1599
1605
  private _reportHandle;
1606
+ /**
1607
+ * 北极星上报 R3、R4 数据
1608
+ */
1609
+ private _sendR3R4Data;
1610
+ /**
1611
+ * 2s 给北极星上报一次 R3、R4
1612
+ */
1613
+ __reportR3R4ToPolaris(): Promise<void>;
1600
1614
  getRTCPeerConn(): RTCPeerConnection;
1601
1615
  destroy(): void;
1602
1616
  clearReTryExchangeTimer(): void;
@@ -2085,13 +2099,9 @@ declare type TrackParam = RCLocalTrack | IPublishAttrs | RCRemoteTrack | ISubscr
2085
2099
  */
2086
2100
  interface IMutilPeerC {
2087
2101
  /**
2088
- * pcName
2102
+ * pcName,/exchange 请求中 request header 中的 Peer-Connection-Id 值
2089
2103
  */
2090
2104
  pcName: string;
2091
- /**
2092
- * /exchange 请求中 request header 中的 Peer-Connection-Id 值
2093
- */
2094
- pcId: string;
2095
2105
  /**
2096
2106
  * RCRTCPeerConnection 对象
2097
2107
  */
@@ -2225,6 +2235,10 @@ interface IRTCReqHeader {
2225
2235
  * peerConnection Id
2226
2236
  */
2227
2237
  'Peer-Connection-Id'?: string;
2238
+ /**
2239
+ * client-session-id 标识一个端用户进入房间后的唯一标识
2240
+ */
2241
+ 'Client-Session-Id'?: string;
2228
2242
  }
2229
2243
  interface IMCUReqHeaders {
2230
2244
  'App-Key': string;
@@ -3156,7 +3170,7 @@ declare class RCLivingRoom extends RCAbstractRoom {
3156
3170
  /**
3157
3171
  * 是否使用多 peerConnection
3158
3172
  */
3159
- useMutilPeerC?: boolean);
3173
+ useMutilPeerC?: boolean, _clientSessionId?: string);
3160
3174
  /**
3161
3175
  * resourceId 有效性验证
3162
3176
  * @param resourceId
@@ -3217,7 +3231,7 @@ declare class RCLivingRoom extends RCAbstractRoom {
3217
3231
  /**
3218
3232
  * 重写父类 _exchangeHandle 方法
3219
3233
  */
3220
- protected _exchangeHandle(body: IExchangeReqBody, pcId: string): Promise<{
3234
+ protected _exchangeHandle(body: IExchangeReqBody, pcName: string): Promise<{
3221
3235
  code: RCRTCCode;
3222
3236
  data?: IExchangeResponse | undefined;
3223
3237
  }>;
@@ -3277,7 +3291,7 @@ declare class RCRTCRoom extends RCAbstractRoom {
3277
3291
  /**
3278
3292
  * 是否使用多 peerConnection
3279
3293
  */
3280
- useMutilPeerC?: boolean);
3294
+ useMutilPeerC?: boolean, _clientSessionId?: string);
3281
3295
  }
3282
3296
 
3283
3297
  /**
@@ -3289,6 +3303,7 @@ declare class RCAudienceClient {
3289
3303
  * 是否使用多 peerConnection
3290
3304
  */
3291
3305
  private readonly _useMutilPeerC?;
3306
+ private readonly _clientSessionId?;
3292
3307
  private _pc;
3293
3308
  private _service;
3294
3309
  /**
@@ -3310,7 +3325,7 @@ declare class RCAudienceClient {
3310
3325
  /**
3311
3326
  * 使用的 peerConnection 对应 id
3312
3327
  */
3313
- private _pcId;
3328
+ private _pcName;
3314
3329
  /**
3315
3330
  * peerConnection 管理类
3316
3331
  */
@@ -3319,7 +3334,7 @@ declare class RCAudienceClient {
3319
3334
  /**
3320
3335
  * 是否使用多 peerConnection
3321
3336
  */
3322
- _useMutilPeerC?: boolean | undefined);
3337
+ _useMutilPeerC?: boolean | undefined, _clientSessionId?: string | undefined);
3323
3338
  private _getReqHeaders;
3324
3339
  private _clearSubscribeInfo;
3325
3340
  private _livingType;