@rongcloud/plugin-rtc 5.4.1-alpha.2 → 5.4.3
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/async-task-queue.d.ts +9 -0
- package/dist/core/Invoker.d.ts +46 -0
- package/dist/core/PolarisReporter.d.ts +35 -0
- package/dist/core/RCAudienceClient.d.ts +89 -0
- package/dist/core/RCMediaStreamCapture.d.ts +124 -0
- package/dist/core/RCRTCClient.d.ts +126 -0
- package/dist/core/Store.d.ts +80 -0
- package/dist/core/command/BaseCommand.d.ts +22 -0
- package/dist/core/command/EnabelInnerCDNCommand.d.ts +16 -0
- package/dist/core/command/ExchangeCommand.d.ts +18 -0
- package/dist/core/command/ExchangeWithPushOtherRoomCommand.d.ts +22 -0
- package/dist/core/command/JoinRoomCommand.d.ts +26 -0
- package/dist/core/command/LeaveOtherRoomCommand.d.ts +30 -0
- package/dist/core/command/LocalTrackMuteCommand.d.ts +10 -0
- package/dist/core/command/MCUConfigFlushCommand.d.ts +18 -0
- package/dist/core/command/OnRemoteUserUnpubCommand.d.ts +13 -0
- package/dist/core/command/OnSignalReconnectedCommand.d.ts +38 -0
- package/dist/core/command/ParseRemoteResCommand.d.ts +38 -0
- package/dist/core/command/ParseUserStateCommand.d.ts +57 -0
- package/dist/core/command/PubCommand.d.ts +34 -0
- package/dist/core/command/RTCIdentityChangeCommand.d.ts +17 -0
- package/dist/core/command/RetryExchangeCommand.d.ts +18 -0
- package/dist/core/command/SubCommand.d.ts +21 -0
- package/dist/core/command/UnpubCommand.d.ts +20 -0
- package/dist/core/command/UnpubPrevCommand.d.ts +6 -0
- package/dist/core/command/UnsubCommand.d.ts +20 -0
- package/dist/core/command/UpdateSubListCommand.d.ts +28 -0
- package/dist/core/command/helper.d.ts +20 -0
- package/dist/core/constants.d.ts +2 -0
- package/dist/core/enums/BackgroundPictureFillMode.d.ts +14 -0
- package/dist/core/enums/MixLayoutMode.d.ts +18 -0
- package/dist/core/enums/MixVideoRenderMode.d.ts +14 -0
- package/dist/core/enums/RCBitrate.d.ts +48 -0
- package/dist/core/enums/RCFrameRate.d.ts +7 -0
- package/dist/core/enums/RCInnerCDNBroadcast.d.ts +5 -0
- package/dist/core/enums/RCInnerCDNModel.d.ts +5 -0
- package/dist/core/enums/RCInnerCDNPullIsHttps.d.ts +5 -0
- package/dist/core/enums/RCInnerCDNPullKind.d.ts +6 -0
- package/dist/core/enums/RCInnerCDNPushMode.d.ts +5 -0
- package/dist/core/enums/RCKickType.d.ts +11 -0
- package/dist/core/enums/RCLivingType.d.ts +14 -0
- package/dist/core/enums/RCLoggerTag.d.ts +629 -0
- package/dist/core/enums/RCMediaType.d.ts +18 -0
- package/dist/core/enums/RCMixInputFilterMode.d.ts +35 -0
- package/dist/core/enums/RCRTCCode.d.ts +86 -0
- package/dist/core/enums/RCRTCLiveRole.d.ts +14 -0
- package/dist/core/enums/RCRTCPingResult.d.ts +5 -0
- package/dist/core/enums/RCRTCResolution.d.ts +102 -0
- package/dist/core/enums/RCResolution.d.ts +16 -0
- package/dist/core/enums/inner/PolarisRole.d.ts +14 -0
- package/dist/core/enums/inner/R2Action.d.ts +14 -0
- package/dist/core/enums/inner/R2Status.d.ts +11 -0
- package/dist/core/enums/inner/RCRTCMessageType.d.ts +66 -0
- package/dist/core/enums/inner/RCStreamType.d.ts +14 -0
- package/dist/core/enums/inner/TrackState.d.ts +14 -0
- package/dist/core/interfaces.d.ts +912 -0
- package/dist/core/room/Pinger.d.ts +35 -0
- package/dist/core/room/RCAbstractRoom.d.ts +327 -0
- package/dist/core/room/RCAudienceLivingRoom.d.ts +321 -0
- package/dist/core/room/RCAudioLevelReport.d.ts +16 -0
- package/dist/core/room/RCLivingPKHandler.d.ts +164 -0
- package/dist/core/room/RCLivingRoom.d.ts +108 -0
- package/dist/core/room/RCLocalMediaStream.d.ts +8 -0
- package/dist/core/room/RCMCUConfigBuilder.d.ts +211 -0
- package/dist/core/room/RCRTCRoom.d.ts +15 -0
- package/dist/core/service/RCMediaService.d.ts +96 -0
- package/dist/core/service/helper.d.ts +8 -0
- package/dist/core/service/index.d.ts +6 -0
- package/dist/core/service/interface.d.ts +323 -0
- package/dist/core/service/mcu-interface.d.ts +293 -0
- package/dist/core/tracks/RCLocalTrack.d.ts +121 -0
- package/dist/core/tracks/RCRemoteTrack.d.ts +23 -0
- package/dist/core/tracks/RCTrack.d.ts +91 -0
- package/dist/core/webrtc/RCRTCPeerCManager.d.ts +159 -0
- package/dist/core/webrtc/RCRTCPeerConnection.d.ts +110 -0
- package/dist/core/webrtc/helper.d.ts +26 -0
- package/dist/core/webrtc/sdp/ASdpBuilder.d.ts +98 -0
- package/dist/core/webrtc/sdp/ASdpStrategy.d.ts +48 -0
- package/dist/core/webrtc/sdp/PlanBSdpBuilder.d.ts +20 -0
- package/dist/core/webrtc/sdp/PlanBStrategy.d.ts +26 -0
- package/dist/core/webrtc/sdp/UnifiedPlanSdpBuilder.d.ts +11 -0
- package/dist/core/webrtc/sdp/UnifiedPlanStrategy.d.ts +21 -0
- package/dist/core/webrtc/stat-parser/AbstractStatParser.d.ts +117 -0
- package/dist/core/webrtc/stat-parser/ChromeStatParser.d.ts +14 -0
- package/dist/core/webrtc/stat-parser/FirefoxStatParser.d.ts +14 -0
- package/dist/core/webrtc/stat-parser/IStatParser.d.ts +24 -0
- package/dist/core/webrtc/stat-parser/SafariStatParser.d.ts +14 -0
- package/dist/device.d.ts +6 -0
- package/dist/helper.d.ts +189 -0
- package/dist/index.d.ts +2034 -1907
- package/dist/index.esm.js +15 -14420
- package/dist/index.js +15 -14450
- package/dist/index.umd.js +15 -14454
- package/dist/logger.d.ts +4 -0
- package/package.json +3 -3
package/dist/index.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* RCRTC - v5.4.
|
|
3
|
-
* CommitId -
|
|
4
|
-
*
|
|
2
|
+
* RCRTC - v5.4.3
|
|
3
|
+
* CommitId - 14f0acc9bca79c93547703c573d297dbd301594c
|
|
4
|
+
* Tue Aug 02 2022 09:57:21 GMT+0800 (China Standard Time)
|
|
5
5
|
* ©2020 RongCloud, Inc. All rights reserved.
|
|
6
6
|
*/
|
|
7
|
-
import { EventEmitter,
|
|
7
|
+
import { EventEmitter, RTCMode, IRuntime, RTCPluginContext, IJoinRTCRoomData, IReceivedMessage, ErrorCode, RTCJoinType, IRTCUserData, KVString, IServerRTCRoomEntry, LogLevel, IRTCJoinedInfo, IPluginGenerator } from '@rongcloud/engine';
|
|
8
8
|
export { RTCJoinType } from '@rongcloud/engine';
|
|
9
9
|
|
|
10
10
|
/**
|
|
@@ -88,7 +88,9 @@ declare enum RCRTCCode {
|
|
|
88
88
|
/** 方法在 PK 房间上不可用 */
|
|
89
89
|
THE_FUNCTION_IS_DISABLED_IN_PKROOM = 53030,
|
|
90
90
|
/** 资源没有全部发成功 */
|
|
91
|
-
SOME_TRACKS_PUBLISH_FAILED = 53031
|
|
91
|
+
SOME_TRACKS_PUBLISH_FAILED = 53031,
|
|
92
|
+
/** electron 中 mac 系统暂不支持屏幕共享采集声音 */
|
|
93
|
+
MAC_IN_ELECTRON_NOT_SUPPORT_SCREEN_SHARE_WITH_AUDIO = 53032
|
|
92
94
|
}
|
|
93
95
|
|
|
94
96
|
/**
|
|
@@ -109,20 +111,6 @@ declare enum RCMediaType {
|
|
|
109
111
|
AUDIO_VIDEO = 2
|
|
110
112
|
}
|
|
111
113
|
|
|
112
|
-
/**
|
|
113
|
-
* 资源大小流标识枚举
|
|
114
|
-
*/
|
|
115
|
-
declare enum RCStreamType {
|
|
116
|
-
/**
|
|
117
|
-
* 普通流(大流)
|
|
118
|
-
*/
|
|
119
|
-
NORMAL = 1,
|
|
120
|
-
/**
|
|
121
|
-
* 小流
|
|
122
|
-
*/
|
|
123
|
-
TINY = 2
|
|
124
|
-
}
|
|
125
|
-
|
|
126
114
|
declare enum RCFrameRate {
|
|
127
115
|
FPS_10 = "FPS_10",
|
|
128
116
|
FPS_15 = "FPS_15",
|
|
@@ -227,7 +215,8 @@ declare abstract class RCTrack extends EventEmitter {
|
|
|
227
215
|
*/
|
|
228
216
|
play(element?: HTMLVideoElement, options?: {
|
|
229
217
|
volume?: number;
|
|
230
|
-
audioDeviceId
|
|
218
|
+
audioDeviceId?: string;
|
|
219
|
+
autoplay: boolean;
|
|
231
220
|
}): Promise<{
|
|
232
221
|
code: RCRTCCode;
|
|
233
222
|
}>;
|
|
@@ -236,6 +225,53 @@ declare abstract class RCTrack extends EventEmitter {
|
|
|
236
225
|
* 释放内存中的 video、audio 标签
|
|
237
226
|
*/
|
|
238
227
|
__releaseMediaElement(): void;
|
|
228
|
+
/**
|
|
229
|
+
* 它检查元素是否是视频节点
|
|
230
|
+
* @param {any} element - 您要检查的元素是否为视频元素。
|
|
231
|
+
* @returns 一个布尔值。
|
|
232
|
+
*/
|
|
233
|
+
private __validateVideoNodeName;
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
declare enum RCAudioBitrate {
|
|
237
|
+
/**
|
|
238
|
+
* 标清音质
|
|
239
|
+
*/
|
|
240
|
+
Speech = "Speech",
|
|
241
|
+
/**
|
|
242
|
+
* 音乐音质
|
|
243
|
+
*/
|
|
244
|
+
Music = "Music",
|
|
245
|
+
/**
|
|
246
|
+
* 音乐高清音质
|
|
247
|
+
*/
|
|
248
|
+
MusicHigh = "MusicHigh"
|
|
249
|
+
}
|
|
250
|
+
declare enum RCVideoBitrate {
|
|
251
|
+
/**
|
|
252
|
+
* Bitrate { max: 150, min: 80 }
|
|
253
|
+
*/
|
|
254
|
+
LEVEL0 = "LEVEL0",
|
|
255
|
+
/**
|
|
256
|
+
* Bitrate { max: 280, min: 120 }
|
|
257
|
+
*/
|
|
258
|
+
LEVEL1 = "LEVEL1",
|
|
259
|
+
/**
|
|
260
|
+
* Bitrate { max: 650, min: 150 }
|
|
261
|
+
*/
|
|
262
|
+
LEVEL2 = "LEVEL2",
|
|
263
|
+
/**
|
|
264
|
+
* Bitrate { max: 1000, min: 200 }
|
|
265
|
+
*/
|
|
266
|
+
LEVEL3 = "LEVEL3",
|
|
267
|
+
/**
|
|
268
|
+
* Bitrate { max: 2200, min: 250 }
|
|
269
|
+
*/
|
|
270
|
+
LEVEL4 = "LEVEL4",
|
|
271
|
+
/**
|
|
272
|
+
* Bitrate { max: 4000, min: 400 }
|
|
273
|
+
*/
|
|
274
|
+
LEVEL5 = "LEVEL5"
|
|
239
275
|
}
|
|
240
276
|
|
|
241
277
|
declare abstract class RCLocalTrack extends RCTrack {
|
|
@@ -287,17 +323,16 @@ declare abstract class RCLocalTrack extends RCTrack {
|
|
|
287
323
|
declare class RCLocalAudioTrack extends RCLocalTrack {
|
|
288
324
|
constructor(tag: string, userId: string, track: MediaStreamTrack);
|
|
289
325
|
/**
|
|
290
|
-
*
|
|
291
|
-
* @param
|
|
292
|
-
* @param min 最小码率,`0` 表示不限制
|
|
293
|
-
* @param start 起始码率
|
|
326
|
+
* 它设置推荐的音频码率。
|
|
327
|
+
* @param {RCAudioBitrate} audio - RCA音频比特率
|
|
294
328
|
*/
|
|
295
|
-
|
|
329
|
+
setRecommendBitrate(audio: RCAudioBitrate): void;
|
|
296
330
|
/**
|
|
297
|
-
*
|
|
298
|
-
* @
|
|
331
|
+
* 它设置视频的比特率。
|
|
332
|
+
* @param {number} max - 客户端将使用的最大比特率。
|
|
333
|
+
* @param {number[]} args - [分钟,开始]
|
|
299
334
|
*/
|
|
300
|
-
|
|
335
|
+
setBitrate(max: number, ...args: number[]): void;
|
|
301
336
|
}
|
|
302
337
|
declare class RCLocalVideoTrack extends RCLocalTrack {
|
|
303
338
|
private _isTiny;
|
|
@@ -305,6 +340,17 @@ declare class RCLocalVideoTrack extends RCLocalTrack {
|
|
|
305
340
|
__isTiny(): boolean;
|
|
306
341
|
getStreamId(): string;
|
|
307
342
|
getTrackId(): string;
|
|
343
|
+
/**
|
|
344
|
+
* 它设置推荐的音频码率
|
|
345
|
+
* @param {RCVideoBitrate} video - RC视频比特率
|
|
346
|
+
*/
|
|
347
|
+
setRecommendBitrate(video: RCVideoBitrate): void;
|
|
348
|
+
/**
|
|
349
|
+
* 它设置视频的比特率。
|
|
350
|
+
* @param {number} max - 视频可以编码的最大比特率。
|
|
351
|
+
* @param {number[]} args - [最大、最小、开始]
|
|
352
|
+
*/
|
|
353
|
+
setBitrate(max: number, ...args: number[]): void;
|
|
308
354
|
}
|
|
309
355
|
declare abstract class RCLocalFileTrack extends RCLocalTrack {
|
|
310
356
|
/**
|
|
@@ -342,6 +388,8 @@ declare class RCCameraVideoTrack extends RCLocalVideoTrack {
|
|
|
342
388
|
}
|
|
343
389
|
declare class RCScreenVideoTrack extends RCLocalVideoTrack {
|
|
344
390
|
}
|
|
391
|
+
declare class RCScreenAudioTrack extends RCLocalAudioTrack {
|
|
392
|
+
}
|
|
345
393
|
|
|
346
394
|
declare class RCRemoteTrack extends RCTrack {
|
|
347
395
|
constructor(tag: string, userId: string, kind: 'audio' | 'video', roomId?: string);
|
|
@@ -365,6 +413,20 @@ declare class RCRemoteVideoTrack extends RCRemoteTrack {
|
|
|
365
413
|
constructor(tag: string, userId: string, roomId?: string);
|
|
366
414
|
}
|
|
367
415
|
|
|
416
|
+
/**
|
|
417
|
+
* 资源大小流标识枚举
|
|
418
|
+
*/
|
|
419
|
+
declare enum RCStreamType {
|
|
420
|
+
/**
|
|
421
|
+
* 普通流(大流)
|
|
422
|
+
*/
|
|
423
|
+
NORMAL = 1,
|
|
424
|
+
/**
|
|
425
|
+
* 小流
|
|
426
|
+
*/
|
|
427
|
+
TINY = 2
|
|
428
|
+
}
|
|
429
|
+
|
|
368
430
|
interface IStatParser {
|
|
369
431
|
/**
|
|
370
432
|
* 取消发布后,需把 _latestPacketsSent 中 key 为 resourceId 存储的数据清除掉
|
|
@@ -442,2491 +504,2570 @@ declare enum RCRTCLiveRole {
|
|
|
442
504
|
}
|
|
443
505
|
|
|
444
506
|
/**
|
|
445
|
-
*
|
|
507
|
+
* RTC 消息类型常量
|
|
508
|
+
* @private
|
|
446
509
|
*/
|
|
447
|
-
declare enum
|
|
510
|
+
declare enum RCRTCMessageType {
|
|
448
511
|
/**
|
|
449
|
-
*
|
|
512
|
+
* 增量资源发布消息
|
|
513
|
+
* @deprecated
|
|
450
514
|
*/
|
|
451
|
-
|
|
515
|
+
PUBLISH = "RCRTC:PublishResource",
|
|
452
516
|
/**
|
|
453
|
-
*
|
|
517
|
+
* 增量资源取消发布消息
|
|
518
|
+
* @deprecated
|
|
454
519
|
*/
|
|
455
|
-
|
|
456
|
-
}
|
|
457
|
-
|
|
458
|
-
declare type IOnRecvPKMsg = (msg: IReceivedMessage) => void;
|
|
459
|
-
interface IRoomPKEventListener {
|
|
520
|
+
UNPUBLISH = "RCRTC:UnpublishResource",
|
|
460
521
|
/**
|
|
461
|
-
*
|
|
522
|
+
* 增量资源状态变更消息
|
|
523
|
+
* @deprecated
|
|
462
524
|
*/
|
|
463
|
-
|
|
525
|
+
MODIFY = "RCRTC:ModifyResource",
|
|
464
526
|
/**
|
|
465
|
-
*
|
|
527
|
+
* 全量资源变更消息
|
|
466
528
|
*/
|
|
467
|
-
|
|
529
|
+
TOTAL_CONTENT_RESOURCE = "RCRTC:TotalContentResources",
|
|
468
530
|
/**
|
|
469
|
-
*
|
|
531
|
+
* 房间人员变更
|
|
470
532
|
*/
|
|
471
|
-
|
|
533
|
+
STATE = "RCRTC:state",
|
|
472
534
|
/**
|
|
473
|
-
*
|
|
535
|
+
* 房间属性变更
|
|
474
536
|
*/
|
|
475
|
-
|
|
476
|
-
}
|
|
477
|
-
declare class RCLivingPKHandler {
|
|
478
|
-
private _PKInfo;
|
|
479
|
-
private readonly _context;
|
|
480
|
-
private readonly _runtime;
|
|
481
|
-
private readonly _service;
|
|
482
|
-
private readonly _initOptions;
|
|
537
|
+
ROOM_NOTIFY = "RCRTC:RoomNtf",
|
|
483
538
|
/**
|
|
484
|
-
*
|
|
539
|
+
* 房间用户属性变更
|
|
485
540
|
*/
|
|
486
|
-
|
|
487
|
-
private readonly _registerPKMsgListener;
|
|
541
|
+
USER_NOTIFY = "RCRTC:UserNtf",
|
|
488
542
|
/**
|
|
489
|
-
*
|
|
543
|
+
* 被服务踢出房间
|
|
490
544
|
*/
|
|
491
|
-
|
|
545
|
+
KICK = "RCRTC:kick",
|
|
492
546
|
/**
|
|
493
|
-
*
|
|
547
|
+
* 跨房间连麦 PK 请求消息
|
|
494
548
|
*/
|
|
495
|
-
|
|
496
|
-
protected readonly _clientSessionId?: string | undefined;
|
|
549
|
+
PK_INVITE = "RCRTC:invite",
|
|
497
550
|
/**
|
|
498
|
-
*
|
|
551
|
+
* 连麦请求超时
|
|
499
552
|
*/
|
|
500
|
-
|
|
553
|
+
PK_INVITE_TIMEOUT = "RCRTC:inviteTimeout",
|
|
501
554
|
/**
|
|
502
|
-
* PK
|
|
555
|
+
* 跨房间连麦 PK 取消请求消息
|
|
503
556
|
*/
|
|
504
|
-
|
|
505
|
-
private _mainRoomId;
|
|
557
|
+
PK_CANCEL_INVITE = "RCRTC:cancelInvite",
|
|
506
558
|
/**
|
|
507
|
-
*
|
|
559
|
+
* 跨房间连麦 PK 请求响应消息
|
|
508
560
|
*/
|
|
509
|
-
|
|
510
|
-
constructor(_PKInfo: IPKInfo, _context: RTCPluginContext, _runtime: IRuntime, _service: RCMediaService, _initOptions: IRCRTCInitOptions,
|
|
561
|
+
PK_INVITE_ANSWER = "RCRTC:answerInvite",
|
|
511
562
|
/**
|
|
512
|
-
*
|
|
563
|
+
* 结束跨房间连麦 PK 消息
|
|
513
564
|
*/
|
|
514
|
-
|
|
565
|
+
PK_END = "RCRTC:endInvite",
|
|
515
566
|
/**
|
|
516
|
-
*
|
|
567
|
+
* 连麦的房间不再了或离线了,主直播房间会收到的消息通知
|
|
517
568
|
*/
|
|
518
|
-
|
|
569
|
+
OTHER_ROOM_OFFLINE = "RCRTC:otherRoomOffline"
|
|
570
|
+
}
|
|
571
|
+
|
|
572
|
+
declare enum RCInnerCDNPushMode {
|
|
573
|
+
AUTOMATIC = 0,
|
|
574
|
+
MANUAL = 1
|
|
575
|
+
}
|
|
576
|
+
|
|
577
|
+
declare enum RCInnerCDNBroadcast {
|
|
578
|
+
SPREAD = 0,
|
|
579
|
+
NO_SPREAD = -1
|
|
580
|
+
}
|
|
581
|
+
|
|
582
|
+
/**
|
|
583
|
+
* 与 MediaServer 交互所需的 Request Header 信息
|
|
584
|
+
*/
|
|
585
|
+
interface IRTCReqHeader {
|
|
519
586
|
/**
|
|
520
|
-
*
|
|
587
|
+
* RTC Token
|
|
588
|
+
* @todo 有效期问题处理
|
|
521
589
|
*/
|
|
522
|
-
|
|
523
|
-
private _callAppListener;
|
|
590
|
+
Token: string;
|
|
524
591
|
/**
|
|
525
|
-
*
|
|
592
|
+
* 房间 Id
|
|
526
593
|
*/
|
|
527
|
-
|
|
594
|
+
RoomId: string;
|
|
528
595
|
/**
|
|
529
|
-
*
|
|
596
|
+
* 用户 Id
|
|
530
597
|
*/
|
|
531
|
-
|
|
532
|
-
private _onInviteTimeout;
|
|
598
|
+
UserId: string;
|
|
533
599
|
/**
|
|
534
|
-
*
|
|
600
|
+
* 仅在直播模式下需要
|
|
535
601
|
*/
|
|
536
|
-
|
|
602
|
+
RoomType?: RTCMode;
|
|
537
603
|
/**
|
|
538
|
-
*
|
|
604
|
+
* 开发者的 AppKey
|
|
539
605
|
*/
|
|
540
|
-
|
|
606
|
+
'App-Key': string;
|
|
541
607
|
/**
|
|
542
|
-
*
|
|
608
|
+
* signal 会话 session id
|
|
543
609
|
*/
|
|
544
|
-
|
|
610
|
+
'Session-Id'?: string;
|
|
545
611
|
/**
|
|
546
|
-
*
|
|
612
|
+
* peerConnection Id
|
|
547
613
|
*/
|
|
548
|
-
|
|
614
|
+
'Peer-Connection-Id'?: string;
|
|
549
615
|
/**
|
|
550
|
-
*
|
|
551
|
-
* @param inviteeRoomId 被邀请者所处的房间 roomId
|
|
552
|
-
* @param inviteeUserId 被邀请者 userId
|
|
553
|
-
* @param options.autoMix 是否要把邀请者发布的资源,合并到被邀请者房间内的 MCU 流中
|
|
554
|
-
* @param options.extra 拓展字段,可随邀请连麦消息透传给被邀请者
|
|
616
|
+
* client-session-id 标识一个端用户进入房间后的唯一标识
|
|
555
617
|
*/
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
618
|
+
'Client-Session-Id'?: string;
|
|
619
|
+
}
|
|
620
|
+
interface IMCUReqHeaders {
|
|
621
|
+
'App-Key': string;
|
|
622
|
+
Token: string;
|
|
623
|
+
RoomId: string;
|
|
624
|
+
UserId: string;
|
|
625
|
+
SessionId: string;
|
|
626
|
+
}
|
|
627
|
+
/**
|
|
628
|
+
* exchange 接口中 pushOtherRooms 字段接口
|
|
629
|
+
*/
|
|
630
|
+
interface IPushOtherRooms {
|
|
559
631
|
/**
|
|
560
|
-
*
|
|
561
|
-
* @param inviteeRoomId 被邀请者所处的房间 roomId
|
|
562
|
-
* @param inviteeUserId 被邀请者 userId
|
|
563
|
-
* @param extra 附加信息,可随取消邀请连麦消息透传给被邀请者
|
|
632
|
+
* 房间 Id
|
|
564
633
|
*/
|
|
565
|
-
|
|
566
|
-
code: RCRTCCode | ErrorCode;
|
|
567
|
-
}>;
|
|
634
|
+
roomId: string;
|
|
568
635
|
/**
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
* @param agree 是否同意连麦
|
|
573
|
-
* @param options.autoMix 是否要把被邀请者发布的资源,合并到邀请者房间内的 MCU 流中
|
|
574
|
-
* @param options.extra 附加信息,可随响应连麦消息透传给邀请者
|
|
575
|
-
*/
|
|
576
|
-
responseJoinOtherRoom(inviterRoomId: string, inviterUserId: string, agree: boolean, options?: IReqResPKOptions): Promise<{
|
|
577
|
-
code: RCRTCCode | ErrorCode;
|
|
578
|
-
}>;
|
|
636
|
+
* 是否默认合流
|
|
637
|
+
*/
|
|
638
|
+
autoMix: boolean;
|
|
579
639
|
/**
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
640
|
+
* 房间 Id 对应的 SessionId
|
|
641
|
+
*/
|
|
642
|
+
sessionId: string;
|
|
643
|
+
}
|
|
644
|
+
/**
|
|
645
|
+
* exchange 接口的请求体结构
|
|
646
|
+
*/
|
|
647
|
+
interface IExchangeReqBody {
|
|
585
648
|
/**
|
|
586
|
-
*
|
|
587
|
-
* @roomId 副房间的 roomId
|
|
649
|
+
* local description
|
|
588
650
|
*/
|
|
589
|
-
|
|
590
|
-
code: RCRTCCode;
|
|
591
|
-
room?: RCLivingRoom;
|
|
592
|
-
userIds?: string[];
|
|
593
|
-
tracks?: RCRemoteTrack[];
|
|
594
|
-
CDNEnable?: boolean;
|
|
595
|
-
}>;
|
|
651
|
+
sdp: IOfferInfo;
|
|
596
652
|
/**
|
|
597
|
-
*
|
|
598
|
-
* @param room 要退出的副房间的 room 实例
|
|
599
|
-
* @param isQuitPK 是否要结束连麦
|
|
653
|
+
* 订阅列表
|
|
600
654
|
*/
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
655
|
+
subscribeList: {
|
|
656
|
+
/**
|
|
657
|
+
* 流资源 uri
|
|
658
|
+
*/
|
|
659
|
+
uri: string;
|
|
660
|
+
/**
|
|
661
|
+
* 大小流订阅,`1` 为大流,`2` 为小流,默认使用大流
|
|
662
|
+
*/
|
|
663
|
+
simulcast: RCStreamType;
|
|
664
|
+
/**
|
|
665
|
+
* 分辨率信息
|
|
666
|
+
*/
|
|
667
|
+
resolution: string;
|
|
668
|
+
}[];
|
|
605
669
|
/**
|
|
606
|
-
*
|
|
607
|
-
* @
|
|
670
|
+
* 透传参数,一般用于传递参数给其他服务,如 MCU/Record 等,MediaServer 仅透传不处理
|
|
671
|
+
* @example `{"resolutionInfo":[{"trackId":"021ad6e8-a50c-479c-96c8-5f3f09d2352d","simulcast":1,"resolution":"640x480"}]}`
|
|
608
672
|
*/
|
|
609
|
-
|
|
610
|
-
inviteSessionId: string;
|
|
611
|
-
inviterRoomId: string;
|
|
612
|
-
inviterUserId: string;
|
|
613
|
-
inviterUserAutoMix?: boolean | undefined; /**
|
|
614
|
-
* 加入副直播房间
|
|
615
|
-
* @roomId 副房间的 roomId
|
|
616
|
-
*/
|
|
617
|
-
inviteeRoomId: string;
|
|
618
|
-
inviteeUserAutoMix?: boolean | undefined;
|
|
619
|
-
};
|
|
673
|
+
extend: string;
|
|
620
674
|
/**
|
|
621
|
-
*
|
|
675
|
+
* 跨房间连麦时其他房间的推流信息
|
|
622
676
|
*/
|
|
623
|
-
|
|
677
|
+
pushOtherRooms?: IPushOtherRooms[];
|
|
624
678
|
/**
|
|
625
|
-
*
|
|
679
|
+
* server 根据网络动态切换大小流开关,默认为 `false`
|
|
626
680
|
*/
|
|
627
|
-
|
|
628
|
-
[roomId: string]: RCLivingRoom;
|
|
629
|
-
};
|
|
681
|
+
switchstream: boolean;
|
|
630
682
|
}
|
|
631
|
-
|
|
632
|
-
declare class RCRTCPeerCManager {
|
|
683
|
+
interface ILiveUrls {
|
|
633
684
|
/**
|
|
634
|
-
*
|
|
685
|
+
* MCU 服务地址,直播模式中用于向 MCU 服务提交 CDN 及合流配置
|
|
635
686
|
*/
|
|
636
|
-
|
|
687
|
+
configUrl: string;
|
|
637
688
|
/**
|
|
638
|
-
*
|
|
689
|
+
* 观众端订阅地址,由业务层分发
|
|
639
690
|
*/
|
|
640
|
-
|
|
691
|
+
liveUrl: string;
|
|
641
692
|
/**
|
|
642
|
-
*
|
|
693
|
+
* 自动推 CDN 模式下,发布资源后返回的 CDN 信息
|
|
643
694
|
*/
|
|
644
|
-
|
|
695
|
+
pull_url?: string;
|
|
696
|
+
}
|
|
697
|
+
interface IRTCResponse {
|
|
645
698
|
/**
|
|
646
|
-
*
|
|
699
|
+
* 请求响应码,只有在 resultCode 值为 `10000` 时才为正常响应
|
|
647
700
|
*/
|
|
648
|
-
|
|
701
|
+
resultCode: RCRTCCode;
|
|
649
702
|
/**
|
|
650
|
-
|
|
703
|
+
* 与 resultCode 相应的可读性文字信息
|
|
704
|
+
*/
|
|
705
|
+
message: string;
|
|
706
|
+
/**
|
|
707
|
+
* 客户端发送的 Request-Id
|
|
651
708
|
*/
|
|
652
|
-
|
|
653
|
-
|
|
709
|
+
'Request-Id': string;
|
|
710
|
+
}
|
|
711
|
+
/**
|
|
712
|
+
* /exchange 响应结果
|
|
713
|
+
*/
|
|
714
|
+
interface IExchangeResponse extends IRTCResponse {
|
|
654
715
|
/**
|
|
655
|
-
*
|
|
716
|
+
* 数据中心地址,当存在此值时,后续所有请求发送到该地址。该地址不携带协议头,故需要补全 `https://` 协议头
|
|
656
717
|
*/
|
|
657
|
-
|
|
718
|
+
clusterId: string;
|
|
658
719
|
/**
|
|
659
|
-
*
|
|
720
|
+
* 发布的资源列表
|
|
660
721
|
*/
|
|
661
|
-
|
|
722
|
+
publishList: IResource[];
|
|
662
723
|
/**
|
|
663
|
-
*
|
|
724
|
+
* @deprecated 目前并未使用,服务器返回值为 ''
|
|
664
725
|
*/
|
|
665
|
-
|
|
726
|
+
roomId: '';
|
|
666
727
|
/**
|
|
667
|
-
*
|
|
728
|
+
* 远端 SDP 数据
|
|
668
729
|
*/
|
|
669
|
-
|
|
730
|
+
sdp: {
|
|
731
|
+
type: 'answer';
|
|
732
|
+
sdp: string;
|
|
733
|
+
};
|
|
670
734
|
/**
|
|
671
|
-
*
|
|
735
|
+
* 直播模式推流数据,仅在直播模式有值
|
|
672
736
|
*/
|
|
673
|
-
|
|
737
|
+
urls?: ILiveUrls;
|
|
674
738
|
/**
|
|
675
|
-
*
|
|
739
|
+
* 跨房间连麦响应数据
|
|
676
740
|
*/
|
|
677
|
-
|
|
741
|
+
otherRoomsRes?: {
|
|
742
|
+
[roomId: string]: ILiveUrls;
|
|
743
|
+
};
|
|
678
744
|
/**
|
|
679
|
-
*
|
|
680
|
-
*
|
|
681
|
-
* 多 peerC 上行: roomId_tag、下行: roomId_sub
|
|
682
|
-
* 观众加房间: roomId_sub
|
|
683
|
-
* 观众不加房间: userId_sub
|
|
684
|
-
* @param isPub 是否为上行、下行
|
|
685
|
-
* @param tag 多 peerC 时,上行需资源标识
|
|
745
|
+
* 直播 mcu 资源
|
|
746
|
+
* 主播发布为具体资源,会议模式为空数组
|
|
686
747
|
*/
|
|
687
|
-
|
|
748
|
+
mcuPublishList?: IResource[];
|
|
688
749
|
/**
|
|
689
|
-
*
|
|
690
|
-
* @param pcName 使用的 peerConnection 名称
|
|
691
|
-
* @param tracks 本次要操作的资源
|
|
750
|
+
* 订阅成功的资源
|
|
692
751
|
*/
|
|
693
|
-
|
|
752
|
+
subscribedList?: {
|
|
753
|
+
mediaType: RCMediaType.AUDIO_ONLY | RCMediaType.VIDEO_ONLY;
|
|
754
|
+
msid: string;
|
|
755
|
+
userId: string;
|
|
756
|
+
simulcast?: RCStreamType;
|
|
757
|
+
}[];
|
|
758
|
+
}
|
|
759
|
+
interface IBroadcastSubReqBody {
|
|
694
760
|
/**
|
|
695
|
-
*
|
|
696
|
-
* @param pcName
|
|
697
|
-
* @returns
|
|
761
|
+
* 客户端 offer
|
|
698
762
|
*/
|
|
699
|
-
|
|
763
|
+
sdp: {
|
|
764
|
+
type: 'offer';
|
|
765
|
+
sdp: string;
|
|
766
|
+
};
|
|
700
767
|
/**
|
|
701
|
-
*
|
|
768
|
+
* 直播信息
|
|
702
769
|
*/
|
|
703
|
-
|
|
770
|
+
liveUrl?: string;
|
|
704
771
|
/**
|
|
705
|
-
*
|
|
772
|
+
* 订阅的资源类型,默认为 `RCMediaType.AUDIO_VIDEO`
|
|
706
773
|
*/
|
|
707
|
-
|
|
774
|
+
mediaType?: RCMediaType;
|
|
708
775
|
/**
|
|
709
|
-
*
|
|
776
|
+
* 订阅大/小流,默认订阅大流
|
|
710
777
|
*/
|
|
711
|
-
|
|
778
|
+
simulcast?: RCStreamType;
|
|
712
779
|
/**
|
|
713
|
-
*
|
|
780
|
+
* 允许 server 根据网络状况动态切换大小流,默认为 false
|
|
714
781
|
*/
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
/**
|
|
721
|
-
* 存放 peerConnection 上本次要发布、取消发布、订阅、取消订阅的 track
|
|
722
|
-
*/
|
|
723
|
-
tracks: TrackParam[];
|
|
782
|
+
switchstream: boolean;
|
|
783
|
+
/**
|
|
784
|
+
* 订阅列表
|
|
785
|
+
*/
|
|
786
|
+
subscribeList?: {
|
|
724
787
|
/**
|
|
725
|
-
*
|
|
788
|
+
* 流资源 uri
|
|
726
789
|
*/
|
|
727
|
-
|
|
790
|
+
uri: string;
|
|
728
791
|
/**
|
|
729
|
-
*
|
|
792
|
+
* 大小流订阅,`1` 为大流,`2` 为小流,默认使用大流
|
|
730
793
|
*/
|
|
731
|
-
|
|
794
|
+
simulcast: RCStreamType;
|
|
732
795
|
/**
|
|
733
|
-
*
|
|
796
|
+
* 分辨率信息
|
|
734
797
|
*/
|
|
735
|
-
|
|
736
|
-
};
|
|
798
|
+
resolution: string;
|
|
799
|
+
}[];
|
|
737
800
|
/**
|
|
738
|
-
*
|
|
801
|
+
* 是否采用新版本模式,加入房间
|
|
739
802
|
*/
|
|
740
|
-
|
|
803
|
+
newVersionFlag?: boolean;
|
|
804
|
+
}
|
|
805
|
+
interface IBroadcastSubRespBody extends IRTCResponse {
|
|
741
806
|
/**
|
|
742
|
-
*
|
|
807
|
+
* 已订阅的资源列表
|
|
743
808
|
*/
|
|
744
|
-
|
|
809
|
+
subscribedList: IResource[];
|
|
745
810
|
/**
|
|
746
|
-
*
|
|
811
|
+
* 远端 SDP
|
|
747
812
|
*/
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
* RCRTCPeerConnection 对象
|
|
752
|
-
*/
|
|
753
|
-
pc: RCRTCPeerConnection;
|
|
754
|
-
/**
|
|
755
|
-
* 存放 peerConnection 上本次要发布、取消发布、订阅、取消订阅的 track
|
|
756
|
-
*/
|
|
757
|
-
tracks: TrackParam[];
|
|
758
|
-
/**
|
|
759
|
-
* 当前 peerC 是否为发上行的 peerConnection
|
|
760
|
-
*/
|
|
761
|
-
isPub: boolean;
|
|
762
|
-
/**
|
|
763
|
-
* peerConnection 上行资源,暂不需要
|
|
764
|
-
*/
|
|
765
|
-
publishList?: IPublishedResource[] | undefined;
|
|
766
|
-
/**
|
|
767
|
-
* peerConnection 下行资源,暂不需要
|
|
768
|
-
*/
|
|
769
|
-
subscribeList?: ISubscribeAttr[] | undefined;
|
|
770
|
-
};
|
|
813
|
+
sdp: {
|
|
814
|
+
type: 'answer';
|
|
815
|
+
sdp: string;
|
|
771
816
|
};
|
|
772
|
-
setPeerCData(pcName: string, key: string, value: any): void;
|
|
773
|
-
/**
|
|
774
|
-
* 销毁资源
|
|
775
|
-
*/
|
|
776
|
-
clear(): void;
|
|
777
817
|
}
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
failedTracks?: {
|
|
783
|
-
code: RCRTCCode;
|
|
784
|
-
tracks: RCLocalTrack[];
|
|
785
|
-
}[];
|
|
818
|
+
/**
|
|
819
|
+
* 获取 CDN 资源拉流地址请求 headers
|
|
820
|
+
*/
|
|
821
|
+
interface ICDNPlayUrlReqHeaders extends IMCUReqHeaders {
|
|
786
822
|
}
|
|
787
823
|
/**
|
|
788
|
-
*
|
|
824
|
+
* 获取 CDN 资源拉流地址响应
|
|
789
825
|
*/
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
826
|
+
interface ICDNPlayUrlResponse extends IRTCResponse {
|
|
827
|
+
data: {
|
|
828
|
+
fps: number;
|
|
829
|
+
h: number;
|
|
830
|
+
'pull_url': string;
|
|
831
|
+
w: number;
|
|
832
|
+
};
|
|
833
|
+
}
|
|
834
|
+
/**
|
|
835
|
+
* cdn_uris 里面包含的字段
|
|
836
|
+
*/
|
|
837
|
+
interface ICDNUris {
|
|
799
838
|
/**
|
|
800
|
-
*
|
|
839
|
+
* 是否扩散
|
|
801
840
|
*/
|
|
802
|
-
|
|
803
|
-
protected readonly _clientSessionId?: string | undefined;
|
|
841
|
+
broadcast: RCInnerCDNBroadcast;
|
|
804
842
|
/**
|
|
805
|
-
*
|
|
843
|
+
* 拉流资源的宽度
|
|
806
844
|
*/
|
|
807
|
-
|
|
845
|
+
w?: number;
|
|
808
846
|
/**
|
|
809
|
-
*
|
|
847
|
+
* 拉流资源的高度
|
|
810
848
|
*/
|
|
811
|
-
|
|
849
|
+
h?: number;
|
|
812
850
|
/**
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
851
|
+
* 帧率
|
|
852
|
+
*/
|
|
853
|
+
fps?: number;
|
|
816
854
|
/**
|
|
817
|
-
*
|
|
855
|
+
* 获取拉流地址的 url
|
|
818
856
|
*/
|
|
819
|
-
|
|
857
|
+
url: string;
|
|
820
858
|
/**
|
|
821
|
-
*
|
|
859
|
+
* 开启、停用 CDN
|
|
822
860
|
*/
|
|
823
|
-
|
|
861
|
+
enableInnerCDN?: boolean;
|
|
824
862
|
/**
|
|
825
|
-
*
|
|
863
|
+
* 推送模式,手动 or 自动
|
|
826
864
|
*/
|
|
827
|
-
|
|
865
|
+
'push_mode': RCInnerCDNPushMode;
|
|
866
|
+
'pull_safe': boolean;
|
|
867
|
+
}
|
|
868
|
+
|
|
869
|
+
/**
|
|
870
|
+
* 直播布局模式定义
|
|
871
|
+
*/
|
|
872
|
+
declare enum MixLayoutMode {
|
|
828
873
|
/**
|
|
829
|
-
*
|
|
874
|
+
* 自定义布局
|
|
830
875
|
*/
|
|
831
|
-
|
|
876
|
+
CUSTOMIZE = 1,
|
|
832
877
|
/**
|
|
833
|
-
*
|
|
878
|
+
* 悬浮布局(默认)
|
|
834
879
|
*/
|
|
835
|
-
|
|
880
|
+
SUSPENSION = 2,
|
|
836
881
|
/**
|
|
837
|
-
*
|
|
838
|
-
*/
|
|
839
|
-
private _audioLevelReport;
|
|
840
|
-
/**
|
|
841
|
-
* peerConnection 管理类
|
|
842
|
-
*/
|
|
843
|
-
protected _peerCManager: RCRTCPeerCManager | null;
|
|
844
|
-
constructor(_context: RTCPluginContext, _runtime: IRuntime, _roomId: string, data: IJoinRTCRoomData, _roomMode: RTCMode, _service: RCMediaService, _initOptions: IRCRTCInitOptions, _ntfClearRoomItem: Function, isUpgrade?: boolean, _isMainRoom?: boolean | undefined,
|
|
845
|
-
/**
|
|
846
|
-
* 是否使用多 peerConnection
|
|
847
|
-
*/
|
|
848
|
-
_useMutilPeerC?: boolean | undefined, _clientSessionId?: string | undefined);
|
|
849
|
-
private _initRemoteTracks;
|
|
850
|
-
private _handlePingResult;
|
|
851
|
-
/**
|
|
852
|
-
* 设置房间上行资源的总码率配置
|
|
853
|
-
* @description
|
|
854
|
-
* * 自 v5.1.0 版本开始,推荐使用 `RCLocalTrack.setBitrate` 对不同流分别指定码率。
|
|
855
|
-
* * 该方法仅在 SDP `plan-b` 协议下(Chrome 92 与 Safari 11 之前的版本)有效。
|
|
856
|
-
* @param max 音视频发送码率上限,不可小于 200 且不可小于 `min`
|
|
857
|
-
* @param min 音视频发送码率下限,默认值为 1,且不可小于 1,不可大于 `max`
|
|
858
|
-
* @param start 起始码率,默认为码率上限的 70%
|
|
859
|
-
*/
|
|
860
|
-
setBitrate(max: number, min: number, start?: number): void;
|
|
861
|
-
private _onTrackReady;
|
|
862
|
-
protected _callAppListener(eventType: keyof IRoomEventListener, ...attrs: any[]): void;
|
|
863
|
-
private _onUserUnpublish;
|
|
864
|
-
private _onTrackUnpublish;
|
|
865
|
-
private _unpublishPrev;
|
|
866
|
-
__parseInnerMessage(message: IReceivedMessage): boolean;
|
|
867
|
-
private msgTaskQueue;
|
|
868
|
-
/**
|
|
869
|
-
* 被踢出房间通知
|
|
870
|
-
* @param byServer
|
|
871
|
-
* * 当值为 false 时,说明本端 rtcPing 超时
|
|
872
|
-
* * 当值为 true 时,说明本端收到被踢出房间通知
|
|
873
|
-
*/
|
|
874
|
-
private _kickoff;
|
|
875
|
-
private _rtcpeerClosed;
|
|
876
|
-
/**
|
|
877
|
-
* 处理资源变更事件
|
|
878
|
-
* @param content
|
|
879
|
-
* @param messageType 消息类型
|
|
880
|
-
* @param userId 消息发送者
|
|
881
|
-
*/
|
|
882
|
-
protected _resourceHandle(content: {
|
|
883
|
-
/**
|
|
884
|
-
* 旧版本兼容参数,当收到非 `RTCMessageName.TOTAL_CONTENT_RESOURCE` 时:
|
|
885
|
-
* * ignore 值为 `true` 表示该消息由 signal server 向旧版本 RTCLib 提供的兼容消息,无需处理
|
|
886
|
-
* * 否则认为该消息是由旧版本 RTCLib 主动发出的增量变更消息,需要处理
|
|
887
|
-
*/
|
|
888
|
-
ignore?: boolean;
|
|
889
|
-
/**
|
|
890
|
-
* 发布到房间内的资源列表,`RTCMessageName.TOTAL_CONTENT_RESOURCE` 消息携带全量数据,否则为增量数据
|
|
891
|
-
*/
|
|
892
|
-
uris: IPublishedResource[];
|
|
893
|
-
}, messageType: string, userId: string): Promise<void>;
|
|
894
|
-
private _onTrackPublish;
|
|
895
|
-
/**
|
|
896
|
-
* 处理 `RCRTCMessageType.STATE` 消息
|
|
897
|
-
* @param content
|
|
898
|
-
*/
|
|
899
|
-
private _stateHandle;
|
|
900
|
-
/**
|
|
901
|
-
* 获取房间 Id
|
|
902
|
-
*/
|
|
903
|
-
getRoomId(): string;
|
|
904
|
-
/**
|
|
905
|
-
* 获取当前 userId
|
|
906
|
-
*/
|
|
907
|
-
getCrtUserId(): string;
|
|
908
|
-
/**
|
|
909
|
-
* 获取 _pc 实例
|
|
910
|
-
*/
|
|
911
|
-
__getPC(): RCRTCPeerConnection[];
|
|
912
|
-
/**
|
|
913
|
-
* 获取远程用户列表,不包含当前用户
|
|
914
|
-
*/
|
|
915
|
-
getRemoteUserIds(): string[];
|
|
916
|
-
/**
|
|
917
|
-
* 获取所有房间已发布的远端资源列表
|
|
918
|
-
* @returns
|
|
919
|
-
*/
|
|
920
|
-
getRemoteTracks(): RCRemoteTrack[];
|
|
921
|
-
/**
|
|
922
|
-
* 获取远端用户的资源列表
|
|
923
|
-
* @param userId
|
|
924
|
-
* @returns
|
|
925
|
-
*/
|
|
926
|
-
getRemoteTracksByUserId(userId: string): RCRemoteTrack[];
|
|
927
|
-
/**
|
|
928
|
-
* 获取房间当前会话 Id,当房间内已无成员时房间会回收,重新加入时 sessionId 将更新
|
|
929
|
-
*/
|
|
930
|
-
getSessionId(): string;
|
|
931
|
-
/**
|
|
932
|
-
* 向房间内发消息
|
|
933
|
-
* @param name 消息名称
|
|
934
|
-
* @param content 消息内容
|
|
935
|
-
*/
|
|
936
|
-
sendMessage(name: string, content: any): Promise<{
|
|
937
|
-
code: RCRTCCode;
|
|
938
|
-
}>;
|
|
939
|
-
/**
|
|
940
|
-
* 设置房间属性
|
|
941
|
-
* @param key 属性名
|
|
942
|
-
* @param value 属性值
|
|
943
|
-
* @param message 是否在设置属性的时候携带消息内容,传空则不往房间中发送消息
|
|
944
|
-
* @param isInner RTC 业务内部使用参数,用户忽略
|
|
945
|
-
*/
|
|
946
|
-
setRoomAttribute(key: string, value: string, message?: {
|
|
947
|
-
name: string;
|
|
948
|
-
content: string;
|
|
949
|
-
}, isInner?: boolean): Promise<{
|
|
950
|
-
code: RCRTCCode;
|
|
951
|
-
}>;
|
|
952
|
-
/**
|
|
953
|
-
* 删除房间属性
|
|
954
|
-
* @param keys 待删除的属性名数组
|
|
955
|
-
* @param message 是否在删除属性的时候携带消息内容,传空则不往房间中发送消息
|
|
956
|
-
* @param isInner RTC 业务内部使用参数,用户忽略
|
|
957
|
-
*/
|
|
958
|
-
deleteRoomAttributes(keys: string[], message?: {
|
|
959
|
-
name: string;
|
|
960
|
-
content: string;
|
|
961
|
-
}, isInner?: boolean): Promise<{
|
|
962
|
-
code: RCRTCCode;
|
|
963
|
-
}>;
|
|
964
|
-
/**
|
|
965
|
-
* 获取房间属性
|
|
966
|
-
* @param keys 要查询的属性名数组,当数组长度为空时,取所有已设置的 kv 值
|
|
967
|
-
* @param isInner RTC 业务内部使用参数,用户忽略
|
|
968
|
-
*/
|
|
969
|
-
getRoomAttributes(keys?: string[], isInner?: boolean): Promise<{
|
|
970
|
-
code: RCRTCCode;
|
|
971
|
-
data?: KVString;
|
|
972
|
-
}>;
|
|
973
|
-
/**
|
|
974
|
-
* 设置当前用户属性(暂不开放)
|
|
975
|
-
* @param key 属性名
|
|
976
|
-
* @param value 属性值
|
|
977
|
-
* @param message 是否在设置属性的时候携带消息内容,传空则不往房间中发送消息
|
|
978
|
-
*/
|
|
979
|
-
private _setUserAttributeValue;
|
|
980
|
-
/**
|
|
981
|
-
* 删除当前用户属性(暂不开放)
|
|
982
|
-
* @param keys 待删除的属性名数组
|
|
983
|
-
* @param message 是否在删除属性的时候携带消息内容,传空则不往房间中发送消息
|
|
984
|
-
*/
|
|
985
|
-
private _deleteUserAttributes;
|
|
986
|
-
/**
|
|
987
|
-
* 获取当前用户属性(暂不开放)
|
|
988
|
-
* @param keys 要查询的属性名数组
|
|
882
|
+
* 自适应布局
|
|
989
883
|
*/
|
|
990
|
-
|
|
884
|
+
ADAPTATION = 3
|
|
885
|
+
}
|
|
886
|
+
|
|
887
|
+
/**
|
|
888
|
+
* 合流布局对视频的填充模式
|
|
889
|
+
*/
|
|
890
|
+
declare enum MixVideoRenderMode {
|
|
991
891
|
/**
|
|
992
|
-
*
|
|
892
|
+
* 裁剪(默认)
|
|
993
893
|
*/
|
|
994
|
-
|
|
894
|
+
CROP = 1,
|
|
995
895
|
/**
|
|
996
|
-
*
|
|
896
|
+
* 不裁剪
|
|
997
897
|
*/
|
|
998
|
-
|
|
898
|
+
WHOLE = 2
|
|
899
|
+
}
|
|
900
|
+
|
|
901
|
+
declare enum RCInnerCDNModel {
|
|
902
|
+
OPEN = 1,
|
|
903
|
+
STOP = 2
|
|
904
|
+
}
|
|
905
|
+
|
|
906
|
+
declare enum RCMixInputFilterMode {
|
|
907
|
+
/** 全合流,后续加入房间的用户会自动合流 */
|
|
908
|
+
AUDIO_VIDEO_ALL = 0,
|
|
909
|
+
/** 全不合流,后续加入本房间的用户 */
|
|
910
|
+
AUDIO_VIDEO_NO = 1,
|
|
911
|
+
/** 音频全订阅, 视频全不订阅 */
|
|
912
|
+
AUDIO_ALL_VIDEO_NO = 2,
|
|
913
|
+
/** 视频全订阅, 音频全不订阅 */
|
|
914
|
+
AUDIO_NO_VIDEO_ALL = 3,
|
|
999
915
|
/**
|
|
1000
|
-
*
|
|
1001
|
-
* 导致在未完全退出的过程中仍能听到房间内的声音问题
|
|
916
|
+
* 根据设置的音频合流列表和视频合流列表合并媒体流
|
|
1002
917
|
*/
|
|
1003
|
-
|
|
1004
|
-
|
|
918
|
+
AUDIO_VIDEO_INPUT = 4,
|
|
919
|
+
/** 音频全订阅,视频根据设置的视频合流列表 */
|
|
920
|
+
AUDIO_ALL_VIDEO_INPUT = 5,
|
|
921
|
+
/** 音频全不订阅, 视频根据input里面的视频项订阅 */
|
|
922
|
+
AUDIO_NO_VIDEO_INPUT = 6,
|
|
923
|
+
/** 视频全订阅, 音频根据input里面的音频项订阅 */
|
|
924
|
+
AUDIO_INPUT_VIDEO_ALL = 7,
|
|
925
|
+
/** 视频全不订阅, 音频根据input里面的音频项订阅 */
|
|
926
|
+
AUDIO_INPUT_VIDEO_NO = 8,
|
|
927
|
+
/** 按房间列表订阅音视频(保留当前已经订阅的, 但没在房间列表里的音视频) */
|
|
928
|
+
ROOM_AUDIO_VIDEO_APPEND = 9,
|
|
929
|
+
/** 按房间列表订阅音视频(清理当前已经订阅的, 但没在房间列表里的音视频) */
|
|
930
|
+
ROOM_AUDIO_VIDEO_NOT_APPEND = 10,
|
|
931
|
+
/** 按房间列表订阅音频, 不订阅视频(保留当前已经订阅的, 但没在房间列表里的音频) */
|
|
932
|
+
ROOM_AUDIO_APPEND = 11,
|
|
933
|
+
/** 按房间列表订阅音视, 不订阅视频(清理当前已经订阅的, 但没在房间列表里的音频) */
|
|
934
|
+
ROOM_AUDIO_NOT_APPEND = 12,
|
|
935
|
+
/** 按房间列表订阅视频, 不订阅音频(保留当前已经订阅的, 但没在房间列表里的视频) */
|
|
936
|
+
ROOM_VIDEO_APPEND = 13,
|
|
937
|
+
/** 按房间列表订阅视频, 不订阅音频(清理当前已经订阅的, 但没在房间列表里的视频) */
|
|
938
|
+
ROOM_VIDEO_NOT_APPEND = 14
|
|
939
|
+
}
|
|
940
|
+
|
|
941
|
+
/**
|
|
942
|
+
* 合流后的 video 输出编码配置,包含分辨率、帧率、码率配置项
|
|
943
|
+
*/
|
|
944
|
+
interface IMCUOutputVideoAttrs {
|
|
1005
945
|
/**
|
|
1006
|
-
*
|
|
946
|
+
* 视频分辨率宽度
|
|
1007
947
|
*/
|
|
1008
|
-
|
|
1009
|
-
private _onLocalTrackDestroied;
|
|
948
|
+
width?: number;
|
|
1010
949
|
/**
|
|
1011
|
-
*
|
|
1012
|
-
* @param localTrack
|
|
950
|
+
* 视频分辨率高度
|
|
1013
951
|
*/
|
|
1014
|
-
|
|
952
|
+
height?: number;
|
|
1015
953
|
/**
|
|
1016
|
-
*
|
|
954
|
+
* 帧率
|
|
1017
955
|
*/
|
|
1018
|
-
|
|
956
|
+
fps?: number;
|
|
1019
957
|
/**
|
|
1020
|
-
*
|
|
1021
|
-
* @param tracks 待发布的 RCLocalTrack 实例
|
|
1022
|
-
* @returns
|
|
958
|
+
* 码率
|
|
1023
959
|
*/
|
|
1024
|
-
|
|
1025
|
-
|
|
960
|
+
bitrate?: number;
|
|
961
|
+
}
|
|
962
|
+
/**
|
|
963
|
+
* 合并入 MCU 的音频流
|
|
964
|
+
*/
|
|
965
|
+
interface IMCUInputAudio {
|
|
966
|
+
user_id: string;
|
|
967
|
+
stream_id: string;
|
|
968
|
+
}
|
|
969
|
+
/**
|
|
970
|
+
* 自定义布局中的单一视频流布局
|
|
971
|
+
*/
|
|
972
|
+
interface IMCUInputVideoLayout {
|
|
973
|
+
user_id: string;
|
|
974
|
+
stream_id: string;
|
|
975
|
+
x: number;
|
|
976
|
+
y: number;
|
|
977
|
+
width: number;
|
|
978
|
+
height: number;
|
|
979
|
+
}
|
|
980
|
+
/**
|
|
981
|
+
* 图片配置,用于水印、视频流背景图
|
|
982
|
+
*/
|
|
983
|
+
interface IPictureAttrs {
|
|
1026
984
|
/**
|
|
1027
|
-
*
|
|
1028
|
-
* @param pubResList 每一个 tag 的发布结果[]
|
|
985
|
+
* 资源下载地址,需包含协议
|
|
1029
986
|
*/
|
|
1030
|
-
|
|
987
|
+
uri: string;
|
|
1031
988
|
/**
|
|
1032
|
-
*
|
|
989
|
+
* 相对于整体画布的起始位置 x 坐标
|
|
1033
990
|
*/
|
|
1034
|
-
|
|
991
|
+
x: number;
|
|
1035
992
|
/**
|
|
1036
|
-
*
|
|
993
|
+
* 相对于整体画布的起始位置 y 坐标
|
|
1037
994
|
*/
|
|
1038
|
-
|
|
1039
|
-
protected _exchangeHandle(body: IExchangeReqBody, pcName: string): Promise<{
|
|
1040
|
-
code: RCRTCCode;
|
|
1041
|
-
data?: IExchangeResponse | undefined;
|
|
1042
|
-
}>;
|
|
1043
|
-
protected _getRTCReqestHeaders(pcName: string): IRTCReqHeader;
|
|
995
|
+
y: number;
|
|
1044
996
|
/**
|
|
1045
|
-
*
|
|
1046
|
-
* @param subscribeList 订阅清单
|
|
1047
|
-
* @param iceRestart
|
|
997
|
+
* 相对于整体画布的宽(百分比),有效值 `0.0` - `1.0`
|
|
1048
998
|
*/
|
|
1049
|
-
|
|
999
|
+
w: number;
|
|
1050
1000
|
/**
|
|
1051
|
-
*
|
|
1052
|
-
* @param trackId
|
|
1001
|
+
* 相对于整体画布的高(百分比),有效值 `0.0` - `1.0`
|
|
1053
1002
|
*/
|
|
1054
|
-
|
|
1003
|
+
h: number;
|
|
1004
|
+
}
|
|
1005
|
+
/**
|
|
1006
|
+
* 合流后的 Video 输出配置,包含背景图、背景色、大小流编码等配置项
|
|
1007
|
+
*/
|
|
1008
|
+
interface IMCUOutputVideoConfig {
|
|
1055
1009
|
/**
|
|
1056
|
-
*
|
|
1057
|
-
* @param tracks 取消发布的 RCLocalTrack 列表
|
|
1010
|
+
* 标准流输出定义
|
|
1058
1011
|
*/
|
|
1059
|
-
|
|
1060
|
-
private __unpublish;
|
|
1061
|
-
private _mergeUnpublishRes;
|
|
1012
|
+
normal?: IMCUOutputVideoAttrs;
|
|
1062
1013
|
/**
|
|
1063
|
-
*
|
|
1064
|
-
* @param resourceId
|
|
1014
|
+
* 小流输出定义
|
|
1065
1015
|
*/
|
|
1066
|
-
|
|
1016
|
+
tiny?: IMCUOutputVideoAttrs;
|
|
1017
|
+
exparams?: {
|
|
1018
|
+
/**
|
|
1019
|
+
* 合流布局时,对视频流的填充方式
|
|
1020
|
+
*/
|
|
1021
|
+
renderMode: MixVideoRenderMode;
|
|
1022
|
+
};
|
|
1067
1023
|
/**
|
|
1068
|
-
*
|
|
1069
|
-
* @param resourceId
|
|
1024
|
+
* 背景色,如 `'0xf1a2c3'`
|
|
1070
1025
|
*/
|
|
1071
|
-
|
|
1026
|
+
backgroundColor?: string;
|
|
1072
1027
|
/**
|
|
1073
|
-
*
|
|
1074
|
-
* @param tracks
|
|
1028
|
+
* 背景图
|
|
1075
1029
|
*/
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1030
|
+
backgroundPicture?: {
|
|
1031
|
+
/**
|
|
1032
|
+
* 填充模式:
|
|
1033
|
+
* 1. 按比例裁剪
|
|
1034
|
+
* 2. 不裁剪,按比例压缩
|
|
1035
|
+
*/
|
|
1036
|
+
fillMode: 1 | 2;
|
|
1037
|
+
/**
|
|
1038
|
+
* 资源列表
|
|
1039
|
+
*/
|
|
1040
|
+
picture: IPictureAttrs[];
|
|
1041
|
+
};
|
|
1042
|
+
}
|
|
1043
|
+
/**
|
|
1044
|
+
* 合流后的媒体输出定义
|
|
1045
|
+
*/
|
|
1046
|
+
interface IMCUOutputConfig {
|
|
1081
1047
|
/**
|
|
1082
|
-
*
|
|
1083
|
-
* @param tracks 预取消远端资源
|
|
1048
|
+
* 输出视频配置
|
|
1084
1049
|
*/
|
|
1085
|
-
|
|
1086
|
-
code: RCRTCCode;
|
|
1087
|
-
failedList?: ISubscribeAttr[];
|
|
1088
|
-
}>;
|
|
1089
|
-
private __unsubscribe;
|
|
1090
|
-
protected _assertRoomDestroyed(): RCRTCCode | undefined;
|
|
1050
|
+
video: IMCUOutputVideoConfig;
|
|
1091
1051
|
/**
|
|
1092
|
-
*
|
|
1093
|
-
* @param trackId
|
|
1094
|
-
* @returns
|
|
1052
|
+
* 输出音频配置
|
|
1095
1053
|
*/
|
|
1096
|
-
|
|
1054
|
+
audio?: {
|
|
1055
|
+
/**
|
|
1056
|
+
* 音频码率
|
|
1057
|
+
*/
|
|
1058
|
+
bitrate: number;
|
|
1059
|
+
};
|
|
1097
1060
|
/**
|
|
1098
|
-
*
|
|
1061
|
+
* CDN 推流地址列表
|
|
1099
1062
|
*/
|
|
1100
|
-
|
|
1063
|
+
cdn?: {
|
|
1064
|
+
/**
|
|
1065
|
+
* 推流地址,如:`'rtmp://xxxx'`
|
|
1066
|
+
*/
|
|
1067
|
+
pushurl: string;
|
|
1068
|
+
}[];
|
|
1069
|
+
}
|
|
1070
|
+
/**
|
|
1071
|
+
* 合流前的单一视频流水印配置
|
|
1072
|
+
*【客户端仅提供图片水印设置】
|
|
1073
|
+
*/
|
|
1074
|
+
interface IMCUSignalScreenWaterMarkConfig {
|
|
1101
1075
|
/**
|
|
1102
|
-
*
|
|
1103
|
-
* @param trackId
|
|
1104
|
-
* @returns
|
|
1076
|
+
* 媒体流的 msid
|
|
1105
1077
|
*/
|
|
1106
|
-
|
|
1078
|
+
streamId: string;
|
|
1079
|
+
picture: IPictureAttrs[];
|
|
1080
|
+
}
|
|
1081
|
+
interface IMCUWaterMarkConfig {
|
|
1082
|
+
enable: 'on' | 'off';
|
|
1107
1083
|
/**
|
|
1108
|
-
*
|
|
1109
|
-
|
|
1110
|
-
* @param tracks 变更的资源列表
|
|
1084
|
+
* 合流后的屏幕水印配置
|
|
1085
|
+
*【客户端暂不提供合流水印设置】
|
|
1111
1086
|
*/
|
|
1112
|
-
updateSubList(tracks: (RCRemoteTrack | ISubscribeAttr)[]): Promise<{
|
|
1113
|
-
code: RCRTCCode;
|
|
1114
|
-
}>;
|
|
1115
|
-
private _updateSubListHandle;
|
|
1116
|
-
private _appListener;
|
|
1117
1087
|
/**
|
|
1118
|
-
*
|
|
1119
|
-
* @param listener
|
|
1088
|
+
* 合流前的单人视频流水印配置
|
|
1120
1089
|
*/
|
|
1121
|
-
|
|
1122
|
-
|
|
1090
|
+
singleScreen: IMCUSignalScreenWaterMarkConfig[];
|
|
1091
|
+
}
|
|
1092
|
+
/**
|
|
1093
|
+
* 发布到服务器的 MCU 配置数据
|
|
1094
|
+
*/
|
|
1095
|
+
interface IMCUConfig {
|
|
1123
1096
|
/**
|
|
1124
|
-
*
|
|
1125
|
-
* @param listener
|
|
1126
|
-
* @description 该方法暂仅支持 Chrome 浏览器
|
|
1097
|
+
* 为向后兼容,当前为常量 1
|
|
1127
1098
|
*/
|
|
1128
|
-
|
|
1099
|
+
version: 2;
|
|
1129
1100
|
/**
|
|
1130
|
-
*
|
|
1131
|
-
* @param handler 业务端传入的音量上报事件
|
|
1132
|
-
* @param gap 上报时间间隔
|
|
1101
|
+
* 布局模式,在只配置推流 CDN 时,该值不存在
|
|
1133
1102
|
*/
|
|
1134
|
-
|
|
1103
|
+
mode: MixLayoutMode;
|
|
1135
1104
|
/**
|
|
1136
|
-
*
|
|
1105
|
+
* 渲染到主位置上的流 Id,当该值为空时,输出到主位置的流按发布时间顺序优先选择最早发布的流
|
|
1137
1106
|
*/
|
|
1138
|
-
|
|
1139
|
-
data: IJoinRTCRoomData | undefined;
|
|
1140
|
-
} | void>;
|
|
1141
|
-
private _onAudioMuteChange;
|
|
1142
|
-
private _onVideoMuteChange;
|
|
1107
|
+
host_stream_id?: string;
|
|
1143
1108
|
/**
|
|
1144
|
-
*
|
|
1109
|
+
* 自定义布局输入定义,只有在 mode 值为 `MixLayoutMode.CUSTOMIZE` 时需传值
|
|
1145
1110
|
*/
|
|
1146
|
-
|
|
1111
|
+
input?: {
|
|
1112
|
+
video?: IMCUInputVideoLayout[];
|
|
1113
|
+
audio?: IMCUInputAudio[];
|
|
1114
|
+
};
|
|
1147
1115
|
/**
|
|
1148
|
-
*
|
|
1116
|
+
* 合流后的媒体输出配置
|
|
1149
1117
|
*/
|
|
1150
|
-
|
|
1118
|
+
output?: IMCUOutputConfig;
|
|
1151
1119
|
/**
|
|
1152
|
-
*
|
|
1120
|
+
* 水印配置
|
|
1153
1121
|
*/
|
|
1154
|
-
|
|
1122
|
+
waterMark?: IMCUWaterMarkConfig;
|
|
1155
1123
|
/**
|
|
1156
|
-
*
|
|
1124
|
+
* MCU 拉流配置,决定 MCU 从 MediaServer 拉流的方式
|
|
1157
1125
|
*/
|
|
1158
|
-
|
|
1126
|
+
inputFilterMode?: RCMixInputFilterMode;
|
|
1159
1127
|
/**
|
|
1160
|
-
*
|
|
1128
|
+
* MCU 混入列表中房间内的资源
|
|
1161
1129
|
*/
|
|
1162
|
-
|
|
1163
|
-
getClientSessionId(): string | undefined;
|
|
1130
|
+
mixRooms?: string[];
|
|
1164
1131
|
}
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1132
|
+
/**
|
|
1133
|
+
* 设置开启、停用内置 CDN 数据
|
|
1134
|
+
*/
|
|
1135
|
+
interface ISetEnableCDN {
|
|
1136
|
+
version: 2;
|
|
1137
|
+
output: {
|
|
1138
|
+
/**
|
|
1139
|
+
* 手动开启/停用内置 CDN
|
|
1140
|
+
*/
|
|
1141
|
+
inCDNModel: RCInnerCDNModel;
|
|
1142
|
+
};
|
|
1172
1143
|
}
|
|
1173
1144
|
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
* @param userIds 加入主播的 id 列表
|
|
1178
|
-
*/
|
|
1179
|
-
onAnchorJoin?(userId: string[]): void;
|
|
1180
|
-
/**
|
|
1181
|
-
* 主播退出
|
|
1182
|
-
* @param userIds 退出主播的 id 列表
|
|
1183
|
-
*/
|
|
1184
|
-
onAnchorLeave?(userId: string[]): void;
|
|
1145
|
+
declare class RCMediaService {
|
|
1146
|
+
private readonly _runtime;
|
|
1147
|
+
private readonly _context;
|
|
1185
1148
|
/**
|
|
1186
|
-
*
|
|
1187
|
-
* @param tracks 新发布的合流音轨与视轨数据列表,包含新发布的 RCRemoteAudioTrack 与 RCRemoteVideoTrack 实例
|
|
1188
|
-
* @description
|
|
1189
|
-
* 当房间内某个主播第一次发布资源时触发
|
|
1149
|
+
* 自定义 MediaServer 地址,当有值时,不再使用导航内的地址
|
|
1190
1150
|
*/
|
|
1191
|
-
|
|
1151
|
+
private readonly _msUrl?;
|
|
1192
1152
|
/**
|
|
1193
|
-
*
|
|
1194
|
-
* @param tracks 被取消发布的合流音轨与视轨数据列表
|
|
1195
|
-
* @description
|
|
1196
|
-
* 当房间内全部主播退出房间时,SDK 内部会取消对资源的订阅,业务层仅需处理 UI 业务
|
|
1153
|
+
* 请求超时时长
|
|
1197
1154
|
*/
|
|
1198
|
-
|
|
1155
|
+
private readonly _timeout;
|
|
1199
1156
|
/**
|
|
1200
|
-
*
|
|
1201
|
-
* @param tracks 主播新发布的音轨与视轨数据列表,包含新发布的 RCRemoteAudioTrack 与 RCRemoteVideoTrack 实例
|
|
1157
|
+
* navi 中获取的媒体服务地址
|
|
1202
1158
|
*/
|
|
1203
|
-
|
|
1159
|
+
private readonly _msInNavi;
|
|
1204
1160
|
/**
|
|
1205
|
-
*
|
|
1206
|
-
* @param tracks 被主播取消发布的音轨与视轨数据列表
|
|
1207
|
-
* @description 当资源被取消发布时,SDK 内部会取消对相关资源的订阅,业务层仅需处理 UI 业务
|
|
1161
|
+
* 已失败的请求地址
|
|
1208
1162
|
*/
|
|
1209
|
-
|
|
1163
|
+
private readonly _failedMs;
|
|
1210
1164
|
/**
|
|
1211
|
-
*
|
|
1212
|
-
* @param audioTrack RCRemoteAudioTrack 类实例
|
|
1165
|
+
* 服务器指纹数据,客户端不得修改,直接透传
|
|
1213
1166
|
*/
|
|
1214
|
-
|
|
1167
|
+
private _rtcFinger;
|
|
1215
1168
|
/**
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
onVideoMuteChange?(videoTrack: RCRemoteVideoTrack): void;
|
|
1169
|
+
* 服务器接口返回的 clusterId 数据,当此数据有值时,后续所有请求向此服务发送
|
|
1170
|
+
*/
|
|
1171
|
+
private _clusterId;
|
|
1220
1172
|
/**
|
|
1221
|
-
*
|
|
1173
|
+
* MCU 服务地址
|
|
1222
1174
|
*/
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
fps: RCFrameRate;
|
|
1226
|
-
}): void;
|
|
1175
|
+
private _configUrl;
|
|
1176
|
+
constructor(_runtime: IRuntime, _context: RTCPluginContext,
|
|
1227
1177
|
/**
|
|
1228
|
-
*
|
|
1178
|
+
* 自定义 MediaServer 地址,当有值时,不再使用导航内的地址
|
|
1229
1179
|
*/
|
|
1230
|
-
|
|
1180
|
+
_msUrl?: string | undefined,
|
|
1231
1181
|
/**
|
|
1232
|
-
*
|
|
1182
|
+
* 请求超时时长
|
|
1233
1183
|
*/
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
fps: RCFrameRate;
|
|
1237
|
-
}): void;
|
|
1238
|
-
}
|
|
1239
|
-
/**
|
|
1240
|
-
* 观众直播房间类
|
|
1241
|
-
* 处理:
|
|
1242
|
-
* 1、通知观众房间内 人员变更、资源变更
|
|
1243
|
-
* 2、观众订阅、取消订阅资源
|
|
1244
|
-
*/
|
|
1245
|
-
declare class RCAudienceLivingRoom {
|
|
1246
|
-
private readonly _context;
|
|
1247
|
-
private readonly _runtime;
|
|
1248
|
-
private readonly _initOptions;
|
|
1249
|
-
readonly _roomId: string;
|
|
1250
|
-
private readonly _joinResData;
|
|
1251
|
-
readonly _livingType: RCLivingType;
|
|
1252
|
-
private _useMutilPeerC?;
|
|
1253
|
-
protected readonly _clientSessionId?: string | undefined;
|
|
1254
|
-
private readonly _service;
|
|
1184
|
+
_timeout?: number);
|
|
1185
|
+
getNaviMS(): string[];
|
|
1255
1186
|
/**
|
|
1256
|
-
*
|
|
1187
|
+
* 发送请求,请求发送若失败,会继续尝试使用后续可用地址直到无地址可用,此时认为请求失败
|
|
1188
|
+
* @param path
|
|
1189
|
+
* @param header
|
|
1190
|
+
* @param body
|
|
1257
1191
|
*/
|
|
1258
|
-
private
|
|
1192
|
+
private _request;
|
|
1259
1193
|
/**
|
|
1260
|
-
*
|
|
1194
|
+
* 资源协商接口,订阅、发布、变更资源均可以使用此接口。该接口通过 sdp 字段交换 SDP 信息,
|
|
1195
|
+
* 并通过 subscribeList 和 publishList 表明最终发布和订阅的资源。本端产出 offer,服务器产出 answer
|
|
1196
|
+
* 每次接口调用,都会全量覆盖发布和订阅的资源。
|
|
1197
|
+
* @param header
|
|
1198
|
+
* @param body
|
|
1261
1199
|
*/
|
|
1262
|
-
|
|
1200
|
+
exchange(headers: IRTCReqHeader, body: IExchangeReqBody): Promise<{
|
|
1201
|
+
code: RCRTCCode;
|
|
1202
|
+
data?: IExchangeResponse | undefined;
|
|
1203
|
+
}>;
|
|
1263
1204
|
/**
|
|
1264
|
-
*
|
|
1205
|
+
* 退出房间
|
|
1265
1206
|
*/
|
|
1266
|
-
|
|
1207
|
+
exit(headers: IRTCReqHeader): Promise<RCRTCCode>;
|
|
1267
1208
|
/**
|
|
1268
|
-
*
|
|
1209
|
+
* 观众端订阅主播资源
|
|
1269
1210
|
*/
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
private _sessionId;
|
|
1275
|
-
private _destroyed;
|
|
1211
|
+
broadcastSubscribe(headers: IRTCReqHeader, body: IBroadcastSubReqBody): Promise<{
|
|
1212
|
+
code: RCRTCCode;
|
|
1213
|
+
data?: IBroadcastSubRespBody | undefined;
|
|
1214
|
+
}>;
|
|
1276
1215
|
/**
|
|
1277
|
-
*
|
|
1216
|
+
* 观众端退出订阅
|
|
1278
1217
|
*/
|
|
1279
|
-
|
|
1218
|
+
broadcastExit(headers: IRTCReqHeader): Promise<{
|
|
1219
|
+
code: RCRTCCode;
|
|
1220
|
+
}>;
|
|
1280
1221
|
/**
|
|
1281
|
-
*
|
|
1222
|
+
* 直播推流、自定义布局配置
|
|
1282
1223
|
*/
|
|
1283
|
-
|
|
1224
|
+
setMcuConfig(headers: IMCUReqHeaders, body: IMCUConfig | ISetEnableCDN): Promise<{
|
|
1225
|
+
code: RCRTCCode;
|
|
1226
|
+
res?: any;
|
|
1227
|
+
}>;
|
|
1284
1228
|
/**
|
|
1285
|
-
*
|
|
1229
|
+
* 房间内观众获取 CDN 资源信息、拉流地址
|
|
1286
1230
|
*/
|
|
1287
|
-
|
|
1231
|
+
getCDNResourceInfo(headers: ICDNPlayUrlReqHeaders, url: string): Promise<{
|
|
1232
|
+
code: RCRTCCode;
|
|
1233
|
+
res?: ICDNPlayUrlResponse;
|
|
1234
|
+
}>;
|
|
1235
|
+
}
|
|
1236
|
+
|
|
1237
|
+
/**
|
|
1238
|
+
* 直播间类型
|
|
1239
|
+
*/
|
|
1240
|
+
declare enum RCLivingType {
|
|
1288
1241
|
/**
|
|
1289
|
-
*
|
|
1242
|
+
* 音视频直播
|
|
1290
1243
|
*/
|
|
1291
|
-
|
|
1244
|
+
VIDEO = 0,
|
|
1292
1245
|
/**
|
|
1293
|
-
*
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
}, _livingType: RCLivingType, _useMutilPeerC?: boolean | undefined, _clientSessionId?: string | undefined);
|
|
1246
|
+
* 音频直播
|
|
1247
|
+
*/
|
|
1248
|
+
AUDIO = 1
|
|
1249
|
+
}
|
|
1250
|
+
|
|
1251
|
+
declare class RCRTCPeerCManager {
|
|
1300
1252
|
/**
|
|
1301
|
-
*
|
|
1253
|
+
* 是否使用多 peerConnection
|
|
1302
1254
|
*/
|
|
1303
|
-
private
|
|
1304
|
-
protected _assertRoomDestroyed(): RCRTCCode | undefined;
|
|
1255
|
+
private readonly _useMutilPeerC;
|
|
1305
1256
|
/**
|
|
1306
|
-
*
|
|
1307
|
-
* @param roomId 数据对应的房间 Id
|
|
1308
|
-
* @param singalData 拉取到的数据
|
|
1309
|
-
* * key RC_ANCHOR_LIST value: 为主播 ID 集合
|
|
1310
|
-
* * key RC_RES_`userId` value: 为主播发布的资源
|
|
1311
|
-
* * key RC_RTC_SESSIONID value: sessionId
|
|
1312
|
-
* * key RC_CDN value: CDN 资源数据
|
|
1257
|
+
* roomId 或观众端 userId
|
|
1313
1258
|
*/
|
|
1314
|
-
private
|
|
1259
|
+
private readonly _roomId;
|
|
1315
1260
|
/**
|
|
1316
|
-
*
|
|
1261
|
+
* 断线重连每一条 peerConnection
|
|
1317
1262
|
*/
|
|
1318
|
-
private
|
|
1319
|
-
private _handleNewJoinedAnchor;
|
|
1320
|
-
private _handleLeftedAnchor;
|
|
1263
|
+
private readonly _reTryExchange;
|
|
1321
1264
|
/**
|
|
1322
|
-
*
|
|
1265
|
+
* 当前用户 id
|
|
1323
1266
|
*/
|
|
1324
|
-
private
|
|
1267
|
+
private readonly _currentUserId;
|
|
1325
1268
|
/**
|
|
1326
|
-
*
|
|
1327
|
-
|
|
1328
|
-
private
|
|
1329
|
-
private _onUserUnpublish;
|
|
1330
|
-
private _callAppListener;
|
|
1269
|
+
* 北极星上报模块
|
|
1270
|
+
*/
|
|
1271
|
+
private readonly _polarisReport?;
|
|
1331
1272
|
/**
|
|
1332
|
-
*
|
|
1333
|
-
|
|
1334
|
-
private
|
|
1273
|
+
* 存储创建的所有 peerC,key 为 pcName,/exchange 请求中 request header 中的 Peer-Connection-Id 值
|
|
1274
|
+
*/
|
|
1275
|
+
private _mutilPeerC;
|
|
1276
|
+
constructor(
|
|
1335
1277
|
/**
|
|
1336
|
-
*
|
|
1337
|
-
* @param subscribeList 订阅清单
|
|
1338
|
-
* @param publishedStreams 已发布流
|
|
1339
|
-
* @param iceRestart
|
|
1278
|
+
* 是否使用多 peerConnection
|
|
1340
1279
|
*/
|
|
1341
|
-
|
|
1342
|
-
[msid: string]: RCLocalMediaStream;
|
|
1343
|
-
}, iceRestart: boolean): Promise<{
|
|
1344
|
-
reqBody: IBroadcastSubReqBody;
|
|
1345
|
-
offer: RTCSessionDescriptionInit;
|
|
1346
|
-
dynamicBitrate: {
|
|
1347
|
-
min: number;
|
|
1348
|
-
max: number;
|
|
1349
|
-
};
|
|
1350
|
-
}>;
|
|
1351
|
-
private _subscribeHandle;
|
|
1280
|
+
_useMutilPeerC: boolean,
|
|
1352
1281
|
/**
|
|
1353
|
-
*
|
|
1282
|
+
* roomId 或观众端 userId
|
|
1354
1283
|
*/
|
|
1355
|
-
|
|
1356
|
-
private _getReqHeaders;
|
|
1357
|
-
private _exchangeHandle;
|
|
1358
|
-
private _updateSubListHandle;
|
|
1284
|
+
_roomId: string,
|
|
1359
1285
|
/**
|
|
1360
|
-
*
|
|
1361
|
-
* @param newCDNUris 新的 cdn_uris 数据
|
|
1286
|
+
* 断线重连每一条 peerConnection
|
|
1362
1287
|
*/
|
|
1363
|
-
|
|
1288
|
+
_reTryExchange: Function,
|
|
1364
1289
|
/**
|
|
1365
|
-
*
|
|
1366
|
-
* _CDNUris 无 url 时,说明未开启 CDN 推送
|
|
1367
|
-
* @returns CDNPlayUrl
|
|
1290
|
+
* 当前用户 id
|
|
1368
1291
|
*/
|
|
1369
|
-
|
|
1292
|
+
_currentUserId: string,
|
|
1370
1293
|
/**
|
|
1371
|
-
*
|
|
1372
|
-
* @returns CDNPlayUrl
|
|
1294
|
+
* 北极星上报模块
|
|
1373
1295
|
*/
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
CDNPlayUrl?: string;
|
|
1377
|
-
}>;
|
|
1296
|
+
_polarisReport?: PolarisReporter | undefined);
|
|
1297
|
+
get useMutilPeerC(): boolean;
|
|
1378
1298
|
/**
|
|
1379
|
-
*
|
|
1380
|
-
* @param tracks
|
|
1299
|
+
* 根据 track 判断是否为上行
|
|
1381
1300
|
*/
|
|
1382
|
-
|
|
1383
|
-
code: RCRTCCode;
|
|
1384
|
-
failedList?: ISubscribeAttr[];
|
|
1385
|
-
}>;
|
|
1386
|
-
private __unsubscribe;
|
|
1301
|
+
private _isPub;
|
|
1387
1302
|
/**
|
|
1388
|
-
*
|
|
1389
|
-
* @param tracks
|
|
1303
|
+
* 按 tag 分 tracks
|
|
1390
1304
|
*/
|
|
1391
|
-
|
|
1392
|
-
code: RCRTCCode;
|
|
1393
|
-
failedList?: ISubscribeAttr[];
|
|
1394
|
-
}>;
|
|
1305
|
+
private _groupTracksByTag;
|
|
1395
1306
|
/**
|
|
1396
|
-
*
|
|
1307
|
+
* 按规则生成 pcName
|
|
1308
|
+
* 单 peerC roomId_pub
|
|
1309
|
+
* 多 peerC 上行: roomId_tag、下行: roomId_sub
|
|
1310
|
+
* 观众加房间: roomId_sub
|
|
1311
|
+
* 观众不加房间: userId_sub
|
|
1312
|
+
* @param isPub 是否为上行、下行
|
|
1313
|
+
* @param tag 多 peerC 时,上行需资源标识
|
|
1397
1314
|
*/
|
|
1398
|
-
|
|
1315
|
+
private _genPCName;
|
|
1399
1316
|
/**
|
|
1400
|
-
*
|
|
1401
|
-
* @param
|
|
1317
|
+
* 创建一个 peerC
|
|
1318
|
+
* @param pcName 使用的 peerConnection 名称
|
|
1319
|
+
* @param tracks 本次要操作的资源
|
|
1402
1320
|
*/
|
|
1403
|
-
|
|
1321
|
+
private _createOnePeerCItem;
|
|
1404
1322
|
/**
|
|
1405
|
-
*
|
|
1323
|
+
* 创建一组 peerC
|
|
1324
|
+
* @param pcName
|
|
1325
|
+
* @returns
|
|
1406
1326
|
*/
|
|
1407
|
-
|
|
1327
|
+
createPeerCList(tracks: TrackParam[]): IMutilPeerC[];
|
|
1408
1328
|
/**
|
|
1409
|
-
*
|
|
1410
|
-
* @param trackId
|
|
1329
|
+
* 移除所有 peerConnection 的上行资源
|
|
1411
1330
|
*/
|
|
1412
|
-
|
|
1331
|
+
private _removeAllLocalTrack;
|
|
1413
1332
|
/**
|
|
1414
|
-
*
|
|
1333
|
+
* 销毁某一个 peerConnection
|
|
1415
1334
|
*/
|
|
1416
|
-
|
|
1335
|
+
destroyPeerC(pcName: string): void;
|
|
1417
1336
|
/**
|
|
1418
|
-
*
|
|
1419
|
-
* @param tag 参数描述
|
|
1337
|
+
* 销毁所有 peerConnection
|
|
1420
1338
|
*/
|
|
1421
|
-
|
|
1339
|
+
private _destroyAllPeerC;
|
|
1422
1340
|
/**
|
|
1423
|
-
*
|
|
1424
|
-
* @param handler 业务端传入的音量上报事件
|
|
1425
|
-
* @param gap 上报时间间隔
|
|
1341
|
+
* 获取某一个 peerC
|
|
1426
1342
|
*/
|
|
1427
|
-
|
|
1428
|
-
|
|
1343
|
+
getPCItemByPCName(pcName: string): {
|
|
1344
|
+
/**
|
|
1345
|
+
* RCRTCPeerConnection 对象
|
|
1346
|
+
*/
|
|
1347
|
+
pc: RCRTCPeerConnection;
|
|
1348
|
+
/**
|
|
1349
|
+
* 存放 peerConnection 上本次要发布、取消发布、订阅、取消订阅的 track
|
|
1350
|
+
*/
|
|
1351
|
+
tracks: TrackParam[];
|
|
1352
|
+
/**
|
|
1353
|
+
* 当前 peerC 是否为发上行的 peerConnection
|
|
1354
|
+
*/
|
|
1355
|
+
isPub: boolean;
|
|
1356
|
+
/**
|
|
1357
|
+
* peerConnection 上行资源,暂不需要
|
|
1358
|
+
*/
|
|
1359
|
+
publishList?: IPublishedResource[] | undefined;
|
|
1360
|
+
/**
|
|
1361
|
+
* peerConnection 下行资源,暂不需要
|
|
1362
|
+
*/
|
|
1363
|
+
subscribeList?: ISubscribeAttr[] | undefined;
|
|
1364
|
+
};
|
|
1429
1365
|
/**
|
|
1430
|
-
*
|
|
1431
|
-
* @param listener
|
|
1366
|
+
* 根据 trackId 获取 peerConnection 对象
|
|
1432
1367
|
*/
|
|
1433
|
-
|
|
1368
|
+
getPCByTrackId(trackId: string, isPub?: boolean): RCRTCPeerConnection;
|
|
1434
1369
|
/**
|
|
1435
|
-
*
|
|
1370
|
+
* 获取所有的 peerConnection
|
|
1436
1371
|
*/
|
|
1437
|
-
|
|
1372
|
+
getPCList(): RCRTCPeerConnection[];
|
|
1438
1373
|
/**
|
|
1439
|
-
*
|
|
1374
|
+
* 获取存储的多 peerConnection 数据
|
|
1440
1375
|
*/
|
|
1441
|
-
|
|
1376
|
+
getMutilPeerCData(): {
|
|
1377
|
+
[key: string]: {
|
|
1378
|
+
/**
|
|
1379
|
+
* RCRTCPeerConnection 对象
|
|
1380
|
+
*/
|
|
1381
|
+
pc: RCRTCPeerConnection;
|
|
1382
|
+
/**
|
|
1383
|
+
* 存放 peerConnection 上本次要发布、取消发布、订阅、取消订阅的 track
|
|
1384
|
+
*/
|
|
1385
|
+
tracks: TrackParam[];
|
|
1386
|
+
/**
|
|
1387
|
+
* 当前 peerC 是否为发上行的 peerConnection
|
|
1388
|
+
*/
|
|
1389
|
+
isPub: boolean;
|
|
1390
|
+
/**
|
|
1391
|
+
* peerConnection 上行资源,暂不需要
|
|
1392
|
+
*/
|
|
1393
|
+
publishList?: IPublishedResource[] | undefined;
|
|
1394
|
+
/**
|
|
1395
|
+
* peerConnection 下行资源,暂不需要
|
|
1396
|
+
*/
|
|
1397
|
+
subscribeList?: ISubscribeAttr[] | undefined;
|
|
1398
|
+
};
|
|
1399
|
+
};
|
|
1400
|
+
setPeerCData(pcName: string, key: string, value: any): void;
|
|
1442
1401
|
/**
|
|
1443
|
-
*
|
|
1402
|
+
* 销毁资源
|
|
1444
1403
|
*/
|
|
1445
|
-
|
|
1404
|
+
clear(): void;
|
|
1405
|
+
}
|
|
1406
|
+
|
|
1407
|
+
declare abstract class ReadableStore {
|
|
1408
|
+
readonly context: RTCPluginContext;
|
|
1409
|
+
readonly service: RCMediaService;
|
|
1410
|
+
readonly peerMgr: RCRTCPeerCManager;
|
|
1411
|
+
readonly roomId: string;
|
|
1412
|
+
readonly crtUserId: string;
|
|
1413
|
+
readonly roomMode: RTCMode;
|
|
1414
|
+
readonly polarisReport: PolarisReporter;
|
|
1415
|
+
readonly isUpgrade?: boolean | undefined;
|
|
1416
|
+
readonly isMainRoom?: boolean | undefined;
|
|
1446
1417
|
/**
|
|
1447
|
-
*
|
|
1418
|
+
* 房间资源数据
|
|
1448
1419
|
*/
|
|
1449
|
-
|
|
1420
|
+
protected _roomResources: RoomData;
|
|
1450
1421
|
/**
|
|
1451
|
-
*
|
|
1452
|
-
* @param userId
|
|
1453
|
-
* @returns
|
|
1422
|
+
* 远端 track
|
|
1454
1423
|
*/
|
|
1455
|
-
|
|
1424
|
+
protected _remoteTracks: {
|
|
1425
|
+
[trackId: string]: RCRemoteTrack;
|
|
1426
|
+
};
|
|
1456
1427
|
/**
|
|
1457
|
-
*
|
|
1458
|
-
* @returns
|
|
1428
|
+
* 已订阅参数
|
|
1459
1429
|
*/
|
|
1460
|
-
|
|
1430
|
+
protected readonly _subscribedList: ISubscribeAttr[];
|
|
1461
1431
|
/**
|
|
1462
|
-
*
|
|
1432
|
+
* 与 MediaServer 交互需要的 token 信息
|
|
1463
1433
|
*/
|
|
1464
|
-
|
|
1434
|
+
protected _token: string;
|
|
1465
1435
|
/**
|
|
1466
|
-
*
|
|
1436
|
+
* 每次加入房间后都会改变
|
|
1467
1437
|
*/
|
|
1468
|
-
|
|
1438
|
+
protected _sessionId: string;
|
|
1469
1439
|
/**
|
|
1470
|
-
*
|
|
1440
|
+
* cdn_uris 信令扩散数据
|
|
1471
1441
|
*/
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1442
|
+
protected _CDNUris: ICDNUris | null;
|
|
1443
|
+
protected _CDNEnable: boolean;
|
|
1444
|
+
protected _destroyed: boolean;
|
|
1445
|
+
constructor(context: RTCPluginContext, service: RCMediaService, peerMgr: RCRTCPeerCManager, roomId: string, crtUserId: string, roomMode: RTCMode, polarisReport: PolarisReporter, isUpgrade?: boolean | undefined, isMainRoom?: boolean | undefined);
|
|
1446
|
+
get useMutilPeerC(): boolean;
|
|
1447
|
+
getResourcesByUserId(userId: string): IPublishedResource[] | undefined;
|
|
1448
|
+
getRemoteTrack(trackId: string): RCRemoteTrack | undefined;
|
|
1449
|
+
getRemoteTracksByUserId(userId: string): RCRemoteTrack[];
|
|
1450
|
+
getRemoteTracks(): {
|
|
1451
|
+
[trackId: string]: RCRemoteTrack;
|
|
1480
1452
|
};
|
|
1481
|
-
|
|
1453
|
+
getSessionId(): string;
|
|
1454
|
+
getAllUserIds(): string[];
|
|
1455
|
+
getRemoteUserIds(): string[];
|
|
1456
|
+
getSubscribedList(): ISubscribeAttr[];
|
|
1457
|
+
getPublishedResourceByTrackId(trackId: string): IPublishedResource | undefined;
|
|
1458
|
+
getToken(): string;
|
|
1459
|
+
getLocalTrack(trackId: string): RCLocalTrack | null;
|
|
1460
|
+
getLocalTracks(): RCLocalTrack[];
|
|
1461
|
+
getTrackState(trackId: string): 0 | 1;
|
|
1462
|
+
getCDNEnable(): boolean;
|
|
1463
|
+
getCDNUris(): ICDNUris | null;
|
|
1464
|
+
}
|
|
1465
|
+
declare class Store extends ReadableStore {
|
|
1466
|
+
private _initRemoteTracks;
|
|
1467
|
+
initWithRoomData(data: IJoinRTCRoomData): void;
|
|
1468
|
+
assignRoomData(data: RoomData): void;
|
|
1469
|
+
setResourcesByUserId(userId: string, arr: IPublishedResource[]): void;
|
|
1470
|
+
removeRemoteTrack(trackId: string): void;
|
|
1471
|
+
removeResourcesByUserId(userId: string): void;
|
|
1472
|
+
addRemoteTrack(track: RCRemoteTrack): void;
|
|
1473
|
+
removeRemoteTracks(): void;
|
|
1474
|
+
setCDNEnabel(bool: boolean): void;
|
|
1475
|
+
setCDNUris(uris: ICDNUris | null): void;
|
|
1482
1476
|
}
|
|
1483
1477
|
|
|
1478
|
+
declare enum CommandPriority {
|
|
1479
|
+
LOW = 0,
|
|
1480
|
+
NORMAL = 1,
|
|
1481
|
+
HIGH = 2
|
|
1482
|
+
}
|
|
1484
1483
|
/**
|
|
1485
|
-
*
|
|
1484
|
+
* 命令基类
|
|
1486
1485
|
*/
|
|
1487
|
-
declare
|
|
1486
|
+
declare abstract class BaseCommand<RES, STORE = Store> {
|
|
1488
1487
|
/**
|
|
1489
|
-
*
|
|
1488
|
+
* 执行指令
|
|
1489
|
+
* @param store
|
|
1490
1490
|
*/
|
|
1491
|
-
|
|
1491
|
+
abstract execute(store: STORE, invoker: BaseInvoker<STORE>): Promise<RES>;
|
|
1492
1492
|
/**
|
|
1493
|
-
*
|
|
1493
|
+
* 获取指令优先级,必要时可 override 此函数
|
|
1494
1494
|
*/
|
|
1495
|
-
|
|
1495
|
+
get priority(): CommandPriority;
|
|
1496
1496
|
}
|
|
1497
1497
|
|
|
1498
|
-
declare class
|
|
1499
|
-
private readonly _context;
|
|
1500
|
-
private readonly _runtime;
|
|
1501
|
-
private readonly _roomId;
|
|
1502
|
-
private readonly _crtRTCRoom;
|
|
1503
|
-
private readonly _userRole;
|
|
1504
|
-
constructor(_context: RTCPluginContext, _runtime: IRuntime, _roomId: string, _crtRTCRoom: RCAbstractRoom | RCAudienceLivingRoom, _userRole?: PolarisRole);
|
|
1505
|
-
private _send;
|
|
1506
|
-
private _getClientID;
|
|
1498
|
+
declare class BaseInvoker<STORE> {
|
|
1507
1499
|
/**
|
|
1508
|
-
*
|
|
1500
|
+
* 内存数据管理实例
|
|
1509
1501
|
*/
|
|
1510
|
-
|
|
1502
|
+
protected readonly _store: STORE;
|
|
1511
1503
|
/**
|
|
1512
|
-
*
|
|
1513
|
-
* @param resourceId userId_11_1_tiny 改为 userId_11_tiny_video
|
|
1504
|
+
* 命令终止时返回的错误码定义
|
|
1514
1505
|
*/
|
|
1515
|
-
private
|
|
1516
|
-
|
|
1506
|
+
private abortCode;
|
|
1507
|
+
constructor(
|
|
1517
1508
|
/**
|
|
1518
|
-
*
|
|
1509
|
+
* 内存数据管理实例
|
|
1519
1510
|
*/
|
|
1520
|
-
|
|
1511
|
+
_store: STORE,
|
|
1521
1512
|
/**
|
|
1522
|
-
*
|
|
1523
|
-
* RTC 订阅、取消订阅
|
|
1513
|
+
* 命令终止时返回的错误码定义
|
|
1524
1514
|
*/
|
|
1525
|
-
|
|
1515
|
+
abortCode: RCRTCCode);
|
|
1516
|
+
private _queue;
|
|
1517
|
+
private _busy;
|
|
1518
|
+
private _next;
|
|
1519
|
+
private _execute;
|
|
1520
|
+
push<R>(command: BaseCommand<R, STORE>): Promise<R>;
|
|
1521
|
+
private _isDestroyed;
|
|
1522
|
+
isDestroyed(): boolean;
|
|
1523
|
+
destroy(): void;
|
|
1526
1524
|
}
|
|
1527
|
-
|
|
1528
1525
|
/**
|
|
1529
|
-
*
|
|
1526
|
+
* 房间任务队列管理
|
|
1530
1527
|
*/
|
|
1531
|
-
declare class
|
|
1528
|
+
declare class Invoker extends BaseInvoker<Store> {
|
|
1529
|
+
constructor(context: RTCPluginContext, service: RCMediaService, peerMrg: RCRTCPeerCManager, roomId: string, crtUserId: string, mode: RTCMode, reporter: PolarisReporter, isUpgrade?: boolean, isMainRoom?: boolean);
|
|
1532
1530
|
/**
|
|
1533
|
-
*
|
|
1534
|
-
|
|
1535
|
-
|
|
1531
|
+
* 获取 store 存储实例,返回值类型 `ReadableStore`,避免非 command 定义中修改内存
|
|
1532
|
+
*/
|
|
1533
|
+
get store(): ReadableStore;
|
|
1534
|
+
destroy(): void;
|
|
1535
|
+
}
|
|
1536
|
+
|
|
1537
|
+
declare type ExchangeHooksRes = {
|
|
1538
|
+
headers: IRTCReqHeader;
|
|
1539
|
+
pushOtherRooms: IPushOtherRooms[];
|
|
1540
|
+
};
|
|
1541
|
+
declare type ExchangeHooks = (pcName: string) => ExchangeHooksRes;
|
|
1542
|
+
|
|
1543
|
+
declare type IOnRecvPKMsg = (msg: IReceivedMessage) => void;
|
|
1544
|
+
interface IRoomPKEventListener {
|
|
1536
1545
|
/**
|
|
1537
|
-
*
|
|
1546
|
+
* 收到连麦邀请
|
|
1538
1547
|
*/
|
|
1539
|
-
|
|
1548
|
+
onRequestJoinOtherRoom: (info: IPKInviteInfo) => {};
|
|
1540
1549
|
/**
|
|
1541
|
-
*
|
|
1550
|
+
* 收到取消连麦邀请
|
|
1542
1551
|
*/
|
|
1543
|
-
|
|
1544
|
-
static __INNER_EVENT_TRACK_READY__: string;
|
|
1545
|
-
private readonly _rtcPeerConn;
|
|
1546
|
-
private readonly _sdpStrategy;
|
|
1547
|
-
reportParser: IStatParser | null;
|
|
1548
|
-
private pubLocalTracks;
|
|
1549
|
-
private _reTryExchangeTimer;
|
|
1550
|
-
private _reportStatsTimer;
|
|
1551
|
-
private _reportR3R4ToPolarisTimer;
|
|
1552
|
-
constructor(
|
|
1552
|
+
onCancelRequestOtherRoom: (info: IPKInviteInfo) => {};
|
|
1553
1553
|
/**
|
|
1554
|
-
*
|
|
1555
|
-
|
|
1556
|
-
|
|
1554
|
+
* 收到连麦 PK 请求响应结果
|
|
1555
|
+
*/
|
|
1556
|
+
onResponseJoinOtherRoom: (info: IPKInviteAnswerInfo) => {};
|
|
1557
1557
|
/**
|
|
1558
|
-
*
|
|
1558
|
+
* 收到 PK 结束
|
|
1559
1559
|
*/
|
|
1560
|
-
|
|
1560
|
+
onFinishOtherRoom: (info: IPKEndInfo) => {};
|
|
1561
|
+
}
|
|
1562
|
+
declare class RCLivingPKHandler {
|
|
1563
|
+
private _invoker;
|
|
1564
|
+
private _PKInfo;
|
|
1565
|
+
private _hooks;
|
|
1566
|
+
private readonly _context;
|
|
1567
|
+
private readonly _runtime;
|
|
1568
|
+
private readonly _service;
|
|
1569
|
+
private readonly _initOptions;
|
|
1561
1570
|
/**
|
|
1562
|
-
*
|
|
1571
|
+
* 主直播房间
|
|
1563
1572
|
*/
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
private _onConnectionStateChange;
|
|
1567
|
-
private _onICEConnectionStateChange;
|
|
1568
|
-
private _onTrackReady;
|
|
1569
|
-
setBitrate(max: number, min: number, start?: number): Promise<void>;
|
|
1570
|
-
createOffer(iceRestart: boolean): Promise<IOfferInfo>;
|
|
1571
|
-
setRemoteAnswer(answer: string): Promise<RCRTCCode>;
|
|
1572
|
-
getLocalTrack(trackId: string): RCLocalTrack | null;
|
|
1573
|
-
addLocalTrack(track: RCLocalTrack): void;
|
|
1574
|
-
removeLocalTrackById(trackId: string): void;
|
|
1575
|
-
removeAllLocalTrack(): void;
|
|
1576
|
-
removeLocalTrack(track: RCLocalTrack): void;
|
|
1577
|
-
private _updateRecvTransceiverMap;
|
|
1578
|
-
updateSubRemoteTracks(remoteTracks: RCRemoteTrack[]): void;
|
|
1573
|
+
private readonly _mainLivingRoom;
|
|
1574
|
+
private readonly _registerPKMsgListener;
|
|
1579
1575
|
/**
|
|
1580
|
-
*
|
|
1576
|
+
* 加入 PK 房间回调
|
|
1577
|
+
*/
|
|
1578
|
+
private readonly _onJoinedPKRoom;
|
|
1579
|
+
protected readonly _clientSessionId?: string | undefined;
|
|
1580
|
+
/**
|
|
1581
|
+
* PK 邀请超时时间,默认 30s
|
|
1582
|
+
*/
|
|
1583
|
+
private readonly _inviteTimeout;
|
|
1584
|
+
private _appListener;
|
|
1585
|
+
private _mainRoomId;
|
|
1586
|
+
/**
|
|
1587
|
+
* 跨房间连麦加入的 PK 房间
|
|
1588
|
+
*/
|
|
1589
|
+
private _joinedPKRooms;
|
|
1590
|
+
constructor(_invoker: Invoker, _PKInfo: IPKInfo, _hooks: ExchangeHooks, _context: RTCPluginContext, _runtime: IRuntime, _service: RCMediaService, _initOptions: IRCRTCInitOptions,
|
|
1591
|
+
/**
|
|
1592
|
+
* 主直播房间
|
|
1593
|
+
*/
|
|
1594
|
+
_mainLivingRoom: RCLivingRoom, _registerPKMsgListener: (listener: IOnRecvPKMsg) => void,
|
|
1595
|
+
/**
|
|
1596
|
+
* 加入 PK 房间回调
|
|
1597
|
+
*/
|
|
1598
|
+
_onJoinedPKRoom: (roomId: string, room: RCLivingRoom) => void, _clientSessionId?: string | undefined);
|
|
1599
|
+
private _callAppListener;
|
|
1600
|
+
/**
|
|
1601
|
+
* 收到连麦邀请
|
|
1602
|
+
*/
|
|
1603
|
+
private _onInvite;
|
|
1604
|
+
/**
|
|
1605
|
+
* 收到取消连麦
|
|
1581
1606
|
*/
|
|
1582
|
-
|
|
1583
|
-
private
|
|
1584
|
-
private _onLocalTrackDestroied;
|
|
1585
|
-
private _reportListener;
|
|
1607
|
+
private _onCancelInvite;
|
|
1608
|
+
private _onInviteTimeout;
|
|
1586
1609
|
/**
|
|
1587
|
-
*
|
|
1588
|
-
* @param listener
|
|
1610
|
+
* 收到响应连麦
|
|
1589
1611
|
*/
|
|
1590
|
-
|
|
1591
|
-
private
|
|
1612
|
+
private _onInviteAnswer;
|
|
1613
|
+
private createLeaveOtherRoomCommand;
|
|
1592
1614
|
/**
|
|
1593
|
-
*
|
|
1594
|
-
* @returns 返回格式化后的数据
|
|
1615
|
+
* 收到连麦结束
|
|
1595
1616
|
*/
|
|
1596
|
-
private
|
|
1597
|
-
getAudioLevelReportData(): Promise<{
|
|
1598
|
-
trackId: string;
|
|
1599
|
-
audioLevel: number | null;
|
|
1600
|
-
}[] | undefined>;
|
|
1617
|
+
private _onPKEnd;
|
|
1601
1618
|
/**
|
|
1602
|
-
*
|
|
1603
|
-
* @todo
|
|
1619
|
+
* 处理跨房间连麦相关消息
|
|
1604
1620
|
*/
|
|
1605
|
-
private
|
|
1621
|
+
private _onRecvPKMsg;
|
|
1606
1622
|
/**
|
|
1607
|
-
*
|
|
1623
|
+
* 注册跨房间连麦监听事件
|
|
1608
1624
|
*/
|
|
1609
|
-
|
|
1625
|
+
registerRoomPKEventListener(listener: IRoomPKEventListener): void;
|
|
1610
1626
|
/**
|
|
1611
|
-
*
|
|
1627
|
+
* 发起跨房间连麦请求
|
|
1628
|
+
* @param inviteeRoomId 被邀请者所处的房间 roomId
|
|
1629
|
+
* @param inviteeUserId 被邀请者 userId
|
|
1630
|
+
* @param options.autoMix 是否要把邀请者发布的资源,合并到被邀请者房间内的 MCU 流中
|
|
1631
|
+
* @param options.extra 拓展字段,可随邀请连麦消息透传给被邀请者
|
|
1612
1632
|
*/
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
clearReTryExchangeTimer(): void;
|
|
1617
|
-
}
|
|
1618
|
-
|
|
1619
|
-
interface IRCTrackBitrate {
|
|
1633
|
+
requestJoinOtherRoom(inviteeRoomId: string, inviteeUserId: string, options?: IReqResPKOptions): Promise<{
|
|
1634
|
+
code: RCRTCCode | ErrorCode;
|
|
1635
|
+
}>;
|
|
1620
1636
|
/**
|
|
1621
|
-
*
|
|
1637
|
+
* 取消跨房间连麦请求
|
|
1638
|
+
* @param inviteeRoomId 被邀请者所处的房间 roomId
|
|
1639
|
+
* @param inviteeUserId 被邀请者 userId
|
|
1640
|
+
* @param extra 附加信息,可随取消邀请连麦消息透传给被邀请者
|
|
1622
1641
|
*/
|
|
1623
|
-
|
|
1642
|
+
cancelRequestJoinOtherRoom(inviteeRoomId: string, inviteeUserId: string, extra?: string): Promise<{
|
|
1643
|
+
code: RCRTCCode | ErrorCode;
|
|
1644
|
+
}>;
|
|
1624
1645
|
/**
|
|
1625
|
-
*
|
|
1646
|
+
* 响应跨房间连麦请求
|
|
1647
|
+
* @param inviterRoomId 邀请者所处的房间 roomId
|
|
1648
|
+
* @param inviterUserId 邀请者 userId
|
|
1649
|
+
* @param agree 是否同意连麦
|
|
1650
|
+
* @param options.autoMix 是否要把被邀请者发布的资源,合并到邀请者房间内的 MCU 流中
|
|
1651
|
+
* @param options.extra 附加信息,可随响应连麦消息透传给邀请者
|
|
1626
1652
|
*/
|
|
1627
|
-
|
|
1653
|
+
responseJoinOtherRoom(inviterRoomId: string, inviterUserId: string, agree: boolean, options?: IReqResPKOptions): Promise<{
|
|
1654
|
+
code: RCRTCCode | ErrorCode;
|
|
1655
|
+
}>;
|
|
1628
1656
|
/**
|
|
1629
|
-
*
|
|
1657
|
+
* 加入副直播房间
|
|
1658
|
+
* @roomId 副房间的 roomId
|
|
1630
1659
|
*/
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1660
|
+
joinOtherRoom(roomId: string): Promise<{
|
|
1661
|
+
code: RCRTCCode;
|
|
1662
|
+
room?: RCLivingRoom;
|
|
1663
|
+
userIds?: string[];
|
|
1664
|
+
tracks?: RCRemoteTrack[];
|
|
1665
|
+
CDNEnable?: boolean;
|
|
1666
|
+
}>;
|
|
1637
1667
|
/**
|
|
1638
|
-
*
|
|
1668
|
+
* 退出副房间
|
|
1669
|
+
* @param room 要退出的副房间的 room 实例
|
|
1670
|
+
* @param isQuitPK 是否要结束连麦
|
|
1639
1671
|
*/
|
|
1640
|
-
|
|
1672
|
+
leaveOtherRoom(room: RCLivingRoom, isQuitPK?: boolean): Promise<{
|
|
1673
|
+
code: RCRTCCode;
|
|
1674
|
+
}>;
|
|
1641
1675
|
/**
|
|
1642
|
-
*
|
|
1643
|
-
*
|
|
1676
|
+
* 获取连麦信息
|
|
1677
|
+
* @param roomId 连麦房间的 roomId
|
|
1644
1678
|
*/
|
|
1645
|
-
|
|
1679
|
+
getPKInfo(roomId: string): {
|
|
1680
|
+
inviteSessionId: string;
|
|
1681
|
+
inviterRoomId: string;
|
|
1682
|
+
inviterUserId: string;
|
|
1683
|
+
inviterUserAutoMix?: boolean | undefined;
|
|
1684
|
+
inviteeRoomId: string;
|
|
1685
|
+
inviteeUserAutoMix?: boolean | undefined;
|
|
1686
|
+
};
|
|
1646
1687
|
/**
|
|
1647
|
-
*
|
|
1648
|
-
* @example 举例如下:
|
|
1649
|
-
* `{"clusterId":"rtc-data-bdcbj.ronghub.com:80","serverId":"172.28.76.215:40080","resourceId":"13111111111_5vls_web_RongCloudRTC_1","connectionId":"AAYxMDAzNjgAFDEzMTExMTExMTExXzV2bHNfd2ViAAMzMzMA","ssrc":1716229921,"serviceProvider":"bdc","userTimestamp":1604994044706}`
|
|
1688
|
+
* 获取所有连麦信息
|
|
1650
1689
|
*/
|
|
1651
|
-
|
|
1690
|
+
getAllPKInfo(): IPKInfo;
|
|
1652
1691
|
/**
|
|
1653
|
-
*
|
|
1654
|
-
* @description 此参数存疑,MediaServer 似乎并未下发此字段,Web 端暂不启用
|
|
1655
|
-
* @deprecated
|
|
1692
|
+
* 获取已加入的副房间
|
|
1656
1693
|
*/
|
|
1657
|
-
|
|
1694
|
+
getJoinedPKRooms(): {
|
|
1695
|
+
[roomId: string]: RCLivingRoom;
|
|
1696
|
+
};
|
|
1658
1697
|
}
|
|
1698
|
+
|
|
1699
|
+
declare type ResourceMsgContent = {
|
|
1700
|
+
/**
|
|
1701
|
+
* 旧版本兼容参数,当收到非 `RTCMessageName.TOTAL_CONTENT_RESOURCE` 时:
|
|
1702
|
+
* * ignore 值为 `true` 表示该消息由 signal server 向旧版本 RTCLib 提供的兼容消息,无需处理
|
|
1703
|
+
* * 否则认为该消息是由旧版本 RTCLib 主动发出的增量变更消息,需要处理
|
|
1704
|
+
*/
|
|
1705
|
+
ignore?: boolean;
|
|
1706
|
+
/**
|
|
1707
|
+
* 发布到房间内的资源列表,`RTCMessageName.TOTAL_CONTENT_RESOURCE` 消息携带全量数据,否则为增量数据
|
|
1708
|
+
*/
|
|
1709
|
+
uris: IPublishedResource[];
|
|
1710
|
+
cdn_uris?: ICDNUris[];
|
|
1711
|
+
};
|
|
1712
|
+
|
|
1659
1713
|
/**
|
|
1660
|
-
*
|
|
1714
|
+
* 房间抽象基类
|
|
1661
1715
|
*/
|
|
1662
|
-
|
|
1716
|
+
declare abstract class RCAbstractRoom extends EventEmitter {
|
|
1717
|
+
protected readonly _context: RTCPluginContext;
|
|
1718
|
+
protected readonly _runtime: IRuntime;
|
|
1719
|
+
readonly _roomId: string;
|
|
1720
|
+
protected readonly _service: RCMediaService;
|
|
1721
|
+
protected readonly _initOptions: IRCRTCInitOptions;
|
|
1663
1722
|
/**
|
|
1664
|
-
*
|
|
1723
|
+
* 是否使用多 peerConnection
|
|
1665
1724
|
*/
|
|
1666
|
-
|
|
1725
|
+
protected readonly _useMutilPeerC?: boolean | undefined;
|
|
1726
|
+
protected readonly _clientSessionId: string;
|
|
1667
1727
|
/**
|
|
1668
|
-
*
|
|
1728
|
+
* 房间保活 rtcPing
|
|
1669
1729
|
*/
|
|
1670
|
-
|
|
1671
|
-
}
|
|
1672
|
-
interface ISubscribeAttr {
|
|
1730
|
+
private _pinger;
|
|
1673
1731
|
/**
|
|
1674
|
-
*
|
|
1732
|
+
* 北极星上报实例
|
|
1675
1733
|
*/
|
|
1676
|
-
|
|
1734
|
+
protected _polarisReport: PolarisReporter | null;
|
|
1677
1735
|
/**
|
|
1678
|
-
*
|
|
1736
|
+
* 音量上报实例
|
|
1679
1737
|
*/
|
|
1680
|
-
|
|
1681
|
-
}
|
|
1682
|
-
/**
|
|
1683
|
-
* 视频配置
|
|
1684
|
-
*/
|
|
1685
|
-
interface IVideoProfile {
|
|
1738
|
+
private _audioLevelReport;
|
|
1686
1739
|
/**
|
|
1687
|
-
*
|
|
1740
|
+
* peerConnection 管理类
|
|
1688
1741
|
*/
|
|
1689
|
-
|
|
1742
|
+
protected _peerCManager: RCRTCPeerCManager | null;
|
|
1743
|
+
protected readonly _invoker: Invoker;
|
|
1744
|
+
protected readonly _store: ReadableStore;
|
|
1745
|
+
constructor(_context: RTCPluginContext, _runtime: IRuntime, _roomId: string, _roomMode: RTCMode, _service: RCMediaService, _initOptions: IRCRTCInitOptions, isUpgrade?: boolean, isMainRoom?: boolean,
|
|
1690
1746
|
/**
|
|
1691
|
-
*
|
|
1747
|
+
* 是否使用多 peerConnection
|
|
1692
1748
|
*/
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
|
|
1749
|
+
_useMutilPeerC?: boolean | undefined, _clientSessionId?: string);
|
|
1750
|
+
__innerInit(mode: RTCMode, joinType?: RTCJoinType, livingType?: RCLivingType, innerUserDatas?: IRTCUserData, outerUserDatas?: IRTCUserData): Promise<{
|
|
1751
|
+
code: RCRTCCode | ErrorCode;
|
|
1752
|
+
data?: IJoinRTCRoomData;
|
|
1753
|
+
}>;
|
|
1754
|
+
protected _initWithRoomData(offlineKickTime: number): void;
|
|
1755
|
+
private _handlePingResult;
|
|
1699
1756
|
/**
|
|
1700
|
-
*
|
|
1701
|
-
* @
|
|
1757
|
+
* 设置房间上行资源的总码率配置
|
|
1758
|
+
* @deprecated use RCLocalTrack.setBitrate instead of setBitrate
|
|
1759
|
+
* @description
|
|
1760
|
+
* * 自 v5.1.0 版本开始,推荐使用 `RCLocalTrack.setBitrate` 对不同流分别指定码率。
|
|
1761
|
+
* * 该方法仅在 SDP `plan-b` 协议下(Chrome 92 与 Safari 11 之前的版本)有效。
|
|
1762
|
+
* @param max 音视频发送码率上限,不可小于 200 且不可小于 `min`
|
|
1763
|
+
* @param min 音视频发送码率下限,默认值为 1,且不可小于 1,不可大于 `max`
|
|
1764
|
+
* @param start 起始码率,默认为码率上限的 70%
|
|
1702
1765
|
*/
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
interface IPublishAttrs {
|
|
1766
|
+
setBitrate(max: number, min: number, start?: number): void;
|
|
1767
|
+
private _onTrackReady;
|
|
1768
|
+
protected _callAppListener(eventType: keyof IRoomEventListener, ...attrs: any[]): void;
|
|
1769
|
+
private _onTrackUnpublish;
|
|
1770
|
+
__parseInnerMessage(message: IReceivedMessage): boolean;
|
|
1709
1771
|
/**
|
|
1710
|
-
*
|
|
1772
|
+
* 被踢出房间通知
|
|
1773
|
+
* @param byServer
|
|
1774
|
+
* * 当值为 false 时,说明本端 rtcPing 超时
|
|
1775
|
+
* * 当值为 true 时,说明本端收到被踢出房间通知
|
|
1711
1776
|
*/
|
|
1712
|
-
|
|
1777
|
+
private _kickoff;
|
|
1778
|
+
private _rtcpeerClosed;
|
|
1713
1779
|
/**
|
|
1714
|
-
*
|
|
1780
|
+
* 处理资源变更事件
|
|
1781
|
+
* @param content
|
|
1782
|
+
* @param messageType 消息类型
|
|
1783
|
+
* @param userId 消息发送者
|
|
1715
1784
|
*/
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
/**
|
|
1719
|
-
* peerConnection 抛出给用户的 track 字段
|
|
1720
|
-
*/
|
|
1721
|
-
interface IRCTrackStat {
|
|
1785
|
+
protected _resourceHandle(content: ResourceMsgContent, messageType: RCRTCMessageType.PUBLISH | RCRTCMessageType.UNPUBLISH | RCRTCMessageType.MODIFY | RCRTCMessageType.TOTAL_CONTENT_RESOURCE, userId: string): Promise<void>;
|
|
1786
|
+
private _onTrackPublish;
|
|
1722
1787
|
/**
|
|
1723
|
-
*
|
|
1724
|
-
|
|
1725
|
-
|
|
1788
|
+
* 处理 `RCRTCMessageType.STATE` 消息
|
|
1789
|
+
* @param content
|
|
1790
|
+
*/
|
|
1791
|
+
private _stateHandle;
|
|
1726
1792
|
/**
|
|
1727
|
-
*
|
|
1793
|
+
* 获取房间 Id
|
|
1728
1794
|
*/
|
|
1729
|
-
|
|
1795
|
+
getRoomId(): string;
|
|
1730
1796
|
/**
|
|
1731
|
-
*
|
|
1797
|
+
* 获取当前 userId
|
|
1732
1798
|
*/
|
|
1733
|
-
|
|
1799
|
+
getCrtUserId(): string;
|
|
1734
1800
|
/**
|
|
1735
|
-
*
|
|
1801
|
+
* 获取 _pc 实例
|
|
1736
1802
|
*/
|
|
1737
|
-
|
|
1803
|
+
__getPC(): RCRTCPeerConnection[];
|
|
1738
1804
|
/**
|
|
1739
|
-
*
|
|
1805
|
+
* 获取远程用户列表,不包含当前用户
|
|
1740
1806
|
*/
|
|
1741
|
-
|
|
1807
|
+
getRemoteUserIds(): string[];
|
|
1742
1808
|
/**
|
|
1743
|
-
*
|
|
1809
|
+
* 获取所有房间已发布的远端资源列表
|
|
1810
|
+
* @returns
|
|
1744
1811
|
*/
|
|
1745
|
-
|
|
1812
|
+
getRemoteTracks(): RCRemoteTrack[];
|
|
1746
1813
|
/**
|
|
1747
|
-
*
|
|
1814
|
+
* 获取远端用户的资源列表
|
|
1815
|
+
* @param userId
|
|
1816
|
+
* @returns
|
|
1748
1817
|
*/
|
|
1749
|
-
|
|
1818
|
+
getRemoteTracksByUserId(userId: string): RCRemoteTrack[];
|
|
1750
1819
|
/**
|
|
1751
|
-
*
|
|
1820
|
+
* 获取房间当前会话 Id,当房间内已无成员时房间会回收,重新加入时 sessionId 将更新
|
|
1752
1821
|
*/
|
|
1753
|
-
|
|
1822
|
+
getSessionId(): string;
|
|
1754
1823
|
/**
|
|
1755
|
-
*
|
|
1824
|
+
* 向房间内发消息
|
|
1825
|
+
* @param name 消息名称
|
|
1826
|
+
* @param content 消息内容
|
|
1827
|
+
*/
|
|
1828
|
+
sendMessage(name: string, content: any): Promise<{
|
|
1829
|
+
code: RCRTCCode;
|
|
1830
|
+
}>;
|
|
1831
|
+
/**
|
|
1832
|
+
* 设置房间属性
|
|
1833
|
+
* @param key 属性名
|
|
1834
|
+
* @param value 属性值
|
|
1835
|
+
* @param message 是否在设置属性的时候携带消息内容,传空则不往房间中发送消息
|
|
1836
|
+
* @param isInner RTC 业务内部使用参数,用户忽略
|
|
1756
1837
|
*/
|
|
1757
|
-
|
|
1838
|
+
setRoomAttribute(key: string, value: string, message?: {
|
|
1839
|
+
name: string;
|
|
1840
|
+
content: string;
|
|
1841
|
+
}, isInner?: boolean): Promise<{
|
|
1842
|
+
code: RCRTCCode;
|
|
1843
|
+
}>;
|
|
1758
1844
|
/**
|
|
1759
|
-
*
|
|
1845
|
+
* 删除房间属性
|
|
1846
|
+
* @param keys 待删除的属性名数组
|
|
1847
|
+
* @param message 是否在删除属性的时候携带消息内容,传空则不往房间中发送消息
|
|
1848
|
+
* @param isInner RTC 业务内部使用参数,用户忽略
|
|
1760
1849
|
*/
|
|
1761
|
-
|
|
1850
|
+
deleteRoomAttributes(keys: string[], message?: {
|
|
1851
|
+
name: string;
|
|
1852
|
+
content: string;
|
|
1853
|
+
}, isInner?: boolean): Promise<{
|
|
1854
|
+
code: RCRTCCode;
|
|
1855
|
+
}>;
|
|
1762
1856
|
/**
|
|
1763
|
-
*
|
|
1764
|
-
* @
|
|
1857
|
+
* 获取房间属性
|
|
1858
|
+
* @param keys 要查询的属性名数组,当数组长度为空时,取所有已设置的 kv 值
|
|
1859
|
+
* @param isInner RTC 业务内部使用参数,用户忽略
|
|
1765
1860
|
*/
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
*/
|
|
1771
|
-
interface IRCCandidatePairStat {
|
|
1861
|
+
getRoomAttributes(keys?: string[], isInner?: boolean): Promise<{
|
|
1862
|
+
code: RCRTCCode;
|
|
1863
|
+
data?: KVString;
|
|
1864
|
+
}>;
|
|
1772
1865
|
/**
|
|
1773
|
-
*
|
|
1866
|
+
* 设置当前用户属性(暂不开放)
|
|
1867
|
+
* @param key 属性名
|
|
1868
|
+
* @param value 属性值
|
|
1869
|
+
* @param message 是否在设置属性的时候携带消息内容,传空则不往房间中发送消息
|
|
1774
1870
|
*/
|
|
1775
|
-
|
|
1871
|
+
private _setUserAttributeValue;
|
|
1776
1872
|
/**
|
|
1777
|
-
*
|
|
1873
|
+
* 删除当前用户属性(暂不开放)
|
|
1874
|
+
* @param keys 待删除的属性名数组
|
|
1875
|
+
* @param message 是否在删除属性的时候携带消息内容,传空则不往房间中发送消息
|
|
1778
1876
|
*/
|
|
1779
|
-
|
|
1877
|
+
private _deleteUserAttributes;
|
|
1780
1878
|
/**
|
|
1781
|
-
*
|
|
1879
|
+
* 获取当前用户属性(暂不开放)
|
|
1880
|
+
* @param keys 要查询的属性名数组
|
|
1782
1881
|
*/
|
|
1783
|
-
|
|
1882
|
+
private _getUserAttributes;
|
|
1784
1883
|
/**
|
|
1785
|
-
*
|
|
1884
|
+
* 查询房间是否已销毁
|
|
1786
1885
|
*/
|
|
1787
|
-
|
|
1886
|
+
isDestroyed(): boolean;
|
|
1788
1887
|
/**
|
|
1789
|
-
*
|
|
1888
|
+
* 退出并销毁当前房间实例,退出后该房间的所有方法将不可用
|
|
1790
1889
|
*/
|
|
1791
|
-
|
|
1890
|
+
__destroy(quitRoom: boolean): Promise<void>;
|
|
1792
1891
|
/**
|
|
1793
|
-
*
|
|
1892
|
+
* 退出房间之前禁用所有远端资源,避免退出动作耗时过长,
|
|
1893
|
+
* 导致在未完全退出的过程中仍能听到房间内的声音问题
|
|
1794
1894
|
*/
|
|
1795
|
-
|
|
1895
|
+
private _muteRemoteTracksBeforeQuit;
|
|
1896
|
+
private _leaveHandle;
|
|
1796
1897
|
/**
|
|
1797
|
-
*
|
|
1898
|
+
* 释放 PCManager 上的资源
|
|
1798
1899
|
*/
|
|
1799
|
-
|
|
1900
|
+
private _releasePCManager;
|
|
1901
|
+
private _onLocalTrackDestroied;
|
|
1800
1902
|
/**
|
|
1801
|
-
*
|
|
1903
|
+
* 本端流状态修改,需通知房间内其他成员
|
|
1904
|
+
* @param localTrack
|
|
1802
1905
|
*/
|
|
1803
|
-
|
|
1906
|
+
private _onLocalTrackMuted;
|
|
1804
1907
|
/**
|
|
1805
|
-
*
|
|
1908
|
+
* 增量发布资源,若发布的资源 tag 及媒体类型重复,后者将覆盖前者进行发布。
|
|
1909
|
+
* @param tracks 待发布的 RCLocalTrack 实例
|
|
1910
|
+
* @returns
|
|
1806
1911
|
*/
|
|
1807
|
-
|
|
1912
|
+
publish(tracks: (RCLocalTrack | IPublishAttrs)[]): Promise<IPubSuccessRes>;
|
|
1808
1913
|
/**
|
|
1809
|
-
*
|
|
1914
|
+
* 获取跨房间连麦需携带参数 pushOtherRooms 的值
|
|
1810
1915
|
*/
|
|
1811
|
-
|
|
1916
|
+
protected _getPushOtherRoomsParams(): IPushOtherRooms[];
|
|
1812
1917
|
/**
|
|
1813
|
-
*
|
|
1918
|
+
* ice 断线后,尝试重新走 exchange
|
|
1814
1919
|
*/
|
|
1815
|
-
|
|
1816
|
-
|
|
1817
|
-
/**
|
|
1818
|
-
* iceCandidatePair 所有字段
|
|
1819
|
-
* 含 peerConnection 抛出给用户的 iceCandidatePair 字段
|
|
1820
|
-
* 含 北极星上报 R3、R4 所需的 totalPacketsLost
|
|
1821
|
-
*/
|
|
1822
|
-
interface IInnerIcePair extends IRCCandidatePairStat {
|
|
1920
|
+
protected _reTryExchange(pcName: string, isPub: boolean): Promise<void>;
|
|
1921
|
+
protected _getRTCReqestHeaders(pcName: string): IRTCReqHeader;
|
|
1823
1922
|
/**
|
|
1824
|
-
*
|
|
1923
|
+
* 增量取消资源发布,若相应资源中存在小流资源,则同时取消发布
|
|
1924
|
+
* @param tracks 取消发布的 RCLocalTrack 列表
|
|
1825
1925
|
*/
|
|
1826
|
-
|
|
1827
|
-
}
|
|
1828
|
-
/**
|
|
1829
|
-
* send track 所有字段
|
|
1830
|
-
* 含 peerConnection 抛出给用户的 track 字段
|
|
1831
|
-
* 含 北极星上报 R3 track 所需字段
|
|
1832
|
-
*/
|
|
1833
|
-
interface ISendTrackState extends IRCTrackStat {
|
|
1926
|
+
unpublish(tracks: RCLocalTrack[]): Promise<IPubSuccessRes>;
|
|
1834
1927
|
/**
|
|
1835
|
-
*
|
|
1928
|
+
* 根据资源 Id 获取资源数据
|
|
1929
|
+
* @param trackId
|
|
1836
1930
|
*/
|
|
1837
|
-
|
|
1931
|
+
private _getResourceById;
|
|
1838
1932
|
/**
|
|
1839
|
-
*
|
|
1933
|
+
* resourceId 有效性验证
|
|
1934
|
+
* @param resourceId
|
|
1840
1935
|
*/
|
|
1841
|
-
|
|
1936
|
+
protected _isValidResourceId(resourceId: string): boolean;
|
|
1937
|
+
private _subhook;
|
|
1938
|
+
private _pubhook;
|
|
1842
1939
|
/**
|
|
1843
|
-
*
|
|
1940
|
+
* 订阅资源
|
|
1941
|
+
* @param tracks
|
|
1844
1942
|
*/
|
|
1845
|
-
|
|
1943
|
+
subscribe(tracks: (RCRemoteTrack | ISubscribeAttr)[]): Promise<{
|
|
1944
|
+
code: RCRTCCode;
|
|
1945
|
+
failedList?: ISubscribeAttr[];
|
|
1946
|
+
}>;
|
|
1846
1947
|
/**
|
|
1847
|
-
*
|
|
1948
|
+
* 取消订阅资源
|
|
1949
|
+
* @param tracks 预取消远端资源
|
|
1848
1950
|
*/
|
|
1849
|
-
|
|
1951
|
+
unsubscribe(tracks: RCRemoteTrack[]): Promise<{
|
|
1952
|
+
code: RCRTCCode;
|
|
1953
|
+
failedList?: ISubscribeAttr[];
|
|
1954
|
+
}>;
|
|
1850
1955
|
/**
|
|
1851
|
-
*
|
|
1956
|
+
* 获取已发布的本地资源
|
|
1957
|
+
* @param trackId
|
|
1958
|
+
* @returns
|
|
1852
1959
|
*/
|
|
1853
|
-
|
|
1960
|
+
getLocalTrack(trackId: string): RCLocalTrack | null;
|
|
1854
1961
|
/**
|
|
1855
|
-
*
|
|
1962
|
+
* 获取所有已发布的资源
|
|
1856
1963
|
*/
|
|
1857
|
-
|
|
1964
|
+
getLocalTracks(): RCLocalTrack[];
|
|
1858
1965
|
/**
|
|
1859
|
-
*
|
|
1966
|
+
* 根据 trackId 获取房间内的远端资源
|
|
1967
|
+
* @param trackId
|
|
1968
|
+
* @returns
|
|
1860
1969
|
*/
|
|
1861
|
-
|
|
1970
|
+
getRemoteTrack(trackId: string): RCRemoteTrack | null;
|
|
1862
1971
|
/**
|
|
1863
|
-
*
|
|
1972
|
+
* 强制修改订阅列表,仅订阅数组中的资源,取消订阅其他已订阅资源。
|
|
1973
|
+
* 当参数为 `[]` 时,意味着不再订阅任何资源
|
|
1974
|
+
* @param tracks 变更的资源列表
|
|
1864
1975
|
*/
|
|
1865
|
-
|
|
1866
|
-
|
|
1867
|
-
|
|
1868
|
-
|
|
1869
|
-
|
|
1870
|
-
* 含 北极星上报 R4 track 所需字段
|
|
1871
|
-
*/
|
|
1872
|
-
interface IRecvTrackState extends IRCTrackStat {
|
|
1976
|
+
updateSubList(tracks: (RCRemoteTrack | ISubscribeAttr)[]): Promise<{
|
|
1977
|
+
code: RCRTCCode;
|
|
1978
|
+
failedList?: ISubscribeAttr[];
|
|
1979
|
+
}>;
|
|
1980
|
+
private _appListener;
|
|
1873
1981
|
/**
|
|
1874
|
-
*
|
|
1982
|
+
* 注册事件监听器,多次注册会导致后者覆盖前者,可以通过使用 `registerRoomEventListener(null)` 取消注册
|
|
1983
|
+
* @param listener
|
|
1875
1984
|
*/
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
nackCount: number;
|
|
1879
|
-
pliCount: number;
|
|
1880
|
-
rtt: number | null;
|
|
1881
|
-
googFirsReceived: number;
|
|
1882
|
-
googRenderDelayMs: number;
|
|
1883
|
-
trackState: TrackState;
|
|
1884
|
-
}
|
|
1885
|
-
/**
|
|
1886
|
-
* peerConnection stats 解析出来业务所需的所有字段
|
|
1887
|
-
*/
|
|
1888
|
-
interface IInnerRCRTCStateReport {
|
|
1889
|
-
timestamp: number;
|
|
1890
|
-
iceCandidatePair?: IInnerIcePair;
|
|
1891
|
-
senders: ISendTrackState[];
|
|
1892
|
-
receivers: IRecvTrackState[];
|
|
1893
|
-
}
|
|
1894
|
-
/**
|
|
1895
|
-
* /**
|
|
1896
|
-
* peerConnection stats 抛给用户的字段
|
|
1897
|
-
*/
|
|
1898
|
-
interface IRCRTCStateReport {
|
|
1899
|
-
pcName?: string;
|
|
1985
|
+
registerRoomEventListener(listener: IRoomEventListener | null): void;
|
|
1986
|
+
private _reportListener;
|
|
1900
1987
|
/**
|
|
1901
|
-
*
|
|
1988
|
+
* 注册房间数据监控
|
|
1989
|
+
* @param listener
|
|
1990
|
+
* @description 该方法暂仅支持 Chrome 浏览器
|
|
1902
1991
|
*/
|
|
1903
|
-
|
|
1992
|
+
registerReportListener(listener: IRCRTCReportListener | null): void;
|
|
1904
1993
|
/**
|
|
1905
|
-
*
|
|
1994
|
+
* 音量上报
|
|
1995
|
+
* @param handler 业务端传入的音量上报事件
|
|
1996
|
+
* @param gap 上报时间间隔
|
|
1906
1997
|
*/
|
|
1907
|
-
|
|
1998
|
+
onAudioLevelChange(handler: IAudioLevelChangeHandler | null, gap?: number): void;
|
|
1908
1999
|
/**
|
|
1909
|
-
*
|
|
2000
|
+
* 断线重连后尝试补发断线过程中的通知信息
|
|
1910
2001
|
*/
|
|
1911
|
-
|
|
2002
|
+
__onReconnected(livingType?: RCLivingType): Promise<{
|
|
2003
|
+
data: IJoinRTCRoomData | undefined;
|
|
2004
|
+
} | void>;
|
|
2005
|
+
private _onAudioMuteChange;
|
|
2006
|
+
private _onVideoMuteChange;
|
|
1912
2007
|
/**
|
|
1913
|
-
*
|
|
2008
|
+
* 存储连麦监听事件
|
|
1914
2009
|
*/
|
|
1915
|
-
|
|
1916
|
-
}
|
|
1917
|
-
interface IRCRTCReportListener {
|
|
2010
|
+
private _onRecvPKMsg;
|
|
1918
2011
|
/**
|
|
1919
|
-
*
|
|
1920
|
-
* @param report
|
|
2012
|
+
* 注册 PK 业务监听方法
|
|
1921
2013
|
*/
|
|
1922
|
-
|
|
2014
|
+
protected _registerPKMsgListener(listener: IOnRecvPKMsg | null): void;
|
|
1923
2015
|
/**
|
|
1924
|
-
*
|
|
1925
|
-
* @since version 5.1.5
|
|
2016
|
+
* 退出 PK 房间
|
|
1926
2017
|
*/
|
|
1927
|
-
|
|
2018
|
+
protected _quitAllPKRoom(): void;
|
|
2019
|
+
getClientSessionId(): string;
|
|
2020
|
+
}
|
|
2021
|
+
|
|
2022
|
+
declare class RCLocalMediaStream {
|
|
2023
|
+
readonly msid: string;
|
|
2024
|
+
readonly mediaStream: MediaStream;
|
|
2025
|
+
readonly tinyStream: MediaStream;
|
|
2026
|
+
readonly tag: string;
|
|
2027
|
+
constructor(msid: string);
|
|
2028
|
+
}
|
|
2029
|
+
|
|
2030
|
+
interface IAudienceRoomEventListener extends IRCRTCTrackEventListener {
|
|
1928
2031
|
/**
|
|
1929
|
-
*
|
|
2032
|
+
* 主播加入
|
|
2033
|
+
* @param userIds 加入主播的 id 列表
|
|
1930
2034
|
*/
|
|
1931
|
-
|
|
1932
|
-
}
|
|
1933
|
-
interface IRCRTCTrackEventListener {
|
|
2035
|
+
onAnchorJoin?(userId: string[]): void;
|
|
1934
2036
|
/**
|
|
1935
|
-
*
|
|
1936
|
-
* @param
|
|
2037
|
+
* 主播退出
|
|
2038
|
+
* @param userIds 退出主播的 id 列表
|
|
1937
2039
|
*/
|
|
1938
|
-
|
|
1939
|
-
}
|
|
1940
|
-
interface IRoomEventListener extends IRCRTCTrackEventListener {
|
|
2040
|
+
onAnchorLeave?(userId: string[]): void;
|
|
1941
2041
|
/**
|
|
1942
|
-
*
|
|
1943
|
-
*
|
|
1944
|
-
* @
|
|
2042
|
+
* 房间内合流发布资源
|
|
2043
|
+
* @param tracks 新发布的合流音轨与视轨数据列表,包含新发布的 RCRemoteAudioTrack 与 RCRemoteVideoTrack 实例
|
|
2044
|
+
* @description
|
|
2045
|
+
* 当房间内某个主播第一次发布资源时触发
|
|
1945
2046
|
*/
|
|
1946
|
-
|
|
2047
|
+
onTrackPublish?(tracks: RCRemoteTrack[]): void;
|
|
1947
2048
|
/**
|
|
1948
|
-
*
|
|
1949
|
-
* @
|
|
1950
|
-
*
|
|
1951
|
-
*
|
|
2049
|
+
* 房间内取消合流发布资源
|
|
2050
|
+
* @param tracks 被取消发布的合流音轨与视轨数据列表
|
|
2051
|
+
* @description
|
|
2052
|
+
* 当房间内全部主播退出房间时,SDK 内部会取消对资源的订阅,业务层仅需处理 UI 业务
|
|
1952
2053
|
*/
|
|
1953
|
-
|
|
2054
|
+
onTrackUnpublish?(tracks: RCRemoteTrack[]): void;
|
|
1954
2055
|
/**
|
|
1955
|
-
*
|
|
1956
|
-
* @param
|
|
1957
|
-
* @param content 信令内容
|
|
1958
|
-
* @param senderUserId 发送者 Id
|
|
1959
|
-
* @param messageUId 消息唯一标识
|
|
2056
|
+
* 房间内主播发布资源
|
|
2057
|
+
* @param tracks 主播新发布的音轨与视轨数据列表,包含新发布的 RCRemoteAudioTrack 与 RCRemoteVideoTrack 实例
|
|
1960
2058
|
*/
|
|
1961
|
-
|
|
2059
|
+
onAnchorTrackPublish?(tracks: RCRemoteTrack[]): void;
|
|
1962
2060
|
/**
|
|
1963
|
-
*
|
|
1964
|
-
* @param
|
|
1965
|
-
* @
|
|
2061
|
+
* 房间内主播取消发布资源
|
|
2062
|
+
* @param tracks 被主播取消发布的音轨与视轨数据列表
|
|
2063
|
+
* @description 当资源被取消发布时,SDK 内部会取消对相关资源的订阅,业务层仅需处理 UI 业务
|
|
1966
2064
|
*/
|
|
1967
|
-
|
|
2065
|
+
onAnchorTrackUnpublish?(tracks: RCRemoteTrack[]): void;
|
|
1968
2066
|
/**
|
|
1969
|
-
*
|
|
2067
|
+
* 房间主播禁用/启用音频
|
|
1970
2068
|
* @param audioTrack RCRemoteAudioTrack 类实例
|
|
1971
2069
|
*/
|
|
1972
2070
|
onAudioMuteChange?(audioTrack: RCRemoteAudioTrack): void;
|
|
1973
2071
|
/**
|
|
1974
|
-
|
|
1975
|
-
|
|
1976
|
-
|
|
2072
|
+
* 房间主播禁用/启用视频
|
|
2073
|
+
* @param videoTrack RCRemoteVideoTrack 类实例对象
|
|
2074
|
+
*/
|
|
1977
2075
|
onVideoMuteChange?(videoTrack: RCRemoteVideoTrack): void;
|
|
1978
2076
|
/**
|
|
1979
|
-
*
|
|
1980
|
-
* @param tracks 新发布的音轨与视轨数据列表,包含新发布的 RCRemoteAudioTrack 与 RCRemoteVideoTrack 实例
|
|
2077
|
+
* 房间内主播把发布的资源推至 CDN
|
|
1981
2078
|
*/
|
|
1982
|
-
|
|
2079
|
+
onCDNInfoEnable?(CDNInfo: {
|
|
2080
|
+
resolution: RCResolution;
|
|
2081
|
+
fps: RCFrameRate;
|
|
2082
|
+
}): void;
|
|
1983
2083
|
/**
|
|
1984
|
-
*
|
|
1985
|
-
* @param tracks 被取消发布的音轨与视轨数据列表
|
|
1986
|
-
* @description 当资源被取消发布时,SDK 内部会取消对相关资源的订阅,业务层仅需处理 UI 业务
|
|
2084
|
+
* 主播停止推 CDN
|
|
1987
2085
|
*/
|
|
1988
|
-
|
|
2086
|
+
onCDNInfoDisable?(): void;
|
|
1989
2087
|
/**
|
|
1990
|
-
*
|
|
1991
|
-
* @param userIds 加入的人员 id 列表
|
|
2088
|
+
* 主播改变推 CDN 的分辨率或帧率
|
|
1992
2089
|
*/
|
|
1993
|
-
|
|
2090
|
+
onCDNInfoChange?(CDNInfo: {
|
|
2091
|
+
resolution: RCResolution;
|
|
2092
|
+
fps: RCFrameRate;
|
|
2093
|
+
}): void;
|
|
2094
|
+
}
|
|
2095
|
+
/**
|
|
2096
|
+
* 观众直播房间类
|
|
2097
|
+
* 处理:
|
|
2098
|
+
* 1、通知观众房间内 人员变更、资源变更
|
|
2099
|
+
* 2、观众订阅、取消订阅资源
|
|
2100
|
+
*/
|
|
2101
|
+
declare class RCAudienceLivingRoom {
|
|
2102
|
+
private readonly _context;
|
|
2103
|
+
private readonly _runtime;
|
|
2104
|
+
private readonly _initOptions;
|
|
2105
|
+
private readonly _roomId;
|
|
2106
|
+
private readonly _joinResData;
|
|
2107
|
+
readonly livingType: RCLivingType;
|
|
2108
|
+
private _useMutilPeerC?;
|
|
2109
|
+
protected readonly _clientSessionId: string;
|
|
2110
|
+
private readonly _service;
|
|
1994
2111
|
/**
|
|
1995
|
-
*
|
|
1996
|
-
* @param userIds
|
|
2112
|
+
* 主播列表
|
|
1997
2113
|
*/
|
|
1998
|
-
|
|
2114
|
+
private _roomAnchorList;
|
|
1999
2115
|
/**
|
|
2000
|
-
*
|
|
2116
|
+
* 合流、分流资源
|
|
2001
2117
|
*/
|
|
2002
|
-
|
|
2118
|
+
private _roomRes;
|
|
2003
2119
|
/**
|
|
2004
|
-
*
|
|
2005
|
-
* @since version: 5.1.5
|
|
2120
|
+
* 主播分流资源
|
|
2006
2121
|
*/
|
|
2007
|
-
|
|
2122
|
+
private _roomAnchorRes;
|
|
2008
2123
|
/**
|
|
2009
|
-
*
|
|
2124
|
+
* 合流、分流 remoteTracks
|
|
2010
2125
|
*/
|
|
2011
|
-
|
|
2012
|
-
|
|
2013
|
-
|
|
2014
|
-
|
|
2015
|
-
|
|
2016
|
-
|
|
2017
|
-
interface IRCRTCInitOptions {
|
|
2126
|
+
private _remoteTracks;
|
|
2127
|
+
private _appListener;
|
|
2128
|
+
private _pc;
|
|
2129
|
+
private _subscribedList;
|
|
2130
|
+
private _sessionId;
|
|
2131
|
+
private _destroyed;
|
|
2018
2132
|
/**
|
|
2019
|
-
*
|
|
2020
|
-
* @description
|
|
2021
|
-
* 1. 仅当 `location.hostname` 为 `localhost` 时,`http` 协议地址有效,否则必须使用 `https` 协议地址
|
|
2022
|
-
* 2. 当该值有效时,将不再从 IMLib 导航数据中获取 mediaServer 地址
|
|
2133
|
+
* 北极星上报实例
|
|
2023
2134
|
*/
|
|
2024
|
-
|
|
2135
|
+
protected _polarisReport: PolarisReporter | null;
|
|
2025
2136
|
/**
|
|
2026
|
-
*
|
|
2027
|
-
* @description
|
|
2028
|
-
* * 0 - DEBUG
|
|
2029
|
-
* * 1 - INFO
|
|
2030
|
-
* * 2 - WARN
|
|
2031
|
-
* * 3 - ERROR
|
|
2137
|
+
* 音量上报实例
|
|
2032
2138
|
*/
|
|
2033
|
-
|
|
2139
|
+
private _audioLevelReport;
|
|
2034
2140
|
/**
|
|
2035
|
-
*
|
|
2141
|
+
* cdn_uris 资源
|
|
2036
2142
|
*/
|
|
2037
|
-
|
|
2143
|
+
private _CDNUris;
|
|
2038
2144
|
/**
|
|
2039
|
-
*
|
|
2040
|
-
* 优先级:用户配置 > 导航配置 > 默认时间。
|
|
2145
|
+
* 使用的 peerConnection 对应 id
|
|
2041
2146
|
*/
|
|
2042
|
-
|
|
2147
|
+
private _pcName;
|
|
2043
2148
|
/**
|
|
2044
|
-
*
|
|
2149
|
+
* peerConnection 管理类
|
|
2150
|
+
*/
|
|
2151
|
+
private _peerCManager;
|
|
2152
|
+
constructor(_context: RTCPluginContext, _runtime: IRuntime, _initOptions: IRCRTCInitOptions, _roomId: string, _joinResData: {
|
|
2153
|
+
token: string;
|
|
2154
|
+
kvEntries: IServerRTCRoomEntry[];
|
|
2155
|
+
}, livingType: RCLivingType, _useMutilPeerC?: boolean | undefined, _clientSessionId?: string);
|
|
2156
|
+
/**
|
|
2157
|
+
* 解析服务端返回的 KV 数据,赋值 room 内数据
|
|
2045
2158
|
*/
|
|
2046
|
-
|
|
2159
|
+
private _setInitData;
|
|
2160
|
+
protected _assertRoomDestroyed(): RCRTCCode | undefined;
|
|
2047
2161
|
/**
|
|
2048
|
-
*
|
|
2162
|
+
* @description 信令数据处理
|
|
2163
|
+
* @param roomId 数据对应的房间 Id
|
|
2164
|
+
* @param singalData 拉取到的数据
|
|
2165
|
+
* * key RC_ANCHOR_LIST value: 为主播 ID 集合
|
|
2166
|
+
* * key RC_RES_`userId` value: 为主播发布的资源
|
|
2167
|
+
* * key RC_RTC_SESSIONID value: sessionId
|
|
2168
|
+
* * key RC_CDN value: CDN 资源数据
|
|
2049
2169
|
*/
|
|
2050
|
-
|
|
2170
|
+
private singalDataChange;
|
|
2051
2171
|
/**
|
|
2052
|
-
*
|
|
2172
|
+
* 计算加入离开的主播 ID 列表
|
|
2053
2173
|
*/
|
|
2054
|
-
|
|
2174
|
+
private _diffAnchorList;
|
|
2175
|
+
private _handleNewJoinedAnchor;
|
|
2176
|
+
private _handleLeftedAnchor;
|
|
2055
2177
|
/**
|
|
2056
|
-
*
|
|
2178
|
+
* 计算新发布和取消发布的合流资源
|
|
2057
2179
|
*/
|
|
2058
|
-
|
|
2059
|
-
}
|
|
2060
|
-
interface ICameraVideoProfile extends IVideoProfile {
|
|
2061
|
-
cameraId?: string;
|
|
2062
|
-
faceMode?: 'user' | 'environment';
|
|
2063
|
-
}
|
|
2064
|
-
interface IMicphoneAudioProfile {
|
|
2065
|
-
micphoneId?: string;
|
|
2066
|
-
sampleRate?: number;
|
|
2067
|
-
}
|
|
2068
|
-
interface ICreateLocalTrackOptions {
|
|
2180
|
+
private _diffRoomResource;
|
|
2069
2181
|
/**
|
|
2070
|
-
*
|
|
2182
|
+
* 计算主播发布和取消发布的资源,以及资源的状态变更
|
|
2183
|
+
*/
|
|
2184
|
+
private _diffAnchorResource;
|
|
2185
|
+
private _onUserUnpublish;
|
|
2186
|
+
private _callAppListener;
|
|
2187
|
+
/**
|
|
2188
|
+
* ice 断线后,尝试重新走 exchange
|
|
2189
|
+
*/
|
|
2190
|
+
private _reTryExchange;
|
|
2191
|
+
/**
|
|
2192
|
+
* 获取 subscribe 接口的请求体数据
|
|
2193
|
+
* @param subscribeList 订阅清单
|
|
2194
|
+
* @param publishedStreams 已发布流
|
|
2195
|
+
* @param iceRestart
|
|
2071
2196
|
*/
|
|
2072
|
-
|
|
2197
|
+
protected _createSubscribeParams(subscribeList: ISubscribeAttr[], publishedStreams: {
|
|
2198
|
+
[msid: string]: RCLocalMediaStream;
|
|
2199
|
+
}, iceRestart: boolean): Promise<{
|
|
2200
|
+
reqBody: IBroadcastSubReqBody;
|
|
2201
|
+
offer: RTCSessionDescriptionInit;
|
|
2202
|
+
dynamicBitrate: {
|
|
2203
|
+
min: number;
|
|
2204
|
+
max: number;
|
|
2205
|
+
};
|
|
2206
|
+
}>;
|
|
2207
|
+
private _subscribeHandle;
|
|
2073
2208
|
/**
|
|
2074
|
-
*
|
|
2209
|
+
* 添加 peerConnection 事件
|
|
2075
2210
|
*/
|
|
2076
|
-
|
|
2077
|
-
|
|
2078
|
-
|
|
2079
|
-
|
|
2080
|
-
*/
|
|
2081
|
-
interface IAudioLevelChangeHandler {
|
|
2082
|
-
(audioLevelReportList: {
|
|
2083
|
-
track: RCLocalAudioTrack | RCRemoteAudioTrack;
|
|
2084
|
-
audioLevel: number;
|
|
2085
|
-
}[]): void;
|
|
2086
|
-
}
|
|
2087
|
-
/**
|
|
2088
|
-
* 房间资源数据
|
|
2089
|
-
*/
|
|
2090
|
-
declare type RoomData = {
|
|
2091
|
-
[userId: string]: IPublishedResource[];
|
|
2092
|
-
};
|
|
2093
|
-
/**
|
|
2094
|
-
* IMutilPeerC 中的 track 类型
|
|
2095
|
-
*/
|
|
2096
|
-
declare type TrackParam = RCLocalTrack | IPublishAttrs | RCRemoteTrack | ISubscribeAttr;
|
|
2097
|
-
/**
|
|
2098
|
-
* RCRTCPeerCManager 创建的一条 pcItem 上的数据类型
|
|
2099
|
-
*/
|
|
2100
|
-
interface IMutilPeerC {
|
|
2211
|
+
private _addPeerCEvent;
|
|
2212
|
+
private _getReqHeaders;
|
|
2213
|
+
private _exchangeHandle;
|
|
2214
|
+
private _updateSubListHandle;
|
|
2101
2215
|
/**
|
|
2102
|
-
*
|
|
2216
|
+
* 对比 cdn_uris 资源
|
|
2217
|
+
* @param newCDNUris 新的 cdn_uris 数据
|
|
2103
2218
|
*/
|
|
2104
|
-
|
|
2219
|
+
private _diffCDNUris;
|
|
2220
|
+
/**
|
|
2221
|
+
* 获取 CDN 资源对应的拉流地址
|
|
2222
|
+
* _CDNUris 无 url 时,说明未开启 CDN 推送
|
|
2223
|
+
* @returns CDNPlayUrl
|
|
2224
|
+
*/
|
|
2225
|
+
private _getCDNPlayUrl;
|
|
2226
|
+
/**
|
|
2227
|
+
* 获取 CDN 资源对应的拉流地址
|
|
2228
|
+
* @returns CDNPlayUrl
|
|
2229
|
+
*/
|
|
2230
|
+
getCDNPlayUrl(resolution?: RCResolution, fps?: RCFrameRate): Promise<{
|
|
2231
|
+
code: RCRTCCode;
|
|
2232
|
+
CDNPlayUrl?: string;
|
|
2233
|
+
}>;
|
|
2105
2234
|
/**
|
|
2106
|
-
*
|
|
2235
|
+
* 订阅资源
|
|
2236
|
+
* @param tracks
|
|
2107
2237
|
*/
|
|
2108
|
-
|
|
2238
|
+
subscribe(tracks: (RCRemoteTrack | ISubscribeAttr)[]): Promise<{
|
|
2239
|
+
code: RCRTCCode;
|
|
2240
|
+
failedList?: ISubscribeAttr[];
|
|
2241
|
+
}>;
|
|
2242
|
+
private __unsubscribe;
|
|
2109
2243
|
/**
|
|
2110
|
-
*
|
|
2244
|
+
* 取消订阅资源
|
|
2245
|
+
* @param tracks
|
|
2111
2246
|
*/
|
|
2112
|
-
tracks:
|
|
2113
|
-
|
|
2114
|
-
|
|
2115
|
-
|
|
2116
|
-
inviteSessionId: string;
|
|
2117
|
-
inviterRoomId: string;
|
|
2118
|
-
inviterUserId: string;
|
|
2119
|
-
inviterUserAutoMix?: boolean;
|
|
2120
|
-
inviteeRoomId: string;
|
|
2121
|
-
inviteeUserAutoMix?: boolean;
|
|
2122
|
-
};
|
|
2123
|
-
}
|
|
2124
|
-
/**
|
|
2125
|
-
* 业务层发起连麦、响应连麦可选参数定义
|
|
2126
|
-
*/
|
|
2127
|
-
interface IReqResPKOptions {
|
|
2128
|
-
autoMix?: boolean;
|
|
2129
|
-
extra?: string;
|
|
2130
|
-
}
|
|
2131
|
-
interface IPKInviterBaseInfo {
|
|
2247
|
+
unsubscribe(tracks: RCRemoteTrack[]): Promise<{
|
|
2248
|
+
code: RCRTCCode;
|
|
2249
|
+
failedList?: ISubscribeAttr[];
|
|
2250
|
+
}>;
|
|
2132
2251
|
/**
|
|
2133
|
-
*
|
|
2252
|
+
* 退出房间并销毁当前房间实例,退出后该房间的所有方法将不可用
|
|
2134
2253
|
*/
|
|
2135
|
-
|
|
2254
|
+
__destroy(quitRoom: boolean): Promise<void>;
|
|
2136
2255
|
/**
|
|
2137
|
-
*
|
|
2256
|
+
* 根据 trackId 获取房间内的远端资源
|
|
2257
|
+
* @param trackId
|
|
2138
2258
|
*/
|
|
2139
|
-
|
|
2140
|
-
}
|
|
2141
|
-
interface IPKInviteeBaseInfo {
|
|
2259
|
+
getRemoteTrack(trackId: string): RCRemoteTrack;
|
|
2142
2260
|
/**
|
|
2143
|
-
*
|
|
2261
|
+
* 获取 _pc 实例
|
|
2144
2262
|
*/
|
|
2145
|
-
|
|
2263
|
+
__getPC(): RCRTCPeerConnection[];
|
|
2146
2264
|
/**
|
|
2147
|
-
*
|
|
2265
|
+
* TODO 待优化
|
|
2266
|
+
* @param trackId
|
|
2148
2267
|
*/
|
|
2149
|
-
|
|
2150
|
-
}
|
|
2151
|
-
/**
|
|
2152
|
-
* 业务层监听收到连麦邀请、取消连麦的字段
|
|
2153
|
-
*/
|
|
2154
|
-
interface IPKInviteInfo extends IPKInviterBaseInfo {
|
|
2268
|
+
getLocalTrack(trackId: string): RCRemoteTrack;
|
|
2155
2269
|
/**
|
|
2156
|
-
*
|
|
2270
|
+
* 断线重连后处理逻辑, SDK 内部处理调用
|
|
2157
2271
|
*/
|
|
2158
|
-
|
|
2159
|
-
}
|
|
2160
|
-
/**
|
|
2161
|
-
* 业务层监听收到连麦应答的字段
|
|
2162
|
-
*/
|
|
2163
|
-
interface IPKInviteAnswerInfo extends IPKInviterBaseInfo, IPKInviteeBaseInfo {
|
|
2272
|
+
__onReconnected(): Promise<void>;
|
|
2164
2273
|
/**
|
|
2165
|
-
*
|
|
2274
|
+
* 观众房间事件注册
|
|
2275
|
+
* @param tag 参数描述
|
|
2166
2276
|
*/
|
|
2167
|
-
|
|
2277
|
+
registerRoomEventListener(listener: IAudienceRoomEventListener | null): void;
|
|
2168
2278
|
/**
|
|
2169
|
-
*
|
|
2279
|
+
* 音量上报
|
|
2280
|
+
* @param handler 业务端传入的音量上报事件
|
|
2281
|
+
* @param gap 上报时间间隔
|
|
2170
2282
|
*/
|
|
2171
|
-
|
|
2172
|
-
|
|
2173
|
-
/**
|
|
2174
|
-
* 业务层监听收到连麦结束的字段
|
|
2175
|
-
*/
|
|
2176
|
-
interface IPKEndInfo {
|
|
2283
|
+
onAudioLevelChange(handler: IAudioLevelChangeHandler | null, gap?: number): void;
|
|
2284
|
+
private _reportListener;
|
|
2177
2285
|
/**
|
|
2178
|
-
*
|
|
2286
|
+
* 注册房间数据监控
|
|
2287
|
+
* @param listener
|
|
2179
2288
|
*/
|
|
2180
|
-
|
|
2289
|
+
registerReportListener(listener: IRCRTCReportListener | null): void;
|
|
2181
2290
|
/**
|
|
2182
|
-
*
|
|
2291
|
+
* 获取房间 Id
|
|
2183
2292
|
*/
|
|
2184
|
-
|
|
2185
|
-
}
|
|
2186
|
-
/**
|
|
2187
|
-
* 观众加房间返回给客户的 CDN 信息
|
|
2188
|
-
*/
|
|
2189
|
-
interface IJoinResCDNInfo {
|
|
2190
|
-
resolution?: RCResolution;
|
|
2191
|
-
fps?: RCFrameRate;
|
|
2192
|
-
CDNEnable?: boolean;
|
|
2193
|
-
}
|
|
2194
|
-
|
|
2195
|
-
declare enum RCInnerCDNPushMode {
|
|
2196
|
-
AUTOMATIC = 0,
|
|
2197
|
-
MANUAL = 1
|
|
2198
|
-
}
|
|
2199
|
-
|
|
2200
|
-
declare enum RCInnerCDNBroadcast {
|
|
2201
|
-
SPREAD = 0,
|
|
2202
|
-
NO_SPREAD = -1
|
|
2203
|
-
}
|
|
2204
|
-
|
|
2205
|
-
/**
|
|
2206
|
-
* 与 MediaServer 交互所需的 Request Header 信息
|
|
2207
|
-
*/
|
|
2208
|
-
interface IRTCReqHeader {
|
|
2293
|
+
getRoomId(): string;
|
|
2209
2294
|
/**
|
|
2210
|
-
*
|
|
2211
|
-
* @todo 有效期问题处理
|
|
2295
|
+
* 获取当前 userId
|
|
2212
2296
|
*/
|
|
2213
|
-
|
|
2297
|
+
getCrtUserId(): string;
|
|
2214
2298
|
/**
|
|
2215
|
-
*
|
|
2299
|
+
* 获取房间当前会话 Id,当房间内已无成员时房间会回收,重新加入时 sessionId 将更新
|
|
2216
2300
|
*/
|
|
2217
|
-
|
|
2301
|
+
getSessionId(): string;
|
|
2218
2302
|
/**
|
|
2219
|
-
*
|
|
2303
|
+
* 获取远程主播用户列表
|
|
2220
2304
|
*/
|
|
2221
|
-
|
|
2305
|
+
getRemoteUserIds(): string[];
|
|
2222
2306
|
/**
|
|
2223
|
-
*
|
|
2307
|
+
* 获取远端用户的资源列表
|
|
2308
|
+
* @param userId
|
|
2309
|
+
* @returns
|
|
2224
2310
|
*/
|
|
2225
|
-
|
|
2311
|
+
getRemoteTracksByUserId(userId: string): RCRemoteTrack[];
|
|
2226
2312
|
/**
|
|
2227
|
-
*
|
|
2313
|
+
* 获取房间内所有已发布的远端资源列表, 包含合流资源
|
|
2314
|
+
* @returns
|
|
2228
2315
|
*/
|
|
2229
|
-
|
|
2316
|
+
getRemoteTracks(): RCRemoteTrack[];
|
|
2230
2317
|
/**
|
|
2231
|
-
*
|
|
2318
|
+
* 获取远端 RTC tracks
|
|
2232
2319
|
*/
|
|
2233
|
-
|
|
2320
|
+
getRemoteRTCTracks(): RCRemoteTrack[];
|
|
2234
2321
|
/**
|
|
2235
|
-
*
|
|
2322
|
+
* 获取远端 MCU tracks
|
|
2236
2323
|
*/
|
|
2237
|
-
|
|
2324
|
+
getRemoteMCUTracks(): RCRemoteTrack[];
|
|
2238
2325
|
/**
|
|
2239
|
-
*
|
|
2326
|
+
* 获取房间内 CDN 信息
|
|
2240
2327
|
*/
|
|
2241
|
-
|
|
2242
|
-
|
|
2243
|
-
|
|
2244
|
-
|
|
2245
|
-
|
|
2246
|
-
|
|
2247
|
-
|
|
2248
|
-
|
|
2328
|
+
getCDNInfo(): {
|
|
2329
|
+
resolution: RCResolution;
|
|
2330
|
+
fps: RCFrameRate;
|
|
2331
|
+
CDNEnable: boolean | undefined;
|
|
2332
|
+
} | {
|
|
2333
|
+
CDNEnable: boolean;
|
|
2334
|
+
resolution?: undefined;
|
|
2335
|
+
fps?: undefined;
|
|
2336
|
+
};
|
|
2337
|
+
getClientSessionId(): string;
|
|
2249
2338
|
}
|
|
2339
|
+
|
|
2250
2340
|
/**
|
|
2251
|
-
*
|
|
2341
|
+
* 北极星上报角色
|
|
2252
2342
|
*/
|
|
2253
|
-
|
|
2343
|
+
declare enum PolarisRole {
|
|
2254
2344
|
/**
|
|
2255
|
-
*
|
|
2345
|
+
* 会议参会者、主播
|
|
2256
2346
|
*/
|
|
2257
|
-
|
|
2347
|
+
MeetingOrAnchor = 1,
|
|
2258
2348
|
/**
|
|
2259
|
-
|
|
2260
|
-
|
|
2261
|
-
|
|
2349
|
+
* 观众
|
|
2350
|
+
*/
|
|
2351
|
+
Audience = 2
|
|
2352
|
+
}
|
|
2353
|
+
|
|
2354
|
+
declare class PolarisReporter {
|
|
2355
|
+
private readonly _context;
|
|
2356
|
+
private readonly _runtime;
|
|
2357
|
+
private readonly _roomId;
|
|
2358
|
+
private readonly _crtRTCRoom;
|
|
2359
|
+
private readonly _userRole;
|
|
2360
|
+
constructor(_context: RTCPluginContext, _runtime: IRuntime, _roomId: string, _crtRTCRoom: RCAbstractRoom | RCAudienceLivingRoom, _userRole?: PolarisRole);
|
|
2361
|
+
private _send;
|
|
2362
|
+
private _getClientID;
|
|
2262
2363
|
/**
|
|
2263
|
-
|
|
2264
|
-
|
|
2265
|
-
|
|
2364
|
+
* 小流需去掉 _tiny,小流 resourceId 为 userId_tag_mediaType_tiny
|
|
2365
|
+
*/
|
|
2366
|
+
private _getRealResourceId;
|
|
2367
|
+
/**
|
|
2368
|
+
* 生成北极星上报的 trackId
|
|
2369
|
+
* @param resourceId userId_11_1_tiny 改为 userId_11_tiny_video
|
|
2370
|
+
*/
|
|
2371
|
+
private _getPolarisTrackId;
|
|
2372
|
+
sendR3R4Data(data: IInnerRCRTCStateReport): Promise<boolean>;
|
|
2373
|
+
/**
|
|
2374
|
+
* 加入房间
|
|
2375
|
+
*/
|
|
2376
|
+
sendR1(): void;
|
|
2377
|
+
/**
|
|
2378
|
+
* RTC 和 LIVE 发布、取消发布
|
|
2379
|
+
* RTC 订阅、取消订阅
|
|
2380
|
+
*/
|
|
2381
|
+
sendR2(action: string, status: string, trackIds: string[]): void;
|
|
2266
2382
|
}
|
|
2383
|
+
|
|
2267
2384
|
/**
|
|
2268
|
-
*
|
|
2385
|
+
* PC 实例管理类
|
|
2269
2386
|
*/
|
|
2270
|
-
|
|
2387
|
+
declare class RCRTCPeerConnection extends EventEmitter {
|
|
2271
2388
|
/**
|
|
2272
|
-
*
|
|
2389
|
+
* peerConnection 对应名称
|
|
2390
|
+
*/
|
|
2391
|
+
private readonly _pcName;
|
|
2392
|
+
/**
|
|
2393
|
+
* _reTryExchange 方法
|
|
2273
2394
|
*/
|
|
2274
|
-
|
|
2395
|
+
private readonly _reTryExchange;
|
|
2275
2396
|
/**
|
|
2276
|
-
*
|
|
2397
|
+
* 当前用户 id
|
|
2277
2398
|
*/
|
|
2278
|
-
|
|
2279
|
-
/**
|
|
2280
|
-
* 流资源 uri
|
|
2281
|
-
*/
|
|
2282
|
-
uri: string;
|
|
2283
|
-
/**
|
|
2284
|
-
* 大小流订阅,`1` 为大流,`2` 为小流,默认使用大流
|
|
2285
|
-
*/
|
|
2286
|
-
simulcast: RCStreamType;
|
|
2287
|
-
/**
|
|
2288
|
-
* 分辨率信息
|
|
2289
|
-
*/
|
|
2290
|
-
resolution: string;
|
|
2291
|
-
}[];
|
|
2399
|
+
private readonly _currentUserId;
|
|
2292
2400
|
/**
|
|
2293
|
-
*
|
|
2294
|
-
* @example `{"resolutionInfo":[{"trackId":"021ad6e8-a50c-479c-96c8-5f3f09d2352d","simulcast":1,"resolution":"640x480"}]}`
|
|
2401
|
+
* 北极星上传实例
|
|
2295
2402
|
*/
|
|
2296
|
-
|
|
2403
|
+
private readonly _polarisReport?;
|
|
2404
|
+
static __INNER_EVENT_TRACK_READY__: string;
|
|
2405
|
+
private readonly _rtcPeerConn;
|
|
2406
|
+
private readonly _sdpStrategy;
|
|
2407
|
+
reportParser: IStatParser | null;
|
|
2408
|
+
private pubLocalTracks;
|
|
2409
|
+
private _reTryExchangeTimer;
|
|
2410
|
+
private _reportStatsTimer;
|
|
2411
|
+
private _reportR3R4ToPolarisTimer;
|
|
2412
|
+
constructor(
|
|
2297
2413
|
/**
|
|
2298
|
-
*
|
|
2299
|
-
|
|
2300
|
-
|
|
2414
|
+
* peerConnection 对应名称
|
|
2415
|
+
*/
|
|
2416
|
+
_pcName: string,
|
|
2301
2417
|
/**
|
|
2302
|
-
*
|
|
2418
|
+
* _reTryExchange 方法
|
|
2303
2419
|
*/
|
|
2304
|
-
|
|
2305
|
-
}
|
|
2306
|
-
interface ILiveUrls {
|
|
2420
|
+
_reTryExchange: Function,
|
|
2307
2421
|
/**
|
|
2308
|
-
*
|
|
2422
|
+
* 当前用户 id
|
|
2309
2423
|
*/
|
|
2310
|
-
|
|
2424
|
+
_currentUserId: string,
|
|
2311
2425
|
/**
|
|
2312
|
-
*
|
|
2426
|
+
* 北极星上传实例
|
|
2313
2427
|
*/
|
|
2314
|
-
|
|
2428
|
+
_polarisReport?: PolarisReporter | undefined);
|
|
2429
|
+
getName(): string;
|
|
2430
|
+
getLocalTracks(): RCLocalTrack[];
|
|
2431
|
+
private _onConnectionStateChange;
|
|
2432
|
+
private _onICEConnectionStateChange;
|
|
2433
|
+
private _onTrackReady;
|
|
2315
2434
|
/**
|
|
2316
|
-
*
|
|
2435
|
+
* 它设置对等连接的比特率。
|
|
2436
|
+
* @deprecated use RCLocalTrack.setBitrate instead of setBitrate
|
|
2317
2437
|
*/
|
|
2318
|
-
|
|
2319
|
-
|
|
2320
|
-
|
|
2438
|
+
setBitrate(max: number, min: number, start?: number): Promise<void>;
|
|
2439
|
+
createOffer(iceRestart: boolean): Promise<IOfferInfo>;
|
|
2440
|
+
setRemoteAnswer(answer: string): Promise<RCRTCCode>;
|
|
2441
|
+
getLocalTrack(trackId: string): RCLocalTrack | null;
|
|
2442
|
+
addLocalTrack(track: RCLocalTrack): void;
|
|
2443
|
+
removeLocalTrackById(trackId: string): void;
|
|
2444
|
+
removeAllLocalTrack(): void;
|
|
2445
|
+
removeLocalTrack(track: RCLocalTrack): void;
|
|
2446
|
+
private _updateRecvTransceiverMap;
|
|
2447
|
+
updateSubRemoteTracks(remoteTracks: RCRemoteTrack[]): void;
|
|
2321
2448
|
/**
|
|
2322
|
-
*
|
|
2449
|
+
* 获取当前已发布视频流信息
|
|
2323
2450
|
*/
|
|
2324
|
-
|
|
2325
|
-
|
|
2326
|
-
|
|
2327
|
-
|
|
2328
|
-
message: string;
|
|
2451
|
+
getOutboundVideoInfo(): OutboundVideoInfo[];
|
|
2452
|
+
private _onLocalTrackMuted;
|
|
2453
|
+
private _onLocalTrackDestroied;
|
|
2454
|
+
private _reportListener;
|
|
2329
2455
|
/**
|
|
2330
|
-
*
|
|
2456
|
+
* 注册连接数据监控,开启质量数据上报定时器
|
|
2457
|
+
* @param listener
|
|
2331
2458
|
*/
|
|
2332
|
-
|
|
2333
|
-
|
|
2334
|
-
/**
|
|
2335
|
-
* /exchange 响应结果
|
|
2336
|
-
*/
|
|
2337
|
-
interface IExchangeResponse extends IRTCResponse {
|
|
2459
|
+
registerReportListener(listener: IRCRTCReportListener | null): void;
|
|
2460
|
+
private _createRCRTCStateReport;
|
|
2338
2461
|
/**
|
|
2339
|
-
*
|
|
2462
|
+
* 获取 peerConnection stats 数据并格式化
|
|
2463
|
+
* @returns 返回格式化后的数据
|
|
2340
2464
|
*/
|
|
2341
|
-
|
|
2465
|
+
private _getStatsData;
|
|
2466
|
+
getAudioLevelReportData(): Promise<{
|
|
2467
|
+
trackId: string;
|
|
2468
|
+
audioLevel: number | null;
|
|
2469
|
+
}[] | undefined>;
|
|
2342
2470
|
/**
|
|
2343
|
-
*
|
|
2471
|
+
* 通知用户质量数据、peerConnection 北极星数据上报
|
|
2472
|
+
* @todo
|
|
2344
2473
|
*/
|
|
2345
|
-
|
|
2474
|
+
private _reportHandle;
|
|
2346
2475
|
/**
|
|
2347
|
-
*
|
|
2476
|
+
* 北极星上报 R3、R4 数据
|
|
2348
2477
|
*/
|
|
2349
|
-
|
|
2478
|
+
private _sendR3R4Data;
|
|
2350
2479
|
/**
|
|
2351
|
-
*
|
|
2480
|
+
* 2s 给北极星上报一次 R3、R4
|
|
2352
2481
|
*/
|
|
2353
|
-
|
|
2354
|
-
|
|
2355
|
-
|
|
2356
|
-
|
|
2482
|
+
__reportR3R4ToPolaris(): Promise<void>;
|
|
2483
|
+
getRTCPeerConn(): RTCPeerConnection;
|
|
2484
|
+
destroy(): void;
|
|
2485
|
+
clearReTryExchangeTimer(): void;
|
|
2486
|
+
}
|
|
2487
|
+
|
|
2488
|
+
interface IRCTrackBitrate {
|
|
2357
2489
|
/**
|
|
2358
|
-
*
|
|
2490
|
+
* 最大码率
|
|
2359
2491
|
*/
|
|
2360
|
-
|
|
2492
|
+
max: number;
|
|
2361
2493
|
/**
|
|
2362
|
-
*
|
|
2494
|
+
* 最小码率
|
|
2363
2495
|
*/
|
|
2364
|
-
|
|
2365
|
-
[roomId: string]: ILiveUrls;
|
|
2366
|
-
};
|
|
2496
|
+
min: number;
|
|
2367
2497
|
/**
|
|
2368
|
-
*
|
|
2369
|
-
* 主播发布为具体资源,会议模式为空数组
|
|
2498
|
+
* 上行起始码率
|
|
2370
2499
|
*/
|
|
2371
|
-
|
|
2500
|
+
start?: number;
|
|
2501
|
+
}
|
|
2502
|
+
/**
|
|
2503
|
+
* MediaServer 返回的媒体资源数据
|
|
2504
|
+
*/
|
|
2505
|
+
interface IResource {
|
|
2372
2506
|
/**
|
|
2373
|
-
*
|
|
2507
|
+
* 媒体类型
|
|
2374
2508
|
*/
|
|
2375
|
-
|
|
2376
|
-
mediaType: RCMediaType.AUDIO_ONLY | RCMediaType.VIDEO_ONLY;
|
|
2377
|
-
msid: string;
|
|
2378
|
-
userId: string;
|
|
2379
|
-
simulcast?: RCStreamType;
|
|
2380
|
-
}[];
|
|
2381
|
-
}
|
|
2382
|
-
interface IBroadcastSubReqBody {
|
|
2509
|
+
mediaType: RCMediaType.AUDIO_ONLY | RCMediaType.VIDEO_ONLY;
|
|
2383
2510
|
/**
|
|
2384
|
-
*
|
|
2511
|
+
* MediaStream Id,基本为 `userId` 与 `tag` 以 `_` 拼接而来。该值无法直接作为资源的唯一性标识属性,
|
|
2512
|
+
* 需与 mediaType 拼接使用
|
|
2385
2513
|
*/
|
|
2386
|
-
|
|
2387
|
-
type: 'offer';
|
|
2388
|
-
sdp: string;
|
|
2389
|
-
};
|
|
2514
|
+
msid: string;
|
|
2390
2515
|
/**
|
|
2391
|
-
*
|
|
2516
|
+
* MediaServer 返回的资源地址
|
|
2517
|
+
* @example 举例如下:
|
|
2518
|
+
* `{"clusterId":"rtc-data-bdcbj.ronghub.com:80","serverId":"172.28.76.215:40080","resourceId":"13111111111_5vls_web_RongCloudRTC_1","connectionId":"AAYxMDAzNjgAFDEzMTExMTExMTExXzV2bHNfd2ViAAMzMzMA","ssrc":1716229921,"serviceProvider":"bdc","userTimestamp":1604994044706}`
|
|
2392
2519
|
*/
|
|
2393
|
-
|
|
2520
|
+
uri: string;
|
|
2394
2521
|
/**
|
|
2395
|
-
*
|
|
2522
|
+
* 资源特征,simulcast 代表这道流支持大小流
|
|
2523
|
+
* @description 此参数存疑,MediaServer 似乎并未下发此字段,Web 端暂不启用
|
|
2524
|
+
* @deprecated
|
|
2396
2525
|
*/
|
|
2397
|
-
|
|
2526
|
+
features?: ['simulcast'] | [];
|
|
2527
|
+
}
|
|
2528
|
+
/**
|
|
2529
|
+
* 向房间内发布的媒体数据
|
|
2530
|
+
*/
|
|
2531
|
+
interface IPublishedResource extends IResource {
|
|
2398
2532
|
/**
|
|
2399
|
-
*
|
|
2533
|
+
* 资源禁用/启用标识,用于向 signal 同步本端资源状态,1 为启用,0 为禁用
|
|
2400
2534
|
*/
|
|
2401
|
-
|
|
2535
|
+
state: 0 | 1;
|
|
2402
2536
|
/**
|
|
2403
|
-
*
|
|
2537
|
+
* 资源标识,同标识的资源将视作同道流,标识不可重复
|
|
2404
2538
|
*/
|
|
2405
|
-
|
|
2539
|
+
tag: string;
|
|
2540
|
+
}
|
|
2541
|
+
interface ISubscribeAttr {
|
|
2406
2542
|
/**
|
|
2407
|
-
*
|
|
2543
|
+
* 要订阅的音视轨数据 Id
|
|
2408
2544
|
*/
|
|
2409
|
-
|
|
2410
|
-
/**
|
|
2411
|
-
* 流资源 uri
|
|
2412
|
-
*/
|
|
2413
|
-
uri: string;
|
|
2414
|
-
/**
|
|
2415
|
-
* 大小流订阅,`1` 为大流,`2` 为小流,默认使用大流
|
|
2416
|
-
*/
|
|
2417
|
-
simulcast: RCStreamType;
|
|
2418
|
-
/**
|
|
2419
|
-
* 分辨率信息
|
|
2420
|
-
*/
|
|
2421
|
-
resolution: string;
|
|
2422
|
-
}[];
|
|
2545
|
+
track: RCRemoteTrack;
|
|
2423
2546
|
/**
|
|
2424
|
-
*
|
|
2547
|
+
* 订阅小流,默认为 `false`
|
|
2425
2548
|
*/
|
|
2426
|
-
|
|
2549
|
+
subTiny?: boolean;
|
|
2427
2550
|
}
|
|
2428
|
-
|
|
2551
|
+
/**
|
|
2552
|
+
* 视频配置
|
|
2553
|
+
*/
|
|
2554
|
+
interface IVideoProfile {
|
|
2429
2555
|
/**
|
|
2430
|
-
*
|
|
2556
|
+
* 视频帧率
|
|
2431
2557
|
*/
|
|
2432
|
-
|
|
2558
|
+
frameRate: RCFrameRate;
|
|
2433
2559
|
/**
|
|
2434
|
-
*
|
|
2560
|
+
* 视频分辨率
|
|
2435
2561
|
*/
|
|
2436
|
-
|
|
2437
|
-
type: 'answer';
|
|
2438
|
-
sdp: string;
|
|
2439
|
-
};
|
|
2562
|
+
resolution: RCResolution;
|
|
2440
2563
|
}
|
|
2441
2564
|
/**
|
|
2442
|
-
*
|
|
2565
|
+
* 屏幕共享流配置
|
|
2443
2566
|
*/
|
|
2444
|
-
interface
|
|
2567
|
+
interface IScreenVideoProfile extends IVideoProfile {
|
|
2568
|
+
/**
|
|
2569
|
+
* Electron 平台下通过 `desktopCapturer.getSources` 获取到的 sourceId,
|
|
2570
|
+
* 不传 chromeMediaSourceId 时默认共享桌面,传入时共享指定窗口。
|
|
2571
|
+
* @see `https://www.electronjs.org/docs/api/desktop-capturer`
|
|
2572
|
+
*/
|
|
2573
|
+
chromeMediaSourceId?: string;
|
|
2445
2574
|
}
|
|
2446
2575
|
/**
|
|
2447
|
-
*
|
|
2576
|
+
* 待发布资源数据
|
|
2448
2577
|
*/
|
|
2449
|
-
interface
|
|
2450
|
-
|
|
2451
|
-
|
|
2452
|
-
|
|
2453
|
-
|
|
2454
|
-
|
|
2455
|
-
|
|
2578
|
+
interface IPublishAttrs {
|
|
2579
|
+
/**
|
|
2580
|
+
* 待发布的轨道数据
|
|
2581
|
+
*/
|
|
2582
|
+
track: RCLocalTrack;
|
|
2583
|
+
/**
|
|
2584
|
+
* 是否同时发布小流
|
|
2585
|
+
*/
|
|
2586
|
+
pubTiny?: boolean | IVideoProfile;
|
|
2456
2587
|
}
|
|
2457
2588
|
/**
|
|
2458
|
-
*
|
|
2589
|
+
* peerConnection 抛出给用户的 track 字段
|
|
2459
2590
|
*/
|
|
2460
|
-
interface
|
|
2591
|
+
interface IRCTrackStat {
|
|
2461
2592
|
/**
|
|
2462
|
-
*
|
|
2593
|
+
* stat id
|
|
2594
|
+
*/
|
|
2595
|
+
id?: string;
|
|
2596
|
+
/**
|
|
2597
|
+
* 资源 Id
|
|
2463
2598
|
*/
|
|
2464
|
-
|
|
2599
|
+
trackId: string;
|
|
2465
2600
|
/**
|
|
2466
|
-
*
|
|
2601
|
+
* 资源类型
|
|
2467
2602
|
*/
|
|
2468
|
-
|
|
2603
|
+
kind: 'audio' | 'video';
|
|
2469
2604
|
/**
|
|
2470
|
-
*
|
|
2605
|
+
* 丢包率,有效值 `0` - `1`
|
|
2471
2606
|
*/
|
|
2472
|
-
|
|
2607
|
+
packetsLostRate: number | null;
|
|
2608
|
+
/**
|
|
2609
|
+
* 是否是远端资源
|
|
2610
|
+
*/
|
|
2611
|
+
remoteResource: boolean;
|
|
2612
|
+
/**
|
|
2613
|
+
* 音量
|
|
2614
|
+
*/
|
|
2615
|
+
audioLevel?: number | null;
|
|
2616
|
+
/**
|
|
2617
|
+
* 视频高度
|
|
2618
|
+
*/
|
|
2619
|
+
frameHeight?: number | null;
|
|
2473
2620
|
/**
|
|
2474
|
-
|
|
2475
|
-
|
|
2476
|
-
|
|
2621
|
+
* 视频宽度
|
|
2622
|
+
*/
|
|
2623
|
+
frameWidth?: number | null;
|
|
2477
2624
|
/**
|
|
2478
|
-
*
|
|
2625
|
+
* 视频帧率
|
|
2479
2626
|
*/
|
|
2480
|
-
|
|
2627
|
+
frameRate?: number | null;
|
|
2481
2628
|
/**
|
|
2482
|
-
*
|
|
2629
|
+
* 码率
|
|
2483
2630
|
*/
|
|
2484
|
-
|
|
2631
|
+
bitrate: number;
|
|
2485
2632
|
/**
|
|
2486
|
-
*
|
|
2633
|
+
* 网络抖动,单位 ms
|
|
2634
|
+
* @description 下行数据中,同道流中只有一个 track 会有值,另一轨道数据值为 `0`
|
|
2487
2635
|
*/
|
|
2488
|
-
|
|
2489
|
-
'pull_safe': boolean;
|
|
2636
|
+
jitter: number | null;
|
|
2490
2637
|
}
|
|
2491
|
-
|
|
2492
2638
|
/**
|
|
2493
|
-
*
|
|
2639
|
+
* peerConnection 抛出给用户的 iceCandidatePair 字段
|
|
2494
2640
|
*/
|
|
2495
|
-
|
|
2641
|
+
interface IRCCandidatePairStat {
|
|
2496
2642
|
/**
|
|
2497
|
-
*
|
|
2643
|
+
* 本端 IP
|
|
2498
2644
|
*/
|
|
2499
|
-
|
|
2645
|
+
IP: string;
|
|
2500
2646
|
/**
|
|
2501
|
-
*
|
|
2647
|
+
* 本地 UDP 端口
|
|
2502
2648
|
*/
|
|
2503
|
-
|
|
2649
|
+
port: number;
|
|
2504
2650
|
/**
|
|
2505
|
-
*
|
|
2651
|
+
* 本地网络类型
|
|
2506
2652
|
*/
|
|
2507
|
-
|
|
2508
|
-
}
|
|
2509
|
-
|
|
2510
|
-
/**
|
|
2511
|
-
* 合流布局对视频的填充模式
|
|
2512
|
-
*/
|
|
2513
|
-
declare enum MixVideoRenderMode {
|
|
2653
|
+
networkType: string | null;
|
|
2514
2654
|
/**
|
|
2515
|
-
*
|
|
2655
|
+
* 远端 IP
|
|
2516
2656
|
*/
|
|
2517
|
-
|
|
2657
|
+
remoteIP: string;
|
|
2518
2658
|
/**
|
|
2519
|
-
*
|
|
2659
|
+
* 远端 UDP 端口
|
|
2520
2660
|
*/
|
|
2521
|
-
|
|
2522
|
-
}
|
|
2523
|
-
|
|
2524
|
-
declare enum RCInnerCDNModel {
|
|
2525
|
-
OPEN = 1,
|
|
2526
|
-
STOP = 2
|
|
2527
|
-
}
|
|
2528
|
-
|
|
2529
|
-
declare enum RCMixInputFilterMode {
|
|
2530
|
-
/** 全合流,后续加入房间的用户会自动合流 */
|
|
2531
|
-
AUDIO_VIDEO_ALL = 0,
|
|
2532
|
-
/** 全不合流,后续加入本房间的用户 */
|
|
2533
|
-
AUDIO_VIDEO_NO = 1,
|
|
2534
|
-
/** 音频全订阅, 视频全不订阅 */
|
|
2535
|
-
AUDIO_ALL_VIDEO_NO = 2,
|
|
2536
|
-
/** 视频全订阅, 音频全不订阅 */
|
|
2537
|
-
AUDIO_NO_VIDEO_ALL = 3,
|
|
2661
|
+
remotePort: number;
|
|
2538
2662
|
/**
|
|
2539
|
-
*
|
|
2663
|
+
* 协议
|
|
2540
2664
|
*/
|
|
2541
|
-
|
|
2542
|
-
/** 音频全订阅,视频根据设置的视频合流列表 */
|
|
2543
|
-
AUDIO_ALL_VIDEO_INPUT = 5,
|
|
2544
|
-
/** 音频全不订阅, 视频根据input里面的视频项订阅 */
|
|
2545
|
-
AUDIO_NO_VIDEO_INPUT = 6,
|
|
2546
|
-
/** 视频全订阅, 音频根据input里面的音频项订阅 */
|
|
2547
|
-
AUDIO_INPUT_VIDEO_ALL = 7,
|
|
2548
|
-
/** 视频全不订阅, 音频根据input里面的音频项订阅 */
|
|
2549
|
-
AUDIO_INPUT_VIDEO_NO = 8,
|
|
2550
|
-
/** 按房间列表订阅音视频(保留当前已经订阅的, 但没在房间列表里的音视频) */
|
|
2551
|
-
ROOM_AUDIO_VIDEO_APPEND = 9,
|
|
2552
|
-
/** 按房间列表订阅音视频(清理当前已经订阅的, 但没在房间列表里的音视频) */
|
|
2553
|
-
ROOM_AUDIO_VIDEO_NOT_APPEND = 10,
|
|
2554
|
-
/** 按房间列表订阅音频, 不订阅视频(保留当前已经订阅的, 但没在房间列表里的音频) */
|
|
2555
|
-
ROOM_AUDIO_APPEND = 11,
|
|
2556
|
-
/** 按房间列表订阅音视, 不订阅视频(清理当前已经订阅的, 但没在房间列表里的音频) */
|
|
2557
|
-
ROOM_AUDIO_NOT_APPEND = 12,
|
|
2558
|
-
/** 按房间列表订阅视频, 不订阅音频(保留当前已经订阅的, 但没在房间列表里的视频) */
|
|
2559
|
-
ROOM_VIDEO_APPEND = 13,
|
|
2560
|
-
/** 按房间列表订阅视频, 不订阅音频(清理当前已经订阅的, 但没在房间列表里的视频) */
|
|
2561
|
-
ROOM_VIDEO_NOT_APPEND = 14
|
|
2562
|
-
}
|
|
2563
|
-
|
|
2564
|
-
/**
|
|
2565
|
-
* 合流后的 video 输出编码配置,包含分辨率、帧率、码率配置项
|
|
2566
|
-
*/
|
|
2567
|
-
interface IMCUOutputVideoAttrs {
|
|
2665
|
+
protocol: string;
|
|
2568
2666
|
/**
|
|
2569
|
-
*
|
|
2667
|
+
* 发送总码率,单位 kbps
|
|
2570
2668
|
*/
|
|
2571
|
-
|
|
2669
|
+
bitrateSend: number;
|
|
2572
2670
|
/**
|
|
2573
|
-
*
|
|
2671
|
+
* 接收总码率,单位 kbps
|
|
2574
2672
|
*/
|
|
2575
|
-
|
|
2673
|
+
bitrateRecv: number;
|
|
2576
2674
|
/**
|
|
2577
|
-
*
|
|
2675
|
+
* (Round-Trip-Time)往返时延,单位 ms
|
|
2578
2676
|
*/
|
|
2579
|
-
|
|
2677
|
+
rtt: number | null;
|
|
2580
2678
|
/**
|
|
2581
|
-
*
|
|
2679
|
+
* 可用上行带宽,单位 bit
|
|
2582
2680
|
*/
|
|
2583
|
-
|
|
2584
|
-
|
|
2585
|
-
|
|
2586
|
-
|
|
2587
|
-
|
|
2588
|
-
interface IMCUInputAudio {
|
|
2589
|
-
user_id: string;
|
|
2590
|
-
stream_id: string;
|
|
2681
|
+
availableOutgoingBitrate: number | null;
|
|
2682
|
+
/**
|
|
2683
|
+
* 可用下行带宽,在无下行资源时,其值为 `0`,单位: `bit`
|
|
2684
|
+
*/
|
|
2685
|
+
availableIncomingBitrate: number | null;
|
|
2591
2686
|
}
|
|
2592
2687
|
/**
|
|
2593
|
-
*
|
|
2688
|
+
* iceCandidatePair 所有字段
|
|
2689
|
+
* 含 peerConnection 抛出给用户的 iceCandidatePair 字段
|
|
2690
|
+
* 含 北极星上报 R3、R4 所需的 totalPacketsLost
|
|
2594
2691
|
*/
|
|
2595
|
-
interface
|
|
2596
|
-
|
|
2597
|
-
|
|
2598
|
-
|
|
2599
|
-
|
|
2600
|
-
width: number;
|
|
2601
|
-
height: number;
|
|
2692
|
+
interface IInnerIcePair extends IRCCandidatePairStat {
|
|
2693
|
+
/**
|
|
2694
|
+
* 上、下行总丢包率
|
|
2695
|
+
*/
|
|
2696
|
+
totalPacketsLost?: number;
|
|
2602
2697
|
}
|
|
2603
2698
|
/**
|
|
2604
|
-
*
|
|
2699
|
+
* send track 所有字段
|
|
2700
|
+
* 含 peerConnection 抛出给用户的 track 字段
|
|
2701
|
+
* 含 北极星上报 R3 track 所需字段
|
|
2605
2702
|
*/
|
|
2606
|
-
interface
|
|
2607
|
-
/**
|
|
2608
|
-
* 资源下载地址,需包含协议
|
|
2609
|
-
*/
|
|
2610
|
-
uri: string;
|
|
2703
|
+
interface ISendTrackState extends IRCTrackStat {
|
|
2611
2704
|
/**
|
|
2612
|
-
*
|
|
2705
|
+
* (Round-Trip-Time)往返时延,单位 ms
|
|
2613
2706
|
*/
|
|
2614
|
-
|
|
2707
|
+
rtt: number | null;
|
|
2615
2708
|
/**
|
|
2616
|
-
*
|
|
2709
|
+
* 编码方式
|
|
2617
2710
|
*/
|
|
2618
|
-
|
|
2711
|
+
encoderImplementation: string | null;
|
|
2619
2712
|
/**
|
|
2620
|
-
*
|
|
2713
|
+
* PLI 请求数
|
|
2621
2714
|
*/
|
|
2622
|
-
|
|
2715
|
+
pliCount: number;
|
|
2623
2716
|
/**
|
|
2624
|
-
*
|
|
2717
|
+
* nack 数量
|
|
2625
2718
|
*/
|
|
2626
|
-
|
|
2627
|
-
}
|
|
2628
|
-
/**
|
|
2629
|
-
* 合流后的 Video 输出配置,包含背景图、背景色、大小流编码等配置项
|
|
2630
|
-
*/
|
|
2631
|
-
interface IMCUOutputVideoConfig {
|
|
2719
|
+
nackCount: number;
|
|
2632
2720
|
/**
|
|
2633
|
-
*
|
|
2721
|
+
* 第一个关键帧是否正常收到
|
|
2634
2722
|
*/
|
|
2635
|
-
|
|
2723
|
+
googFirsSent: number;
|
|
2636
2724
|
/**
|
|
2637
|
-
*
|
|
2725
|
+
* 音频采样率
|
|
2638
2726
|
*/
|
|
2639
|
-
|
|
2640
|
-
exparams?: {
|
|
2641
|
-
/**
|
|
2642
|
-
* 合流布局时,对视频流的填充方式
|
|
2643
|
-
*/
|
|
2644
|
-
renderMode: MixVideoRenderMode;
|
|
2645
|
-
};
|
|
2727
|
+
samplingRate: number;
|
|
2646
2728
|
/**
|
|
2647
|
-
*
|
|
2729
|
+
* 接收卡顿(间隔时间, 单位: ms)
|
|
2648
2730
|
*/
|
|
2649
|
-
|
|
2731
|
+
googRenderDelayMs: number;
|
|
2650
2732
|
/**
|
|
2651
|
-
*
|
|
2733
|
+
* 流状态(0:不可用, 1:可用)
|
|
2652
2734
|
*/
|
|
2653
|
-
|
|
2654
|
-
/**
|
|
2655
|
-
* 填充模式:
|
|
2656
|
-
* 1. 按比例裁剪
|
|
2657
|
-
* 2. 不裁剪,按比例压缩
|
|
2658
|
-
*/
|
|
2659
|
-
fillMode: 1 | 2;
|
|
2660
|
-
/**
|
|
2661
|
-
* 资源列表
|
|
2662
|
-
*/
|
|
2663
|
-
picture: IPictureAttrs[];
|
|
2664
|
-
};
|
|
2735
|
+
trackState: TrackState;
|
|
2665
2736
|
}
|
|
2666
2737
|
/**
|
|
2667
|
-
*
|
|
2738
|
+
* receive track 所有字段
|
|
2739
|
+
* 含 peerConnection 抛出给用户的 track 字段
|
|
2740
|
+
* 含 北极星上报 R4 track 所需字段
|
|
2668
2741
|
*/
|
|
2669
|
-
interface
|
|
2670
|
-
/**
|
|
2671
|
-
* 输出视频配置
|
|
2672
|
-
*/
|
|
2673
|
-
video: IMCUOutputVideoConfig;
|
|
2674
|
-
/**
|
|
2675
|
-
* 输出音频配置
|
|
2676
|
-
*/
|
|
2677
|
-
audio?: {
|
|
2678
|
-
/**
|
|
2679
|
-
* 音频码率
|
|
2680
|
-
*/
|
|
2681
|
-
bitrate: number;
|
|
2682
|
-
};
|
|
2742
|
+
interface IRecvTrackState extends IRCTrackStat {
|
|
2683
2743
|
/**
|
|
2684
|
-
*
|
|
2744
|
+
* 解码方式
|
|
2685
2745
|
*/
|
|
2686
|
-
|
|
2687
|
-
|
|
2688
|
-
|
|
2689
|
-
|
|
2690
|
-
|
|
2691
|
-
|
|
2746
|
+
codecImplementationName: string | null;
|
|
2747
|
+
samplingRate: number;
|
|
2748
|
+
nackCount: number;
|
|
2749
|
+
pliCount: number;
|
|
2750
|
+
rtt: number | null;
|
|
2751
|
+
googFirsReceived: number;
|
|
2752
|
+
googRenderDelayMs: number;
|
|
2753
|
+
trackState: TrackState;
|
|
2692
2754
|
}
|
|
2693
2755
|
/**
|
|
2694
|
-
*
|
|
2756
|
+
* peerConnection stats 解析出来业务所需的所有字段
|
|
2757
|
+
*/
|
|
2758
|
+
interface IInnerRCRTCStateReport {
|
|
2759
|
+
timestamp: number;
|
|
2760
|
+
iceCandidatePair?: IInnerIcePair;
|
|
2761
|
+
senders: ISendTrackState[];
|
|
2762
|
+
receivers: IRecvTrackState[];
|
|
2763
|
+
}
|
|
2764
|
+
/**
|
|
2765
|
+
* /**
|
|
2766
|
+
* peerConnection stats 抛给用户的字段
|
|
2695
2767
|
*/
|
|
2696
|
-
interface
|
|
2768
|
+
interface IRCRTCStateReport {
|
|
2769
|
+
pcName?: string;
|
|
2770
|
+
/**
|
|
2771
|
+
* 报告生成时间戳
|
|
2772
|
+
*/
|
|
2773
|
+
timestamp: number;
|
|
2697
2774
|
/**
|
|
2698
|
-
*
|
|
2775
|
+
* 对等连接状态数据
|
|
2699
2776
|
*/
|
|
2700
|
-
|
|
2777
|
+
iceCandidatePair?: IRCCandidatePairStat;
|
|
2701
2778
|
/**
|
|
2702
|
-
*
|
|
2779
|
+
* 上行状态数据
|
|
2703
2780
|
*/
|
|
2704
|
-
|
|
2781
|
+
senders: IRCTrackStat[];
|
|
2705
2782
|
/**
|
|
2706
|
-
*
|
|
2783
|
+
* 下行状态数据
|
|
2707
2784
|
*/
|
|
2708
|
-
|
|
2785
|
+
receivers: IRCTrackStat[];
|
|
2786
|
+
}
|
|
2787
|
+
interface IRCRTCReportListener {
|
|
2709
2788
|
/**
|
|
2710
|
-
*
|
|
2789
|
+
* RTCPeerConnection 的详细状态数据
|
|
2790
|
+
* @param report
|
|
2711
2791
|
*/
|
|
2712
|
-
|
|
2792
|
+
onStateReport?(report: IRCRTCStateReport): void;
|
|
2713
2793
|
/**
|
|
2714
|
-
*
|
|
2794
|
+
* ICE 连接状态变更通知
|
|
2795
|
+
* @since version 5.1.5
|
|
2715
2796
|
*/
|
|
2716
|
-
|
|
2797
|
+
onICEConnectionStateChange?(state: RTCIceConnectionState, pcName?: string): void;
|
|
2717
2798
|
/**
|
|
2718
|
-
*
|
|
2799
|
+
* @deprecated
|
|
2719
2800
|
*/
|
|
2720
|
-
|
|
2801
|
+
onConnectionStateChange?(state: RTCPeerConnectionState, pcName?: string): void;
|
|
2721
2802
|
}
|
|
2722
|
-
|
|
2723
|
-
* 文本参数,用于水印
|
|
2724
|
-
*/
|
|
2725
|
-
interface ITextAttrs {
|
|
2803
|
+
interface IRCRTCTrackEventListener {
|
|
2726
2804
|
/**
|
|
2727
|
-
*
|
|
2805
|
+
* 订阅的音视频流通道已建立, track 已可以进行播放
|
|
2806
|
+
* @param track RCRemoteTrack 类实例
|
|
2728
2807
|
*/
|
|
2729
|
-
|
|
2808
|
+
onTrackReady?(track: RCRemoteTrack): void;
|
|
2809
|
+
}
|
|
2810
|
+
interface IRoomEventListener extends IRCRTCTrackEventListener {
|
|
2730
2811
|
/**
|
|
2731
|
-
*
|
|
2812
|
+
* 当 RTCPeerConnection 连接被异常关闭时触发,此时需业务层重新加入房间并重新发布、订阅资源。
|
|
2813
|
+
* 引起连接异常中断的原因包括但不限于:电脑休眠、浏览器页面长期后台运行等
|
|
2814
|
+
* @since 5.1.5
|
|
2732
2815
|
*/
|
|
2733
|
-
|
|
2816
|
+
onRTCPeerConnectionCloseByException?(): void;
|
|
2734
2817
|
/**
|
|
2735
|
-
*
|
|
2818
|
+
* 当本端被剔出房间时触发
|
|
2819
|
+
* @description 被踢出房间可能是由于服务端超出一定时间未能收到 rtcPing 消息,所以认为己方离线。
|
|
2820
|
+
* 另一种可能是己方 rtcPing 失败次数超出上限
|
|
2821
|
+
* @param byServer 当值为 `false` 时,说明本端 rtcPing 超时;当值为 `true` 时,说明本端收到被踢出房间通知
|
|
2736
2822
|
*/
|
|
2737
|
-
|
|
2823
|
+
onKickOff?(byServer: boolean, state?: RCKickReason, kickExtra?: any): void;
|
|
2738
2824
|
/**
|
|
2739
|
-
*
|
|
2825
|
+
* 接收到房间信令时回调,用户可通过房间实例的 sendMessage 接口发送信令
|
|
2826
|
+
* @param name 信令名
|
|
2827
|
+
* @param content 信令内容
|
|
2828
|
+
* @param senderUserId 发送者 Id
|
|
2829
|
+
* @param messageUId 消息唯一标识
|
|
2740
2830
|
*/
|
|
2741
|
-
|
|
2831
|
+
onMessageReceive?(name: string, content: any, senderUserId: string, messageUId: string): void;
|
|
2742
2832
|
/**
|
|
2743
|
-
*
|
|
2833
|
+
* 房间属性变更回调
|
|
2834
|
+
* @param name
|
|
2835
|
+
* @param content
|
|
2744
2836
|
*/
|
|
2745
|
-
|
|
2837
|
+
onRoomAttributeChange?(name: string, content?: string): void;
|
|
2746
2838
|
/**
|
|
2747
|
-
*
|
|
2839
|
+
* 房间用户禁用/启用音频
|
|
2840
|
+
* @param audioTrack RCRemoteAudioTrack 类实例
|
|
2748
2841
|
*/
|
|
2749
|
-
|
|
2750
|
-
}
|
|
2751
|
-
/**
|
|
2752
|
-
* 屏幕水印配置
|
|
2753
|
-
*/
|
|
2754
|
-
interface IWaterMarkConfig {
|
|
2842
|
+
onAudioMuteChange?(audioTrack: RCRemoteAudioTrack): void;
|
|
2755
2843
|
/**
|
|
2756
|
-
*
|
|
2844
|
+
* 房间用户禁用/启用视频
|
|
2845
|
+
* @param videoTrack RCRemoteVideoTrack 类实例对象
|
|
2757
2846
|
*/
|
|
2758
|
-
|
|
2847
|
+
onVideoMuteChange?(videoTrack: RCRemoteVideoTrack): void;
|
|
2759
2848
|
/**
|
|
2760
|
-
*
|
|
2849
|
+
* 房间内用户发布资源
|
|
2850
|
+
* @param tracks 新发布的音轨与视轨数据列表,包含新发布的 RCRemoteAudioTrack 与 RCRemoteVideoTrack 实例
|
|
2761
2851
|
*/
|
|
2762
|
-
|
|
2852
|
+
onTrackPublish?(tracks: RCRemoteTrack[]): void;
|
|
2763
2853
|
/**
|
|
2764
|
-
*
|
|
2854
|
+
* 房间用户取消发布资源
|
|
2855
|
+
* @param tracks 被取消发布的音轨与视轨数据列表
|
|
2856
|
+
* @description 当资源被取消发布时,SDK 内部会取消对相关资源的订阅,业务层仅需处理 UI 业务
|
|
2765
2857
|
*/
|
|
2766
|
-
|
|
2767
|
-
}
|
|
2768
|
-
/**
|
|
2769
|
-
* 合流前的单一视频流水印配置
|
|
2770
|
-
*/
|
|
2771
|
-
interface IMCUSignalScreenWaterMarkConfig extends IWaterMarkConfig {
|
|
2858
|
+
onTrackUnpublish?(tracks: RCRemoteTrack[]): void;
|
|
2772
2859
|
/**
|
|
2773
|
-
*
|
|
2860
|
+
* 人员加入
|
|
2861
|
+
* @param userIds 加入的人员 id 列表
|
|
2774
2862
|
*/
|
|
2775
|
-
|
|
2776
|
-
}
|
|
2777
|
-
interface IMCUWaterMarkConfig {
|
|
2863
|
+
onUserJoin?(userIds: string[]): void;
|
|
2778
2864
|
/**
|
|
2779
|
-
*
|
|
2865
|
+
* 人员退出
|
|
2866
|
+
* @param userIds
|
|
2780
2867
|
*/
|
|
2781
|
-
|
|
2868
|
+
onUserLeave?(userIds: string[]): void;
|
|
2782
2869
|
/**
|
|
2783
|
-
*
|
|
2870
|
+
* 主播开启、停止推 CDN 状态通知
|
|
2784
2871
|
*/
|
|
2785
|
-
|
|
2872
|
+
onCDNEnableChange?(enable: boolean): void;
|
|
2873
|
+
/**
|
|
2874
|
+
* RTC 每次 Ping 的结果
|
|
2875
|
+
* @since version: 5.1.5
|
|
2876
|
+
*/
|
|
2877
|
+
onPing?(result: RCRTCPingResult): void;
|
|
2878
|
+
/**
|
|
2879
|
+
* 主播和观众切换身份通知
|
|
2880
|
+
*/
|
|
2881
|
+
onSwitchRole?(userId: string, role: RCRTCLiveRole): void;
|
|
2786
2882
|
}
|
|
2787
2883
|
/**
|
|
2788
|
-
*
|
|
2884
|
+
* RTCClient 初始化配置
|
|
2885
|
+
* @public
|
|
2789
2886
|
*/
|
|
2790
|
-
interface
|
|
2887
|
+
interface IRCRTCInitOptions {
|
|
2791
2888
|
/**
|
|
2792
|
-
*
|
|
2889
|
+
* 自定义 MediaServer Url,公有云用户无需关注
|
|
2890
|
+
* @description
|
|
2891
|
+
* 1. 仅当 `location.hostname` 为 `localhost` 时,`http` 协议地址有效,否则必须使用 `https` 协议地址
|
|
2892
|
+
* 2. 当该值有效时,将不再从 IMLib 导航数据中获取 mediaServer 地址
|
|
2793
2893
|
*/
|
|
2794
|
-
|
|
2894
|
+
mediaServer?: string;
|
|
2795
2895
|
/**
|
|
2796
|
-
*
|
|
2896
|
+
* 输出日志等级,生产环境默认使用 WARN,开发环境默认为 DEBUG
|
|
2897
|
+
* @description
|
|
2898
|
+
* * 0 - DEBUG
|
|
2899
|
+
* * 1 - INFO
|
|
2900
|
+
* * 2 - WARN
|
|
2901
|
+
* * 3 - ERROR
|
|
2797
2902
|
*/
|
|
2798
|
-
|
|
2903
|
+
logLevel?: LogLevel;
|
|
2799
2904
|
/**
|
|
2800
|
-
*
|
|
2905
|
+
* 修改默认的 log 输出函数
|
|
2801
2906
|
*/
|
|
2802
|
-
|
|
2907
|
+
logStdout?: (logLevel: LogLevel, content: string) => void;
|
|
2803
2908
|
/**
|
|
2804
|
-
*
|
|
2909
|
+
* 与 MediaServer 的 http 请求超时时间,单位为毫秒,默认值为 `5000`,有效值 `5000-30000`。
|
|
2910
|
+
* 优先级:用户配置 > 导航配置 > 默认时间。
|
|
2805
2911
|
*/
|
|
2806
|
-
|
|
2807
|
-
video?: IMCUInputVideoLayout[];
|
|
2808
|
-
audio?: IMCUInputAudio[];
|
|
2809
|
-
};
|
|
2912
|
+
timeout?: number;
|
|
2810
2913
|
/**
|
|
2811
|
-
*
|
|
2914
|
+
* 房间 Ping 间隔时长,默认 `10000` ms,有效值 `3000`-`10000`
|
|
2812
2915
|
*/
|
|
2813
|
-
|
|
2916
|
+
pingGap?: number;
|
|
2814
2917
|
/**
|
|
2815
|
-
*
|
|
2918
|
+
* 优化使用的 SDP 协议版本,仅当运行时浏览器支持相应 SDP 协议版本时生效
|
|
2816
2919
|
*/
|
|
2817
|
-
|
|
2920
|
+
sdpSemantics?: ISdpSemantics;
|
|
2818
2921
|
/**
|
|
2819
|
-
*
|
|
2922
|
+
* 观众拉内置 CDN 资源的直播拉流协议,默认为 RCInnerCDNPullKind.FLV
|
|
2820
2923
|
*/
|
|
2821
|
-
|
|
2924
|
+
pullInnerCDNProtocol?: RCInnerCDNPullKind;
|
|
2822
2925
|
/**
|
|
2823
|
-
*
|
|
2926
|
+
* 观众拉内置 CDN 资源时是否使用 https,默认为 RCInnerCDNPullIsHttps.HTTPS
|
|
2824
2927
|
*/
|
|
2825
|
-
|
|
2928
|
+
pullInnerCDNUseHttps?: RCInnerCDNPullIsHttps;
|
|
2826
2929
|
}
|
|
2827
|
-
|
|
2828
|
-
|
|
2829
|
-
|
|
2830
|
-
interface ISetEnableCDN {
|
|
2831
|
-
version: 2;
|
|
2832
|
-
output: {
|
|
2833
|
-
/**
|
|
2834
|
-
* 手动开启/停用内置 CDN
|
|
2835
|
-
*/
|
|
2836
|
-
inCDNModel: RCInnerCDNModel;
|
|
2837
|
-
};
|
|
2930
|
+
interface ICameraVideoProfile extends IVideoProfile {
|
|
2931
|
+
cameraId?: string;
|
|
2932
|
+
faceMode?: 'user' | 'environment';
|
|
2838
2933
|
}
|
|
2839
|
-
|
|
2840
|
-
|
|
2841
|
-
|
|
2842
|
-
|
|
2843
|
-
|
|
2844
|
-
* 自定义 MediaServer 地址,当有值时,不再使用导航内的地址
|
|
2845
|
-
*/
|
|
2846
|
-
private readonly _msUrl?;
|
|
2847
|
-
/**
|
|
2848
|
-
* 请求超时时长
|
|
2849
|
-
*/
|
|
2850
|
-
private readonly _timeout;
|
|
2934
|
+
interface IMicphoneAudioProfile {
|
|
2935
|
+
micphoneId?: string;
|
|
2936
|
+
sampleRate?: number;
|
|
2937
|
+
}
|
|
2938
|
+
interface ICreateLocalTrackOptions {
|
|
2851
2939
|
/**
|
|
2852
|
-
*
|
|
2940
|
+
* 剔除音轨
|
|
2853
2941
|
*/
|
|
2854
|
-
|
|
2942
|
+
withoutAudio?: boolean;
|
|
2855
2943
|
/**
|
|
2856
|
-
*
|
|
2944
|
+
* 剔除视轨
|
|
2857
2945
|
*/
|
|
2858
|
-
|
|
2946
|
+
withoutVideo?: boolean;
|
|
2947
|
+
}
|
|
2948
|
+
/**
|
|
2949
|
+
* 音量上报事件接口
|
|
2950
|
+
*/
|
|
2951
|
+
interface IAudioLevelChangeHandler {
|
|
2952
|
+
(audioLevelReportList: {
|
|
2953
|
+
track: RCLocalAudioTrack | RCRemoteAudioTrack;
|
|
2954
|
+
audioLevel: number;
|
|
2955
|
+
}[]): void;
|
|
2956
|
+
}
|
|
2957
|
+
/**
|
|
2958
|
+
* 房间资源数据
|
|
2959
|
+
*/
|
|
2960
|
+
declare type RoomData = {
|
|
2961
|
+
[userId: string]: IPublishedResource[];
|
|
2962
|
+
};
|
|
2963
|
+
/**
|
|
2964
|
+
* IMutilPeerC 中的 track 类型
|
|
2965
|
+
*/
|
|
2966
|
+
declare type TrackParam = RCLocalTrack | IPublishAttrs | RCRemoteTrack | ISubscribeAttr;
|
|
2967
|
+
/**
|
|
2968
|
+
* RCRTCPeerCManager 创建的一条 pcItem 上的数据类型
|
|
2969
|
+
*/
|
|
2970
|
+
interface IMutilPeerC {
|
|
2859
2971
|
/**
|
|
2860
|
-
*
|
|
2972
|
+
* pcName,/exchange 请求中 request header 中的 Peer-Connection-Id 值
|
|
2861
2973
|
*/
|
|
2862
|
-
|
|
2974
|
+
pcName: string;
|
|
2863
2975
|
/**
|
|
2864
|
-
*
|
|
2976
|
+
* RCRTCPeerConnection 对象
|
|
2865
2977
|
*/
|
|
2866
|
-
|
|
2978
|
+
pc: RCRTCPeerConnection;
|
|
2867
2979
|
/**
|
|
2868
|
-
*
|
|
2980
|
+
* 存放 peerConnection 上本次要发布、取消发布、订阅、取消订阅的 track
|
|
2869
2981
|
*/
|
|
2870
|
-
|
|
2871
|
-
|
|
2982
|
+
tracks: TrackParam[];
|
|
2983
|
+
}
|
|
2984
|
+
interface IPKInfo {
|
|
2985
|
+
[roomId: string]: {
|
|
2986
|
+
inviteSessionId: string;
|
|
2987
|
+
inviterRoomId: string;
|
|
2988
|
+
inviterUserId: string;
|
|
2989
|
+
inviterUserAutoMix?: boolean;
|
|
2990
|
+
inviteeRoomId: string;
|
|
2991
|
+
inviteeUserAutoMix?: boolean;
|
|
2992
|
+
};
|
|
2993
|
+
}
|
|
2994
|
+
/**
|
|
2995
|
+
* 业务层发起连麦、响应连麦可选参数定义
|
|
2996
|
+
*/
|
|
2997
|
+
interface IReqResPKOptions {
|
|
2998
|
+
autoMix?: boolean;
|
|
2999
|
+
extra?: string;
|
|
3000
|
+
}
|
|
3001
|
+
interface IPKInviterBaseInfo {
|
|
2872
3002
|
/**
|
|
2873
|
-
*
|
|
3003
|
+
* 邀请者房间 ID
|
|
2874
3004
|
*/
|
|
2875
|
-
|
|
3005
|
+
inviterRoomId: string;
|
|
2876
3006
|
/**
|
|
2877
|
-
*
|
|
3007
|
+
* 邀请者用户 ID
|
|
2878
3008
|
*/
|
|
2879
|
-
|
|
2880
|
-
|
|
3009
|
+
inviterUserId: string;
|
|
3010
|
+
}
|
|
3011
|
+
interface IPKInviteeBaseInfo {
|
|
2881
3012
|
/**
|
|
2882
|
-
*
|
|
2883
|
-
* @param path
|
|
2884
|
-
* @param header
|
|
2885
|
-
* @param body
|
|
3013
|
+
* 被邀请者房间 ID
|
|
2886
3014
|
*/
|
|
2887
|
-
|
|
3015
|
+
inviteeRoomId: string;
|
|
2888
3016
|
/**
|
|
2889
|
-
*
|
|
2890
|
-
* 并通过 subscribeList 和 publishList 表明最终发布和订阅的资源。本端产出 offer,服务器产出 answer
|
|
2891
|
-
* 每次接口调用,都会全量覆盖发布和订阅的资源。
|
|
2892
|
-
* @param header
|
|
2893
|
-
* @param body
|
|
3017
|
+
* 被邀请者用户 ID
|
|
2894
3018
|
*/
|
|
2895
|
-
|
|
2896
|
-
|
|
2897
|
-
|
|
2898
|
-
|
|
3019
|
+
inviteeUserId: string;
|
|
3020
|
+
}
|
|
3021
|
+
/**
|
|
3022
|
+
* 业务层监听收到连麦邀请、取消连麦的字段
|
|
3023
|
+
*/
|
|
3024
|
+
interface IPKInviteInfo extends IPKInviterBaseInfo {
|
|
2899
3025
|
/**
|
|
2900
|
-
*
|
|
3026
|
+
* 邀请额外信息
|
|
2901
3027
|
*/
|
|
2902
|
-
|
|
3028
|
+
extra?: string;
|
|
3029
|
+
}
|
|
3030
|
+
/**
|
|
3031
|
+
* 业务层监听收到连麦应答的字段
|
|
3032
|
+
*/
|
|
3033
|
+
interface IPKInviteAnswerInfo extends IPKInviterBaseInfo, IPKInviteeBaseInfo {
|
|
2903
3034
|
/**
|
|
2904
|
-
*
|
|
3035
|
+
* 是否同意邀请
|
|
2905
3036
|
*/
|
|
2906
|
-
|
|
2907
|
-
code: RCRTCCode;
|
|
2908
|
-
data?: IBroadcastSubRespBody | undefined;
|
|
2909
|
-
}>;
|
|
3037
|
+
agree: boolean;
|
|
2910
3038
|
/**
|
|
2911
|
-
*
|
|
3039
|
+
* 响应额外信息
|
|
2912
3040
|
*/
|
|
2913
|
-
|
|
2914
|
-
|
|
2915
|
-
|
|
3041
|
+
extra?: string;
|
|
3042
|
+
}
|
|
3043
|
+
/**
|
|
3044
|
+
* 业务层监听收到连麦结束的字段
|
|
3045
|
+
*/
|
|
3046
|
+
interface IPKEndInfo {
|
|
2916
3047
|
/**
|
|
2917
|
-
*
|
|
3048
|
+
* 发起结束的房间 ID
|
|
2918
3049
|
*/
|
|
2919
|
-
|
|
2920
|
-
code: RCRTCCode;
|
|
2921
|
-
res?: any;
|
|
2922
|
-
}>;
|
|
3050
|
+
endRoomId: string;
|
|
2923
3051
|
/**
|
|
2924
|
-
*
|
|
3052
|
+
* 发起结束的用户 ID
|
|
2925
3053
|
*/
|
|
2926
|
-
|
|
3054
|
+
endUserId: string;
|
|
3055
|
+
}
|
|
3056
|
+
/**
|
|
3057
|
+
* 观众加房间返回给客户的 CDN 信息
|
|
3058
|
+
*/
|
|
3059
|
+
interface IJoinResCDNInfo {
|
|
3060
|
+
resolution?: RCResolution;
|
|
3061
|
+
fps?: RCFrameRate;
|
|
3062
|
+
CDNEnable?: boolean;
|
|
3063
|
+
}
|
|
3064
|
+
interface IPubSuccessRes {
|
|
3065
|
+
code: RCRTCCode;
|
|
3066
|
+
liveUrl?: string;
|
|
3067
|
+
failedTracks?: {
|
|
2927
3068
|
code: RCRTCCode;
|
|
2928
|
-
|
|
2929
|
-
}
|
|
3069
|
+
tracks: RCLocalTrack[];
|
|
3070
|
+
}[];
|
|
2930
3071
|
}
|
|
2931
3072
|
|
|
2932
3073
|
/**
|
|
@@ -2944,37 +3085,26 @@ declare enum BackgroundPictureFillMode {
|
|
|
2944
3085
|
}
|
|
2945
3086
|
|
|
2946
3087
|
declare class RCMCUConfigBuilder {
|
|
3088
|
+
private _invoker;
|
|
2947
3089
|
/**
|
|
2948
3090
|
* flush 提交回调
|
|
2949
3091
|
*/
|
|
2950
|
-
private readonly _onFlush;
|
|
2951
3092
|
/**
|
|
2952
3093
|
* trackId 有效性验证方法
|
|
2953
3094
|
*/
|
|
2954
3095
|
private readonly _isValidTrackId;
|
|
2955
|
-
/**
|
|
2956
|
-
* 扩散 cdn_uris
|
|
2957
|
-
*/
|
|
2958
|
-
private readonly _sendCDNInfoSignal;
|
|
2959
3096
|
/**
|
|
2960
3097
|
* mcu 配置数据,每次向服务器提交全量数据
|
|
2961
3098
|
*/
|
|
2962
3099
|
private _values;
|
|
2963
|
-
constructor(
|
|
3100
|
+
constructor(_invoker: Invoker,
|
|
2964
3101
|
/**
|
|
2965
3102
|
* flush 提交回调
|
|
2966
3103
|
*/
|
|
2967
|
-
_onFlush: (config: IMCUConfig) => Promise<{
|
|
2968
|
-
code: RCRTCCode;
|
|
2969
|
-
}>,
|
|
2970
3104
|
/**
|
|
2971
3105
|
* trackId 有效性验证方法
|
|
2972
3106
|
*/
|
|
2973
|
-
_isValidTrackId: (trackId: string) => boolean
|
|
2974
|
-
/**
|
|
2975
|
-
* 扩散 cdn_uris
|
|
2976
|
-
*/
|
|
2977
|
-
_sendCDNInfoSignal: () => void);
|
|
3107
|
+
_isValidTrackId: (trackId: string) => boolean);
|
|
2978
3108
|
/**
|
|
2979
3109
|
* 设置合流后的主位置显示的视频流
|
|
2980
3110
|
* @param videoTrackId 视频流资源 Id
|
|
@@ -3114,6 +3244,19 @@ declare class RCMCUConfigBuilder {
|
|
|
3114
3244
|
* @since v5.3.7
|
|
3115
3245
|
*/
|
|
3116
3246
|
clearCustomizeInputAudio(): RCMCUConfigBuilder;
|
|
3247
|
+
/**
|
|
3248
|
+
* 给单道流添加水印
|
|
3249
|
+
*/
|
|
3250
|
+
addPictureWaterMark(trackId: string, uri: string, x: number, y: number, w: number, h: number): RCMCUConfigBuilder;
|
|
3251
|
+
/**
|
|
3252
|
+
* 删除所有水印
|
|
3253
|
+
*/
|
|
3254
|
+
clearPictureWaterMark(): RCMCUConfigBuilder;
|
|
3255
|
+
/**
|
|
3256
|
+
* 移除对合流后的某个视频流中添加的指定水印图片
|
|
3257
|
+
* @param uri
|
|
3258
|
+
*/
|
|
3259
|
+
removePictureWaterMark(trackId: string, uri: string): RCMCUConfigBuilder;
|
|
3117
3260
|
/**
|
|
3118
3261
|
* 设置 MCU 混流配置
|
|
3119
3262
|
* @param videoList 视频输入混流列表,为 null 代表视频全混流,为空集合代表视频全不混流,否则按照输入列表进行混流
|
|
@@ -3141,6 +3284,7 @@ declare class RCMCUConfigBuilder {
|
|
|
3141
3284
|
flush(reset?: boolean): Promise<{
|
|
3142
3285
|
code: RCRTCCode;
|
|
3143
3286
|
}>;
|
|
3287
|
+
__innerGetValues(): IMCUConfig;
|
|
3144
3288
|
}
|
|
3145
3289
|
|
|
3146
3290
|
/**
|
|
@@ -3148,29 +3292,32 @@ declare class RCMCUConfigBuilder {
|
|
|
3148
3292
|
*/
|
|
3149
3293
|
declare class RCLivingRoom extends RCAbstractRoom {
|
|
3150
3294
|
private _livingType;
|
|
3151
|
-
/**
|
|
3152
|
-
* 是否是主房间
|
|
3153
|
-
*/
|
|
3154
|
-
protected _isMainRoom: boolean;
|
|
3155
3295
|
readonly _mcuConfigBuilder: RCMCUConfigBuilder;
|
|
3156
3296
|
/**
|
|
3157
|
-
*
|
|
3297
|
+
* 跨房间连麦管理器
|
|
3158
3298
|
*/
|
|
3159
|
-
private
|
|
3160
|
-
|
|
3299
|
+
private _roomPKHandler;
|
|
3300
|
+
constructor(context: RTCPluginContext, runtime: IRuntime, roomId: string, service: RCMediaService, initOptions: IRCRTCInitOptions, _livingType: RCLivingType, isUpgrade?: boolean, isMainRoom?: boolean,
|
|
3161
3301
|
/**
|
|
3162
|
-
*
|
|
3302
|
+
* 是否使用多 peerConnection
|
|
3163
3303
|
*/
|
|
3164
|
-
|
|
3165
|
-
|
|
3304
|
+
useMutilPeerC?: boolean, _clientSessionId?: string);
|
|
3305
|
+
private _initAfterCatchRoomData;
|
|
3166
3306
|
/**
|
|
3167
|
-
*
|
|
3307
|
+
* @override
|
|
3168
3308
|
*/
|
|
3169
|
-
|
|
3309
|
+
__innerInit(mode: RTCMode, joinType?: RTCJoinType, livingType?: RCLivingType, innerUserDatas?: IRTCUserData, outerUserDatas?: IRTCUserData): Promise<{
|
|
3310
|
+
code: RCRTCCode | ErrorCode;
|
|
3311
|
+
data?: IJoinRTCRoomData;
|
|
3312
|
+
}>;
|
|
3313
|
+
__innerInitByIdentityChange(): Promise<ErrorCode>;
|
|
3170
3314
|
/**
|
|
3171
|
-
*
|
|
3315
|
+
* 增量发布资源,若发布的资源 tag 及媒体类型重复,后者将覆盖前者进行发布。
|
|
3316
|
+
* @param tracks 待发布的 RCLocalTrack 实例
|
|
3317
|
+
* @returns
|
|
3172
3318
|
*/
|
|
3173
|
-
|
|
3319
|
+
publish(tracks: (RCLocalTrack | IPublishAttrs)[]): Promise<IPubSuccessRes>;
|
|
3320
|
+
unpublish(tracks: RCLocalTrack[]): Promise<IPubSuccessRes>;
|
|
3174
3321
|
/**
|
|
3175
3322
|
* resourceId 有效性验证
|
|
3176
3323
|
* @param resourceId
|
|
@@ -3183,58 +3330,19 @@ declare class RCLivingRoom extends RCAbstractRoom {
|
|
|
3183
3330
|
getMCUConfigBuilder(): RCMCUConfigBuilder | {
|
|
3184
3331
|
code: RCRTCCode;
|
|
3185
3332
|
};
|
|
3186
|
-
/**
|
|
3187
|
-
* 接收 MCU 配置并向 MediaServer 提交
|
|
3188
|
-
* @param data
|
|
3189
|
-
*/
|
|
3190
|
-
private _onMCUConfigFlush;
|
|
3191
|
-
/**
|
|
3192
|
-
* 主播端断线重连后,需更新内存中的 CDN 数据
|
|
3193
|
-
* 判断房间内 CDN 状态是否和内存数据一致,不一致时需通知到客户端
|
|
3194
|
-
*/
|
|
3195
|
-
__onReconnected(): Promise<void>;
|
|
3196
3333
|
/**
|
|
3197
3334
|
* 开启/停用推 CDN
|
|
3198
3335
|
*/
|
|
3199
3336
|
enableInnerCDN(enable: boolean): Promise<{
|
|
3200
3337
|
code: RCRTCCode;
|
|
3201
3338
|
}>;
|
|
3202
|
-
/**
|
|
3203
|
-
* 开启、停用 CDN 推资源后发信令
|
|
3204
|
-
*/
|
|
3205
|
-
private _sendCDNInfoSignal;
|
|
3206
|
-
/**
|
|
3207
|
-
* 扩散 cdn_uris 资源
|
|
3208
|
-
*/
|
|
3209
|
-
private _spreadCDNInfo;
|
|
3210
|
-
/**
|
|
3211
|
-
* 给房间设置 CDN 数据
|
|
3212
|
-
*/
|
|
3213
|
-
private _setRoomCDNInfo;
|
|
3214
3339
|
/**
|
|
3215
3340
|
* 资源变化时触发
|
|
3216
3341
|
* 直播房间需单独处理 cdn_uris
|
|
3217
3342
|
*/
|
|
3218
|
-
protected _resourceHandle(content: {
|
|
3219
|
-
/**
|
|
3220
|
-
* 旧版本兼容参数,当收到非 `RTCMessageName.TOTAL_CONTENT_RESOURCE` 时:
|
|
3221
|
-
* * ignore 值为 `true` 表示该消息由 signal server 向旧版本 RTCLib 提供的兼容消息,无需处理
|
|
3222
|
-
* * 否则认为该消息是由旧版本 RTCLib 主动发出的增量变更消息,需要处理
|
|
3223
|
-
*/
|
|
3224
|
-
ignore?: boolean;
|
|
3225
|
-
/**
|
|
3226
|
-
* 发布到房间内的资源列表,`RTCMessageName.TOTAL_CONTENT_RESOURCE` 消息携带全量数据,否则为增量数据
|
|
3227
|
-
*/
|
|
3228
|
-
uris: IPublishedResource[];
|
|
3343
|
+
protected _resourceHandle(content: ResourceMsgContent & {
|
|
3229
3344
|
cdn_uris?: ICDNUris[];
|
|
3230
|
-
}, messageType:
|
|
3231
|
-
/**
|
|
3232
|
-
* 重写父类 _exchangeHandle 方法
|
|
3233
|
-
*/
|
|
3234
|
-
protected _exchangeHandle(body: IExchangeReqBody, pcName: string): Promise<{
|
|
3235
|
-
code: RCRTCCode;
|
|
3236
|
-
data?: IExchangeResponse | undefined;
|
|
3237
|
-
}>;
|
|
3345
|
+
}, messageType: RCRTCMessageType.PUBLISH | RCRTCMessageType.UNPUBLISH | RCRTCMessageType.MODIFY | RCRTCMessageType.TOTAL_CONTENT_RESOURCE, userId: string): Promise<void>;
|
|
3238
3346
|
/**
|
|
3239
3347
|
* 观众切换为主播后直接处理人员变更及资源变更
|
|
3240
3348
|
*/
|
|
@@ -3243,28 +3351,20 @@ declare class RCLivingRoom extends RCAbstractRoom {
|
|
|
3243
3351
|
* 返回 CDN 是否可用
|
|
3244
3352
|
* @returns boolean
|
|
3245
3353
|
*/
|
|
3246
|
-
__getCDNEnable(): boolean
|
|
3354
|
+
__getCDNEnable(): boolean;
|
|
3247
3355
|
/**
|
|
3248
3356
|
* 返回 CDN 推送模式: 自动 or 手动
|
|
3249
|
-
* @returns boolean
|
|
3250
3357
|
*/
|
|
3251
3358
|
__getCDNPushMode(): RCInnerCDNPushMode | undefined;
|
|
3252
3359
|
/**
|
|
3360
|
+
* @override
|
|
3253
3361
|
* 加入 PK 房间回调
|
|
3254
3362
|
*/
|
|
3255
3363
|
private _onJoinedPKRoom;
|
|
3256
|
-
/**
|
|
3257
|
-
* 离开 PK 房间后,如果参与过连麦,pushOtherRooms 需去掉退出的连麦房间配置,重新和 mediaServer 交互
|
|
3258
|
-
*/
|
|
3259
|
-
private _onLeavePKRoom;
|
|
3260
3364
|
/**
|
|
3261
3365
|
* @override
|
|
3262
3366
|
*/
|
|
3263
3367
|
protected _getPushOtherRoomsParams(): IPushOtherRooms[];
|
|
3264
|
-
/**
|
|
3265
|
-
* 携带 pushOtherRooms 与 mediaServer 重新交互
|
|
3266
|
-
*/
|
|
3267
|
-
private _exchangeWithPushOtherRoom;
|
|
3268
3368
|
/**
|
|
3269
3369
|
* 获取 PK 业务处理器
|
|
3270
3370
|
* @since version 5.3.0
|
|
@@ -3280,14 +3380,14 @@ declare class RCLivingRoom extends RCAbstractRoom {
|
|
|
3280
3380
|
/**
|
|
3281
3381
|
* 是否是主房间
|
|
3282
3382
|
*/
|
|
3283
|
-
isMainRoom(): boolean;
|
|
3383
|
+
isMainRoom(): boolean | undefined;
|
|
3284
3384
|
}
|
|
3285
3385
|
|
|
3286
3386
|
/**
|
|
3287
3387
|
* 普通音视频房间
|
|
3288
3388
|
*/
|
|
3289
3389
|
declare class RCRTCRoom extends RCAbstractRoom {
|
|
3290
|
-
constructor(context: RTCPluginContext, runtime: IRuntime, roomId: string,
|
|
3390
|
+
constructor(context: RTCPluginContext, runtime: IRuntime, roomId: string, service: RCMediaService, initOptions: IRCRTCInitOptions, isUpgrade?: boolean, isMainRoom?: boolean,
|
|
3291
3391
|
/**
|
|
3292
3392
|
* 是否使用多 peerConnection
|
|
3293
3393
|
*/
|
|
@@ -3303,7 +3403,6 @@ declare class RCAudienceClient {
|
|
|
3303
3403
|
* 是否使用多 peerConnection
|
|
3304
3404
|
*/
|
|
3305
3405
|
private readonly _useMutilPeerC?;
|
|
3306
|
-
private readonly _clientSessionId?;
|
|
3307
3406
|
private _pc;
|
|
3308
3407
|
private _service;
|
|
3309
3408
|
/**
|
|
@@ -3330,11 +3429,12 @@ declare class RCAudienceClient {
|
|
|
3330
3429
|
* peerConnection 管理类
|
|
3331
3430
|
*/
|
|
3332
3431
|
private _peerCManager;
|
|
3432
|
+
private readonly _clientSessionId;
|
|
3333
3433
|
constructor(_context: RTCPluginContext, runtime: IRuntime, _initOption: IRCRTCInitOptions,
|
|
3334
3434
|
/**
|
|
3335
3435
|
* 是否使用多 peerConnection
|
|
3336
3436
|
*/
|
|
3337
|
-
_useMutilPeerC?: boolean | undefined
|
|
3437
|
+
_useMutilPeerC?: boolean | undefined);
|
|
3338
3438
|
private _getReqHeaders;
|
|
3339
3439
|
private _clearSubscribeInfo;
|
|
3340
3440
|
private _livingType;
|
|
@@ -3377,76 +3477,19 @@ declare class RCAudienceClient {
|
|
|
3377
3477
|
private _onTrackReady;
|
|
3378
3478
|
}
|
|
3379
3479
|
|
|
3380
|
-
|
|
3381
|
-
|
|
3382
|
-
|
|
3383
|
-
|
|
3384
|
-
|
|
3385
|
-
private readonly _context;
|
|
3386
|
-
private readonly _runtime;
|
|
3387
|
-
private readonly _options;
|
|
3388
|
-
private readonly _service;
|
|
3389
|
-
constructor(_context: RTCPluginContext, _runtime: IRuntime, _options: IRCRTCInitOptions);
|
|
3390
|
-
private _handleMessage;
|
|
3391
|
-
/**
|
|
3392
|
-
* 获取加入的连麦房间
|
|
3393
|
-
*/
|
|
3394
|
-
private _getJoinedPKRoomList;
|
|
3395
|
-
private _getPKRoomIds;
|
|
3396
|
-
/**
|
|
3397
|
-
* 获取当前用户 Id,若 IM 未连接,这返回 `''`
|
|
3398
|
-
* @returns
|
|
3399
|
-
*/
|
|
3400
|
-
getCurrentId(): string;
|
|
3401
|
-
private _crtRoom;
|
|
3402
|
-
/**
|
|
3403
|
-
* 加入普通音视频房间
|
|
3404
|
-
* @param roomId
|
|
3405
|
-
* @param joinType 多端处理方式,公有云暂不支持该字段
|
|
3406
|
-
* @param outerUserDatas 业务层设置人员属性
|
|
3407
|
-
*/
|
|
3408
|
-
joinRTCRoom(roomId: string, joinType?: RTCJoinType, outerUserDatas?: IRTCUserData, useMutilPeerC?: boolean): Promise<{
|
|
3409
|
-
room?: RCRTCRoom;
|
|
3410
|
-
code: RCRTCCode;
|
|
3411
|
-
userIds?: string[];
|
|
3412
|
-
tracks?: RCRemoteTrack[];
|
|
3413
|
-
}>;
|
|
3414
|
-
private _joinRTCRoom;
|
|
3415
|
-
/**
|
|
3416
|
-
* 主播加入直播房间或观众上麦场景调用,观众上麦之前需先取消已订阅的直播间资源
|
|
3417
|
-
* @param roomId 房间 Id
|
|
3418
|
-
* @param livingType 直播间类型,`RCLivingType.AUDIO` 为音频直播,`RCLivingType.VIDEO` 为音视频直播
|
|
3419
|
-
* @param joinType 多端处理方式,公有云暂不支持该字段
|
|
3420
|
-
* @param outerUserDatas 业务层设置人员属性
|
|
3421
|
-
*/
|
|
3422
|
-
joinLivingRoom(roomId: string, livingType: RCLivingType, joinType?: RTCJoinType, outerUserDatas?: IRTCUserData, useMutilPeerC?: boolean): Promise<{
|
|
3423
|
-
room?: RCLivingRoom;
|
|
3424
|
-
code: RCRTCCode;
|
|
3425
|
-
userIds?: string[];
|
|
3426
|
-
tracks?: RCRemoteTrack[];
|
|
3427
|
-
CDNEnable?: boolean;
|
|
3428
|
-
}>;
|
|
3429
|
-
private _joinLivingRoom;
|
|
3430
|
-
private _audience;
|
|
3431
|
-
/**
|
|
3432
|
-
* 获取直播观众客户端
|
|
3433
|
-
*/
|
|
3434
|
-
getAudienceClient(useMutilPeerC?: boolean): RCAudienceClient;
|
|
3435
|
-
private _onIMStatusChange;
|
|
3436
|
-
private _onIMDisconnect;
|
|
3437
|
-
private _onIMUninit;
|
|
3438
|
-
/**
|
|
3439
|
-
* 退出并销毁当前房间实例,退出后该房间的所有方法将不可用
|
|
3440
|
-
*/
|
|
3441
|
-
leaveRoom(room: RCAbstractRoom): Promise<{
|
|
3442
|
-
code: RCRTCCode;
|
|
3443
|
-
}>;
|
|
3444
|
-
private _leaveRoom;
|
|
3480
|
+
declare class RCMediaStreamCapture {
|
|
3481
|
+
protected readonly _context: RTCPluginContext;
|
|
3482
|
+
constructor(_context: RTCPluginContext);
|
|
3483
|
+
private _isElectron;
|
|
3484
|
+
private _getMediaStream;
|
|
3445
3485
|
/**
|
|
3446
|
-
*
|
|
3486
|
+
* 如果用户设置了音频约束为true,那么我们将音频约束设置为一个空对象,
|
|
3487
|
+
* 然后我们将检查浏览器是否支持noiseSuppression、autoGainControl和echoCancellation约束,
|
|
3488
|
+
* 如果支持,那么我们将设置音频约束为真
|
|
3489
|
+
* @param {any} constraints - 约束参数与 getUserMedia 方法中的约束参数相同。
|
|
3490
|
+
* @returns 返回值是约束对象。
|
|
3447
3491
|
*/
|
|
3448
|
-
private
|
|
3449
|
-
private _getMediaStream;
|
|
3492
|
+
private setConstraintsConfig;
|
|
3450
3493
|
/**
|
|
3451
3494
|
* 从麦克风中捕获音轨数据
|
|
3452
3495
|
* @param tag
|
|
@@ -3492,6 +3535,18 @@ declare class RCRTCClient {
|
|
|
3492
3535
|
code: RCRTCCode;
|
|
3493
3536
|
track?: RCScreenVideoTrack;
|
|
3494
3537
|
}>;
|
|
3538
|
+
/**
|
|
3539
|
+
* 创建带音频的屏幕共享资源
|
|
3540
|
+
* @param tag 屏幕共享视轨数据标识
|
|
3541
|
+
* @param options
|
|
3542
|
+
* @description electron 中 mac 系统暂不支持屏幕共享采集声音
|
|
3543
|
+
* @returns 在可以取到音频的情况下,tracks 中包含音轨和视轨;取不到音视频时 tracks 仅返回视轨
|
|
3544
|
+
*/
|
|
3545
|
+
createScreenWithAudioTracks(tag?: string, options?: IScreenVideoProfile): Promise<{
|
|
3546
|
+
code: RCRTCCode;
|
|
3547
|
+
tracks?: (RCScreenVideoTrack | RCScreenAudioTrack)[];
|
|
3548
|
+
}>;
|
|
3549
|
+
private _createScreenTracks;
|
|
3495
3550
|
/**
|
|
3496
3551
|
* 创建 RCLocalAudioTrack 实例
|
|
3497
3552
|
* @param tag
|
|
@@ -3533,6 +3588,78 @@ declare class RCRTCClient {
|
|
|
3533
3588
|
code: RCRTCCode;
|
|
3534
3589
|
tracks: RCLocalTrack[];
|
|
3535
3590
|
}>;
|
|
3591
|
+
/**
|
|
3592
|
+
* 它接受一个 MediaStream 和一个可选的选项对象并返回一个 MediaStreamTracks 数组
|
|
3593
|
+
* @param {MediaStream} stream - MediaStream - 从中获取曲目的流。
|
|
3594
|
+
* @param {ICreateLocalTrackOptions} [options] - ICreateLocalTrackOptions
|
|
3595
|
+
* @returns 一组 MediaStreamTrack 对象。
|
|
3596
|
+
*/
|
|
3597
|
+
static getTracksWithOptions(stream: MediaStream, options?: ICreateLocalTrackOptions): Array<MediaStreamTrack | undefined>;
|
|
3598
|
+
}
|
|
3599
|
+
|
|
3600
|
+
/**
|
|
3601
|
+
* RTC 业务客户端
|
|
3602
|
+
* @public
|
|
3603
|
+
*/
|
|
3604
|
+
declare class RCRTCClient extends RCMediaStreamCapture {
|
|
3605
|
+
protected readonly _context: RTCPluginContext;
|
|
3606
|
+
private readonly _runtime;
|
|
3607
|
+
private readonly _options;
|
|
3608
|
+
private readonly _service;
|
|
3609
|
+
constructor(_context: RTCPluginContext, _runtime: IRuntime, _options: IRCRTCInitOptions);
|
|
3610
|
+
private _handleMessage;
|
|
3611
|
+
/**
|
|
3612
|
+
* 获取加入的连麦房间
|
|
3613
|
+
*/
|
|
3614
|
+
private _getJoinedPKRoomList;
|
|
3615
|
+
/**
|
|
3616
|
+
* 获取当前用户 Id,若 IM 未连接,这返回 `''`
|
|
3617
|
+
* @returns
|
|
3618
|
+
*/
|
|
3619
|
+
getCurrentId(): string;
|
|
3620
|
+
private _crtRoom;
|
|
3621
|
+
/**
|
|
3622
|
+
* 加入普通音视频房间
|
|
3623
|
+
* @param roomId
|
|
3624
|
+
* @param joinType 多端处理方式
|
|
3625
|
+
* @param outerUserDatas 业务层设置人员属性
|
|
3626
|
+
* @param useMutilPeerC 是否使用多 peerConnection 发布资源
|
|
3627
|
+
* @param roomType 加入房间的类型 默认参数 RTCMode.RTC
|
|
3628
|
+
*/
|
|
3629
|
+
joinRTCRoom(roomId: string, joinType?: RTCJoinType, outerUserDatas?: IRTCUserData, useMutilPeerC?: boolean, roomType?: RTCMode): Promise<{
|
|
3630
|
+
room?: RCRTCRoom;
|
|
3631
|
+
code: RCRTCCode;
|
|
3632
|
+
userIds?: string[];
|
|
3633
|
+
tracks?: RCRemoteTrack[];
|
|
3634
|
+
}>;
|
|
3635
|
+
/**
|
|
3636
|
+
* 主播加入直播房间或观众上麦场景调用,观众上麦之前需先取消已订阅的直播间资源
|
|
3637
|
+
* @param roomId 房间 Id
|
|
3638
|
+
* @param livingType 直播间类型,`RCLivingType.AUDIO` 为音频直播,`RCLivingType.VIDEO` 为音视频直播
|
|
3639
|
+
* @param joinType 多端处理方式,公有云暂不支持该字段
|
|
3640
|
+
* @param outerUserDatas 业务层设置人员属性
|
|
3641
|
+
*/
|
|
3642
|
+
joinLivingRoom(roomId: string, livingType: RCLivingType, joinType?: RTCJoinType, outerUserDatas?: IRTCUserData, useMutilPeerC?: boolean): Promise<{
|
|
3643
|
+
room?: RCLivingRoom;
|
|
3644
|
+
code: RCRTCCode;
|
|
3645
|
+
userIds?: string[];
|
|
3646
|
+
tracks?: RCRemoteTrack[];
|
|
3647
|
+
CDNEnable?: boolean;
|
|
3648
|
+
}>;
|
|
3649
|
+
private _audience;
|
|
3650
|
+
/**
|
|
3651
|
+
* 获取直播观众客户端
|
|
3652
|
+
*/
|
|
3653
|
+
getAudienceClient(useMutilPeerC?: boolean): RCAudienceClient;
|
|
3654
|
+
private _onIMStatusChange;
|
|
3655
|
+
private _onIMDisconnect;
|
|
3656
|
+
private _onIMUninit;
|
|
3657
|
+
/**
|
|
3658
|
+
* 退出并销毁当前房间实例,退出后该房间的所有方法将不可用
|
|
3659
|
+
*/
|
|
3660
|
+
leaveRoom(room: RCAbstractRoom): Promise<{
|
|
3661
|
+
code: RCRTCCode;
|
|
3662
|
+
}>;
|
|
3536
3663
|
private _crtAudienceLivingRoom;
|
|
3537
3664
|
/**
|
|
3538
3665
|
* 观众加入直播房间
|
|
@@ -3580,7 +3707,7 @@ declare class RCRTCClient {
|
|
|
3580
3707
|
* @since version 5.2.1
|
|
3581
3708
|
*/
|
|
3582
3709
|
getJoinedRoomInfo(): Promise<{
|
|
3583
|
-
code: RCRTCCode;
|
|
3710
|
+
code: RCRTCCode | ErrorCode;
|
|
3584
3711
|
data?: IRTCJoinedInfo[];
|
|
3585
3712
|
}>;
|
|
3586
3713
|
}
|
|
@@ -3632,4 +3759,4 @@ declare const helper: {
|
|
|
3632
3759
|
ifSupportScreenShare: typeof ifSupportScreenShare;
|
|
3633
3760
|
};
|
|
3634
3761
|
|
|
3635
|
-
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 };
|
|
3762
|
+
export { BackgroundPictureFillMode, ICameraVideoProfile, IMCUOutputConfig, IMCUOutputVideoConfig, IMicphoneAudioProfile, IPKEndInfo, IPKInviteAnswerInfo, IPKInviteInfo, IPubSuccessRes, IPublishAttrs, IPublishedResource, IRCCandidatePairStat, IRCRTCInitOptions, IRCRTCReportListener, IRCRTCStateReport, IRCTrackStat, 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, device, helper, installer };
|