@rongcloud/plugin-rtc 5.6.17 → 5.6.18

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,4 +1,4 @@
1
- import { EventEmitter, BasicLogger, INaviInfo, EnableLogL, RTCPluginContext, Codec, IPromiseResult, ErrorCode, KVString, IRuntime, IAsyncRes, RCConnectionStatus, ConversationType, ISendMsgOptions, IReceivedMessage, RTCMode as RTCMode$1, IPluginGenerator } from '@rongcloud/engine';
1
+ import { EventEmitter, BasicLogger, INaviInfo, LogL, EnableLogL, RTCPluginContext, Codec, IPromiseResult, ErrorCode, KVString, IRuntime, IAsyncRes, RCConnectionStatus, ConversationType, ISendMsgOptions, IReceivedMessage, RTCMode as RTCMode$1, IPluginGenerator } from '@rongcloud/engine';
2
2
 
3
3
  /**
4
4
  * 错误码,与移动端对齐
@@ -240,6 +240,15 @@ declare abstract class RCTrack extends EventEmitter {
240
240
  */
241
241
  isOwnerMuted(): boolean;
242
242
  protected _element?: HTMLMediaElement;
243
+ private _validateVolume;
244
+ /**
245
+ * 播放前检测
246
+ */
247
+ private _validatePlayOptions;
248
+ /**
249
+ * 设置播放属性
250
+ */
251
+ private _setPlayAttrs;
243
252
  /**
244
253
  * 播放
245
254
  * @param element 用于承载媒体流的元素标签,音频流可传空
@@ -681,6 +690,12 @@ interface IRTCResponse {
681
690
  */
682
691
  'Request-Id': string;
683
692
  }
693
+ interface IExchangeResSubscribeItem {
694
+ mediaType: RCMediaType.AUDIO_ONLY | RCMediaType.VIDEO_ONLY;
695
+ msid: string;
696
+ userId: string;
697
+ simulcast?: RCStreamType;
698
+ }
684
699
  /**
685
700
  * /exchange 响应结果
686
701
  */
@@ -722,12 +737,7 @@ interface IExchangeResponse extends IRTCResponse {
722
737
  /**
723
738
  * 订阅成功的资源
724
739
  */
725
- subscribedList?: {
726
- mediaType: RCMediaType.AUDIO_ONLY | RCMediaType.VIDEO_ONLY;
727
- msid: string;
728
- userId: string;
729
- simulcast?: RCStreamType;
730
- }[];
740
+ subscribedList?: IExchangeResSubscribeItem[];
731
741
  }
732
742
  interface IBroadcastSubReqBody {
733
743
  /**
@@ -1867,9 +1877,10 @@ interface IRCRTCInitOptions {
1867
1877
  * * 2 - WARN
1868
1878
  * * 1 - ERROR
1869
1879
  */
1870
- logLevel?: EnableLogL;
1880
+ logLevel?: LogL.ERROR | LogL.WARN | LogL.INFO | LogL.DEBUG;
1871
1881
  /**
1872
- * 修改默认的 log 输出函数
1882
+ * (已废弃)~修改默认的 log 输出函数~
1883
+ * @deprecated 5.6.1
1873
1884
  */
1874
1885
  logStdout?: (logLevel: EnableLogL, content: string) => void;
1875
1886
  /**
@@ -2498,6 +2509,9 @@ declare class RTCContext {
2498
2509
  joinRTCRoom(roomId: string, mode: RTCMode, broadcastType?: number, joinType?: RTCJoinType, innerUserDatas?: IRTCUserData, outerUserDatas?: IRTCUserData, supportNtf?: boolean): IPromiseResult<IJoinRTCRoomData>;
2499
2510
  quitRTCRoom(roomId: string): Promise<ErrorCode>;
2500
2511
  getRTCRoomInfo(roomId: string): IPromiseResult<IRTCRoomInfo>;
2512
+ /**
2513
+ * 移动端用来获取副房间资源
2514
+ */
2501
2515
  getRTCUserInfoList(roomId: string): IPromiseResult<IRTCUsers>;
2502
2516
  getRTCUserInfo(roomId: string): IPromiseResult<unknown>;
2503
2517
  removeRTCUserInfo(roomId: string, keys: string[]): Promise<ErrorCode>;
@@ -2681,6 +2695,14 @@ declare class RCMediaService {
2681
2695
  * ping1 :ping 结果返回最快值
2682
2696
  */
2683
2697
  private setMediaServiceList;
2698
+ /**
2699
+ * 配置 gzip 请求头和请求体
2700
+ */
2701
+ private _openGzip;
2702
+ /**
2703
+ * 处理 request 成功的结果
2704
+ */
2705
+ private _dealRequestSuccessResult;
2684
2706
  /**
2685
2707
  * 发送请求,请求发送若失败,会继续尝试使用后续可用地址直到无地址可用,此时认为请求失败
2686
2708
  * @param path
@@ -2985,6 +3007,18 @@ declare class RCAudienceLivingRoom {
2985
3007
  * 计算新发布和取消发布的合流资源
2986
3008
  */
2987
3009
  private _diffRoomResource;
3010
+ /**
3011
+ * 处理主播资源的新增发布
3012
+ */
3013
+ private _dealPublished;
3014
+ /**
3015
+ * 处理主播资源的取消发布
3016
+ */
3017
+ private _dealUnpublished;
3018
+ /**
3019
+ * 处理主播资源的变更
3020
+ */
3021
+ private _dealModified;
2988
3022
  /**
2989
3023
  * 计算主播发布和取消发布的资源,以及资源的状态变更
2990
3024
  */
@@ -3018,6 +3052,12 @@ declare class RCAudienceLivingRoom {
3018
3052
  private _addPeerCEvent;
3019
3053
  private _getReqHeaders;
3020
3054
  private _exchangeHandle;
3055
+ private _dealSubscribeResult;
3056
+ /**
3057
+ * 去重、转化参数格式为 ISubscribeAttr
3058
+ */
3059
+ private _getParams;
3060
+ private _reportPubOrSubQualityData;
3021
3061
  private _updateSubListHandle;
3022
3062
  /**
3023
3063
  * 对比 cdn_uris 资源
@@ -3046,10 +3086,6 @@ declare class RCAudienceLivingRoom {
3046
3086
  code: RCRTCCode;
3047
3087
  failedList?: ISubscribeAttr[];
3048
3088
  }>;
3049
- addSubscribeTask(tracks: (RCRemoteTrack | ISubscribeAttr)[]): Promise<{
3050
- code: RCRTCCode;
3051
- failedList?: ISubscribeAttr[];
3052
- }>;
3053
3089
  private __unsubscribe;
3054
3090
  /**
3055
3091
  * 取消订阅资源
@@ -3059,10 +3095,6 @@ declare class RCAudienceLivingRoom {
3059
3095
  code: RCRTCCode;
3060
3096
  failedList?: ISubscribeAttr[];
3061
3097
  }>;
3062
- addUnsubscribeTask(tracks: RCRemoteTrack[]): Promise<{
3063
- code: RCRTCCode;
3064
- failedList?: ISubscribeAttr[];
3065
- }>;
3066
3098
  /**
3067
3099
  * 退出房间并销毁当前房间实例,退出后该房间的所有方法将不可用
3068
3100
  */
@@ -3180,7 +3212,30 @@ declare class PolarisReporter {
3180
3212
  * @param resourceId userId_11_1_tiny 改为 userId_11_tiny_video
3181
3213
  */
3182
3214
  private _getPolarisTrackId;
3183
- sendR3R4Data(data: IInnerRCRTCStateReport): Promise<RCSendCode>;
3215
+ /**
3216
+ * 上下行 track 包含的公共字段
3217
+ */
3218
+ private _getBaseData;
3219
+ private _getAudioLevel;
3220
+ private _getBitrate;
3221
+ private _getPacketsLostRate;
3222
+ private _getFrameRate;
3223
+ private _getResolution;
3224
+ private _getJitter;
3225
+ private _getNackCount;
3226
+ private _getPliCount;
3227
+ private _getRTT;
3228
+ private _getTrackState;
3229
+ /**
3230
+ * 发送上行音视频资源数据
3231
+ * @param data peerConnection stats 解析出来业务所需的所有字段
3232
+ */
3233
+ sendR3Data(data: IInnerRCRTCStateReport): Promise<RCSendCode>;
3234
+ /**
3235
+ * 发送下行音视频资源数据
3236
+ * @param data peerConnection stats 解析出来业务所需的所有字段
3237
+ */
3238
+ sendR4Data(data: IInnerRCRTCStateReport): Promise<RCSendCode>;
3184
3239
  /**
3185
3240
  * 加入房间
3186
3241
  */
@@ -3310,6 +3365,14 @@ declare class RCRTCPeerConnection extends EventEmitter {
3310
3365
  * @param listener
3311
3366
  */
3312
3367
  registerReportListener(listener: IRCRTCReportListener | null): void;
3368
+ /**
3369
+ * 组装上行质量报告数据
3370
+ */
3371
+ private _createSenderReport;
3372
+ /**
3373
+ * 组装下行质量报告数据
3374
+ */
3375
+ private _createReceiverReport;
3313
3376
  private _createRCRTCStateReport;
3314
3377
  /**
3315
3378
  * 获取 peerConnection stats 数据并格式化
@@ -3318,7 +3381,6 @@ declare class RCRTCPeerConnection extends EventEmitter {
3318
3381
  private _getStatsData;
3319
3382
  /**
3320
3383
  * 通知用户质量数据、peerConnection 北极星数据上报
3321
- * @todo
3322
3384
  */
3323
3385
  private _reportHandle;
3324
3386
  /**
@@ -3702,7 +3764,7 @@ declare class RCLivingPKHandler {
3702
3764
  /**
3703
3765
  * 加入 PK 房间回调
3704
3766
  */
3705
- _onJoinedPKRoom: (roomId: string, traceId: string) => void, _clientSessionId?: string | undefined);
3767
+ _onJoinedPKRoom: (roomId: string, traceId: string) => Promise<void>, _clientSessionId?: string | undefined);
3706
3768
  private _callAppListener;
3707
3769
  /**
3708
3770
  * 收到连麦邀请
@@ -3889,7 +3951,7 @@ declare abstract class RCAbstractRoom extends EventEmitter {
3889
3951
  private _onTrackReady;
3890
3952
  protected _callAppListener(eventType: keyof IRoomEventListener, ...attrs: any[]): void;
3891
3953
  private _onTrackUnpublish;
3892
- __parseInnerMessage(message: IReceivedMessage, traceId: string): boolean;
3954
+ __parseInnerMessage(message: IReceivedMessage, traceId: string): void;
3893
3955
  /**
3894
3956
  * 被踢出房间通知
3895
3957
  * @param byServer
@@ -4131,7 +4193,7 @@ declare abstract class RCAbstractRoom extends EventEmitter {
4131
4193
  /**
4132
4194
  * 退出 PK 房间
4133
4195
  */
4134
- protected _quitAllPKRoom(): void;
4196
+ protected _quitAllPKRoom(): Promise<void>;
4135
4197
  getClientSessionId(): string;
4136
4198
  }
4137
4199
 
@@ -4331,19 +4393,6 @@ declare class RCMCUConfigBuilder {
4331
4393
  * @param uri
4332
4394
  */
4333
4395
  removePictureWaterMark(trackId: string, uri: string): RCMCUConfigBuilder;
4334
- /**
4335
- * 设置 MCU 混流配置
4336
- * @param videoList 视频输入混流列表,为 null 代表视频全混流,为空集合代表视频全不混流,否则按照输入列表进行混流
4337
- * @param audioList 音频输入混流列表,为 null 代表音频全混流,为空集合代表音频全不混流,否则按照输入列表进行混流
4338
- */
4339
- /**
4340
- * 设置 MCU 混流配置
4341
- * @param roomIds 混流房间列表
4342
- * @param mediaType 混流媒体类型
4343
- * @param isAppend 是否为增量混流
4344
- * * true 为增量混流
4345
- * * false 为全量覆盖混流
4346
- */
4347
4396
  /**
4348
4397
  * 重置所有合流配置
4349
4398
  * @since v5.3.7
@@ -4630,6 +4679,14 @@ declare class RCMediaStreamCapture {
4630
4679
  tracks?: (RCScreenVideoTrack | RCScreenAudioTrack)[];
4631
4680
  }>;
4632
4681
  private _createScreenTracks;
4682
+ /**
4683
+ * electron 中取屏幕共享资源
4684
+ */
4685
+ private _createElectronScreenStream;
4686
+ /**
4687
+ * web 浏览器中取屏幕共享资源
4688
+ */
4689
+ private _createWebScreenStream;
4633
4690
  /**
4634
4691
  * 创建 RCLocalAudioTrack 实例
4635
4692
  * @param tag
@@ -4650,6 +4707,7 @@ declare class RCMediaStreamCapture {
4650
4707
  code: RCRTCCode;
4651
4708
  track?: RCLocalVideoTrack;
4652
4709
  }>;
4710
+ private _validateCreateLocalFileTracks;
4653
4711
  /**
4654
4712
  * 根据本地或网络媒体文件资源创建 `RCLocalFileTrack` 实例
4655
4713
  * @param tag 资源标识
@@ -4705,6 +4763,7 @@ declare class RCRTCClient extends RCMediaStreamCapture {
4705
4763
  */
4706
4764
  getCurrentId(): string;
4707
4765
  private _crtRoom;
4766
+ private __joinRoom;
4708
4767
  /**
4709
4768
  * 加入普通音视频房间,加入成功后返回 room 实例、code、userIds、tracks
4710
4769
  * @param {string} roomId - 房间号