@rongcloud/plugin-rtc 5.6.18-alpha.1 → 5.6.19

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
@@ -97,7 +97,13 @@ declare enum RCRTCCode {
97
97
  * @deprecated
98
98
  * 流状态为 ended
99
99
  */
100
- TRACK_READYSTATE_IS_ENDED = 53035
100
+ TRACK_READYSTATE_IS_ENDED = 53035,
101
+ /**
102
+ * 应用 3A 降噪必须在 publish 之前
103
+ */
104
+ APPLY_3A_NOISE_WORKLET_BEFORE_PUBLISH = 53036,
105
+ /** 加载 3A 降噪模块失败 */
106
+ LOAD_3A_MODULE_FAILED = 53037
101
107
  }
102
108
 
103
109
  /**
@@ -122,8 +128,7 @@ declare enum RCFrameRate {
122
128
  FPS_10 = "FPS_10",
123
129
  FPS_15 = "FPS_15",
124
130
  FPS_24 = "FPS_24",
125
- FPS_30 = "FPS_30",
126
- FPS_60 = "FPS_60"
131
+ FPS_30 = "FPS_30"
127
132
  }
128
133
 
129
134
  declare enum RCResolution {
@@ -145,8 +150,6 @@ declare enum RCResolution {
145
150
  W960_H720 = "W960_H720",
146
151
  W1280_H720 = "W1280_H720",
147
152
  W1920_H1080 = "W1920_H1080",
148
- W2560_H1440 = "W2560_H1440",
149
- W3840_H2160 = "W3840_H2160",
150
153
  W144_H176 = "W144_H176",
151
154
  W144_H256 = "W144_H256",
152
155
  W180_H240 = "W180_H240",
@@ -159,9 +162,7 @@ declare enum RCResolution {
159
162
  W480_H848 = "W480_H848",
160
163
  W720_H1280 = "W720_H1280",
161
164
  W720_H960 = "W720_H960",
162
- W1080_H1920 = "W1080_H1920",
163
- W1440_H2560 = "W1440_H2560",
164
- W2160_H3840 = "W2160_H3840"
165
+ W1080_H1920 = "W1080_H1920"
165
166
  }
166
167
 
167
168
  /**
@@ -245,6 +246,15 @@ declare abstract class RCTrack extends EventEmitter {
245
246
  */
246
247
  isOwnerMuted(): boolean;
247
248
  protected _element?: HTMLMediaElement;
249
+ private _validateVolume;
250
+ /**
251
+ * 播放前检测
252
+ */
253
+ private _validatePlayOptions;
254
+ /**
255
+ * 设置播放属性
256
+ */
257
+ private _setPlayAttrs;
248
258
  /**
249
259
  * 播放
250
260
  * @param element 用于承载媒体流的元素标签,音频流可传空
@@ -377,13 +387,6 @@ declare class RCLocalAudioTrack extends RCLocalTrack {
377
387
  * @param {number[]} args - [分钟,开始]
378
388
  */
379
389
  setBitrate(max: number, ...args: number[]): void;
380
- protected _stopProcess: Function;
381
- /**
382
- * @override __innerSetMediaStreamTrack
383
- * @params {track} MediaStreamTrack 添加音频流
384
- * @params {track} undefined 销毁音频流
385
- */
386
- __innerSetMediaStreamTrack(track: MediaStreamTrack | undefined): void;
387
390
  }
388
391
  declare class RCLocalVideoTrack extends RCLocalTrack {
389
392
  private _isTiny;
@@ -432,16 +435,17 @@ declare class RCLocalFileAudioTrack extends RCLocalFileTrack {
432
435
  play(): Promise<{
433
436
  code: RCRTCCode;
434
437
  }>;
435
- protected _stopProcess: Function;
438
+ }
439
+ declare class RCMicphoneAudioTrack extends RCLocalAudioTrack {
440
+ private _originTrack;
436
441
  /**
437
- * @override __innerSetMediaStreamTrack
438
- * @params {track} MediaStreamTrack 添加音频流
439
- * @params {track} undefined 销毁音频流
442
+ * 应用 3A 降噪模块对麦克风音频流进行处理
440
443
  */
444
+ apply3ANoiseWorklet(): Promise<{
445
+ code: RCRTCCode;
446
+ }>;
441
447
  __innerSetMediaStreamTrack(track: MediaStreamTrack | undefined): void;
442
448
  }
443
- declare class RCMicphoneAudioTrack extends RCLocalAudioTrack {
444
- }
445
449
  declare class RCCameraVideoTrack extends RCLocalVideoTrack {
446
450
  }
447
451
  declare class RCScreenVideoTrack extends RCLocalVideoTrack {
@@ -686,6 +690,12 @@ interface IRTCResponse {
686
690
  */
687
691
  'Request-Id': string;
688
692
  }
693
+ interface IExchangeResSubscribeItem {
694
+ mediaType: RCMediaType.AUDIO_ONLY | RCMediaType.VIDEO_ONLY;
695
+ msid: string;
696
+ userId: string;
697
+ simulcast?: RCStreamType;
698
+ }
689
699
  /**
690
700
  * /exchange 响应结果
691
701
  */
@@ -727,12 +737,7 @@ interface IExchangeResponse extends IRTCResponse {
727
737
  /**
728
738
  * 订阅成功的资源
729
739
  */
730
- subscribedList?: {
731
- mediaType: RCMediaType.AUDIO_ONLY | RCMediaType.VIDEO_ONLY;
732
- msid: string;
733
- userId: string;
734
- simulcast?: RCStreamType;
735
- }[];
740
+ subscribedList?: IExchangeResSubscribeItem[];
736
741
  }
737
742
  interface IBroadcastSubReqBody {
738
743
  /**
@@ -1874,7 +1879,7 @@ interface IRCRTCInitOptions {
1874
1879
  */
1875
1880
  logLevel?: LogL.ERROR | LogL.WARN | LogL.INFO | LogL.DEBUG;
1876
1881
  /**
1877
- * (已废弃)~修改默认的 log 输出函数~
1882
+ * (已废弃)
1878
1883
  * @deprecated 5.6.1
1879
1884
  */
1880
1885
  logStdout?: (logLevel: EnableLogL, content: string) => void;
@@ -1901,16 +1906,19 @@ interface IRCRTCInitOptions {
1901
1906
  */
1902
1907
  pullInnerCDNUseHttps?: RCInnerCDNPullIsHttps;
1903
1908
  /**
1904
- * 音频降噪处理
1905
- * - workletModule 默认值为 https://cdn.ronghub.com/plugin-rtc/wasm/5.0.0-alpha.1/process-worklet.js
1906
- * - workletWasm 默认值为 https://cdn.ronghub.com/plugin-rtc/wasm/5.0.0-alpha.1/AudioProcessing.wasm
1907
- * - isOpen 默认值为 false
1909
+ * 3A 模块资源路径配置
1910
+ * @description 建议将资源下载到业务代码工程中,以静态资源形式与页面共同部署,以避免受同源策略或用户网络防火墙策略限制,导致资源获取失败。
1911
+ * * wasmUrl 资源下载地址 `https://cdn.ronghub.com/plugin-rtc/wasm/5.0.0-alpha.2/AudioProcessing.wasm`
1912
+ * * scriptUrl 资源下载默认使用 `https://cdn.ronghub.com/plugin-rtc/wasm/5.0.0-alpha.2/process-worklet.js`
1908
1913
  */
1909
- audio?: {
1910
- workletModule?: string;
1911
- workletWasm?: string;
1912
- isOpen?: boolean;
1914
+ AAAWorklet?: {
1915
+ wasmUrl: string;
1916
+ scriptUrl: string;
1913
1917
  };
1918
+ /**
1919
+ * @deprecated
1920
+ */
1921
+ audio?: any;
1914
1922
  }
1915
1923
  interface ICameraVideoProfile extends IVideoProfile {
1916
1924
  cameraId?: string;
@@ -2504,6 +2512,9 @@ declare class RTCContext {
2504
2512
  joinRTCRoom(roomId: string, mode: RTCMode, broadcastType?: number, joinType?: RTCJoinType, innerUserDatas?: IRTCUserData, outerUserDatas?: IRTCUserData, supportNtf?: boolean): IPromiseResult<IJoinRTCRoomData>;
2505
2513
  quitRTCRoom(roomId: string): Promise<ErrorCode>;
2506
2514
  getRTCRoomInfo(roomId: string): IPromiseResult<IRTCRoomInfo>;
2515
+ /**
2516
+ * 移动端用来获取副房间资源
2517
+ */
2507
2518
  getRTCUserInfoList(roomId: string): IPromiseResult<IRTCUsers>;
2508
2519
  getRTCUserInfo(roomId: string): IPromiseResult<unknown>;
2509
2520
  removeRTCUserInfo(roomId: string, keys: string[]): Promise<ErrorCode>;
@@ -2687,6 +2698,14 @@ declare class RCMediaService {
2687
2698
  * ping1 :ping 结果返回最快值
2688
2699
  */
2689
2700
  private setMediaServiceList;
2701
+ /**
2702
+ * 配置 gzip 请求头和请求体
2703
+ */
2704
+ private _openGzip;
2705
+ /**
2706
+ * 处理 request 成功的结果
2707
+ */
2708
+ private _dealRequestSuccessResult;
2690
2709
  /**
2691
2710
  * 发送请求,请求发送若失败,会继续尝试使用后续可用地址直到无地址可用,此时认为请求失败
2692
2711
  * @param path
@@ -2991,6 +3010,18 @@ declare class RCAudienceLivingRoom {
2991
3010
  * 计算新发布和取消发布的合流资源
2992
3011
  */
2993
3012
  private _diffRoomResource;
3013
+ /**
3014
+ * 处理主播资源的新增发布
3015
+ */
3016
+ private _dealPublished;
3017
+ /**
3018
+ * 处理主播资源的取消发布
3019
+ */
3020
+ private _dealUnpublished;
3021
+ /**
3022
+ * 处理主播资源的变更
3023
+ */
3024
+ private _dealModified;
2994
3025
  /**
2995
3026
  * 计算主播发布和取消发布的资源,以及资源的状态变更
2996
3027
  */
@@ -3024,6 +3055,12 @@ declare class RCAudienceLivingRoom {
3024
3055
  private _addPeerCEvent;
3025
3056
  private _getReqHeaders;
3026
3057
  private _exchangeHandle;
3058
+ private _dealSubscribeResult;
3059
+ /**
3060
+ * 去重、转化参数格式为 ISubscribeAttr
3061
+ */
3062
+ private _getParams;
3063
+ private _reportPubOrSubQualityData;
3027
3064
  private _updateSubListHandle;
3028
3065
  /**
3029
3066
  * 对比 cdn_uris 资源
@@ -3178,7 +3215,30 @@ declare class PolarisReporter {
3178
3215
  * @param resourceId userId_11_1_tiny 改为 userId_11_tiny_video
3179
3216
  */
3180
3217
  private _getPolarisTrackId;
3181
- sendR3R4Data(data: IInnerRCRTCStateReport): Promise<RCSendCode>;
3218
+ /**
3219
+ * 上下行 track 包含的公共字段
3220
+ */
3221
+ private _getBaseData;
3222
+ private _getAudioLevel;
3223
+ private _getBitrate;
3224
+ private _getPacketsLostRate;
3225
+ private _getFrameRate;
3226
+ private _getResolution;
3227
+ private _getJitter;
3228
+ private _getNackCount;
3229
+ private _getPliCount;
3230
+ private _getRTT;
3231
+ private _getTrackState;
3232
+ /**
3233
+ * 发送上行音视频资源数据
3234
+ * @param data peerConnection stats 解析出来业务所需的所有字段
3235
+ */
3236
+ sendR3Data(data: IInnerRCRTCStateReport): Promise<RCSendCode>;
3237
+ /**
3238
+ * 发送下行音视频资源数据
3239
+ * @param data peerConnection stats 解析出来业务所需的所有字段
3240
+ */
3241
+ sendR4Data(data: IInnerRCRTCStateReport): Promise<RCSendCode>;
3182
3242
  /**
3183
3243
  * 加入房间
3184
3244
  */
@@ -3308,6 +3368,14 @@ declare class RCRTCPeerConnection extends EventEmitter {
3308
3368
  * @param listener
3309
3369
  */
3310
3370
  registerReportListener(listener: IRCRTCReportListener | null): void;
3371
+ /**
3372
+ * 组装上行质量报告数据
3373
+ */
3374
+ private _createSenderReport;
3375
+ /**
3376
+ * 组装下行质量报告数据
3377
+ */
3378
+ private _createReceiverReport;
3311
3379
  private _createRCRTCStateReport;
3312
3380
  /**
3313
3381
  * 获取 peerConnection stats 数据并格式化
@@ -3316,7 +3384,6 @@ declare class RCRTCPeerConnection extends EventEmitter {
3316
3384
  private _getStatsData;
3317
3385
  /**
3318
3386
  * 通知用户质量数据、peerConnection 北极星数据上报
3319
- * @todo
3320
3387
  */
3321
3388
  private _reportHandle;
3322
3389
  /**
@@ -3700,7 +3767,7 @@ declare class RCLivingPKHandler {
3700
3767
  /**
3701
3768
  * 加入 PK 房间回调
3702
3769
  */
3703
- _onJoinedPKRoom: (roomId: string, traceId: string) => void, _clientSessionId?: string | undefined);
3770
+ _onJoinedPKRoom: (roomId: string, traceId: string) => Promise<void>, _clientSessionId?: string | undefined);
3704
3771
  private _callAppListener;
3705
3772
  /**
3706
3773
  * 收到连麦邀请
@@ -3887,7 +3954,7 @@ declare abstract class RCAbstractRoom extends EventEmitter {
3887
3954
  private _onTrackReady;
3888
3955
  protected _callAppListener(eventType: keyof IRoomEventListener, ...attrs: any[]): void;
3889
3956
  private _onTrackUnpublish;
3890
- __parseInnerMessage(message: IReceivedMessage, traceId: string): boolean;
3957
+ __parseInnerMessage(message: IReceivedMessage, traceId: string): void;
3891
3958
  /**
3892
3959
  * 被踢出房间通知
3893
3960
  * @param byServer
@@ -4129,7 +4196,7 @@ declare abstract class RCAbstractRoom extends EventEmitter {
4129
4196
  /**
4130
4197
  * 退出 PK 房间
4131
4198
  */
4132
- protected _quitAllPKRoom(): void;
4199
+ protected _quitAllPKRoom(): Promise<void>;
4133
4200
  getClientSessionId(): string;
4134
4201
  }
4135
4202
 
@@ -4329,19 +4396,6 @@ declare class RCMCUConfigBuilder {
4329
4396
  * @param uri
4330
4397
  */
4331
4398
  removePictureWaterMark(trackId: string, uri: string): RCMCUConfigBuilder;
4332
- /**
4333
- * 设置 MCU 混流配置
4334
- * @param videoList 视频输入混流列表,为 null 代表视频全混流,为空集合代表视频全不混流,否则按照输入列表进行混流
4335
- * @param audioList 音频输入混流列表,为 null 代表音频全混流,为空集合代表音频全不混流,否则按照输入列表进行混流
4336
- */
4337
- /**
4338
- * 设置 MCU 混流配置
4339
- * @param roomIds 混流房间列表
4340
- * @param mediaType 混流媒体类型
4341
- * @param isAppend 是否为增量混流
4342
- * * true 为增量混流
4343
- * * false 为全量覆盖混流
4344
- */
4345
4399
  /**
4346
4400
  * 重置所有合流配置
4347
4401
  * @since v5.3.7
@@ -4628,6 +4682,14 @@ declare class RCMediaStreamCapture {
4628
4682
  tracks?: (RCScreenVideoTrack | RCScreenAudioTrack)[];
4629
4683
  }>;
4630
4684
  private _createScreenTracks;
4685
+ /**
4686
+ * electron 中取屏幕共享资源
4687
+ */
4688
+ private _createElectronScreenStream;
4689
+ /**
4690
+ * web 浏览器中取屏幕共享资源
4691
+ */
4692
+ private _createWebScreenStream;
4631
4693
  /**
4632
4694
  * 创建 RCLocalAudioTrack 实例
4633
4695
  * @param tag
@@ -4648,6 +4710,7 @@ declare class RCMediaStreamCapture {
4648
4710
  code: RCRTCCode;
4649
4711
  track?: RCLocalVideoTrack;
4650
4712
  }>;
4713
+ private _validateCreateLocalFileTracks;
4651
4714
  /**
4652
4715
  * 根据本地或网络媒体文件资源创建 `RCLocalFileTrack` 实例
4653
4716
  * @param tag 资源标识
@@ -4703,6 +4766,7 @@ declare class RCRTCClient extends RCMediaStreamCapture {
4703
4766
  */
4704
4767
  getCurrentId(): string;
4705
4768
  private _crtRoom;
4769
+ private __joinRoom;
4706
4770
  /**
4707
4771
  * 加入普通音视频房间,加入成功后返回 room 实例、code、userIds、tracks
4708
4772
  * @param {string} roomId - 房间号
@@ -4868,4 +4932,4 @@ declare const helper: {
4868
4932
  ifSupportScreenShare: typeof ifSupportScreenShare;
4869
4933
  };
4870
4934
 
4871
- export { BackgroundPictureFillMode, IAudienceRoomEventListener, IAudioLevelChangeHandler, ICameraVideoProfile, ICreateLocalTrackOptions, IJoinResCDNInfo, ILiveAudioState, IMCUOutputConfig, IMCUOutputVideoConfig, IMicphoneAudioProfile, IPKEndInfo, IPKInviteAnswerInfo, IPKInviteInfo, IPubSuccessRes, IPublishAttrs, IPublishedResource, IRCCandidatePairStat, IRCRTCInitOptions, IRCRTCReportListener, IRCRTCStateReport, IRCTrackStat, IRTCUserData, IReqResPKOptions, IRoomEventListener, IRoomPKEventListener, ISubscribeAttr, IVideoProfile, MixLayoutMode, MixVideoRenderMode, RCAbstractRoom, RCAudienceClient, RCAudienceLivingRoom, RCAudioBitrate, RCCameraVideoTrack, RCFrameRate, RCInnerCDNPullIsHttps, RCInnerCDNPullKind, RCKickReason, RCLivingRoom, RCLivingType, RCLocalAudioTrack, RCLocalFileAudioTrack, RCLocalFileTrack, RCLocalFileVideoTrack, RCLocalTrack, RCLocalVideoTrack, RCMCUConfigBuilder, RCMediaStreamCapture, RCMediaType, RCMicphoneAudioTrack, RCRTCClient, RCRTCCode, RCRTCLiveRole, RCRTCPingResult, RCRTCRoom, RCRemoteAudioTrack, RCRemoteTrack, RCRemoteVideoTrack, RCResolution, RCScreenAudioTrack, RCScreenVideoTrack, RCTag, RCTrack, RCVideoBitrate, RTCJoinType, device, helper, installer };
4935
+ export { BackgroundPictureFillMode, IAudienceRoomEventListener, IAudioLevelChangeHandler, ICameraVideoProfile, ICreateLocalTrackOptions, IJoinResCDNInfo, ILiveAudioState, IMCUOutputConfig, IMCUOutputVideoConfig, IMicphoneAudioProfile, IPKEndInfo, IPKInviteAnswerInfo, IPKInviteInfo, IPubSuccessRes, IPublishAttrs, IPublishedResource, IRCCandidatePairStat, IRCRTCInitOptions, IRCRTCReportListener, IRCRTCStateReport, IRCTrackStat, IRTCUserData, IReqResPKOptions, IRoomEventListener, IRoomPKEventListener, IScreenVideoProfile, ISubscribeAttr, IVideoProfile, MixLayoutMode, MixVideoRenderMode, RCAbstractRoom, RCAudienceClient, RCAudienceLivingRoom, RCAudioBitrate, RCCameraVideoTrack, RCFrameRate, RCInnerCDNPullIsHttps, RCInnerCDNPullKind, RCKickReason, RCLivingRoom, RCLivingType, RCLocalAudioTrack, RCLocalFileAudioTrack, RCLocalFileTrack, RCLocalFileVideoTrack, RCLocalTrack, RCLocalVideoTrack, RCMCUConfigBuilder, RCMediaStreamCapture, RCMediaType, RCMicphoneAudioTrack, RCRTCClient, RCRTCCode, RCRTCLiveRole, RCRTCPingResult, RCRTCRoom, RCRemoteAudioTrack, RCRemoteTrack, RCRemoteVideoTrack, RCResolution, RCScreenAudioTrack, RCScreenVideoTrack, RCTag, RCTrack, RCVideoBitrate, RTCJoinType, device, helper, installer };