@rongcloud/plugin-rtc 5.3.8 → 5.3.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +1818 -1568
- package/dist/index.esm.js +2 -2
- package/dist/index.js +1 -1
- package/dist/index.umd.js +1 -1
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* RCRTC - v5.3.
|
|
3
|
-
* CommitId -
|
|
4
|
-
*
|
|
2
|
+
* RCRTC - v5.3.9
|
|
3
|
+
* CommitId - 6383c36083c625d35a0fe9f70e4438eacbd56c99
|
|
4
|
+
* Thu Apr 21 2022 20:01:15 GMT+0800 (China Standard Time)
|
|
5
5
|
* ©2020 RongCloud, Inc. All rights reserved.
|
|
6
6
|
*/
|
|
7
|
-
import { EventEmitter,
|
|
7
|
+
import { EventEmitter, IReceivedMessage, RTCPluginContext, IRuntime, ErrorCode, RTCMode, IJoinRTCRoomData, KVString, IServerRTCRoomEntry, LogLevel, RTCJoinType, IRTCUserData, IRTCJoinedInfo, IPluginGenerator } from '@rongcloud/engine';
|
|
8
8
|
export { RTCJoinType } from '@rongcloud/engine';
|
|
9
9
|
|
|
10
10
|
/**
|
|
@@ -86,7 +86,9 @@ declare enum RCRTCCode {
|
|
|
86
86
|
/** 设置音频输出设备时,无权限使用请求的设备 */
|
|
87
87
|
NO_PERMISSION_TO_USE_REQUESTED_DEVICE = 53029,
|
|
88
88
|
/** 方法在 PK 房间上不可用 */
|
|
89
|
-
THE_FUNCTION_IS_DISABLED_IN_PKROOM = 53030
|
|
89
|
+
THE_FUNCTION_IS_DISABLED_IN_PKROOM = 53030,
|
|
90
|
+
/** 资源没有全部发成功 */
|
|
91
|
+
SOME_TRACKS_PUBLISH_FAILED = 53031
|
|
90
92
|
}
|
|
91
93
|
|
|
92
94
|
/**
|
|
@@ -439,2254 +441,2478 @@ declare enum RCRTCLiveRole {
|
|
|
439
441
|
AUDIENCE = 2
|
|
440
442
|
}
|
|
441
443
|
|
|
442
|
-
|
|
444
|
+
/**
|
|
445
|
+
* 直播间类型
|
|
446
|
+
*/
|
|
447
|
+
declare enum RCLivingType {
|
|
443
448
|
/**
|
|
444
|
-
*
|
|
449
|
+
* 音视频直播
|
|
445
450
|
*/
|
|
446
|
-
|
|
451
|
+
VIDEO = 0,
|
|
447
452
|
/**
|
|
448
|
-
*
|
|
453
|
+
* 音频直播
|
|
449
454
|
*/
|
|
450
|
-
|
|
455
|
+
AUDIO = 1
|
|
456
|
+
}
|
|
457
|
+
|
|
458
|
+
declare type IOnRecvPKMsg = (msg: IReceivedMessage) => void;
|
|
459
|
+
interface IRoomPKEventListener {
|
|
451
460
|
/**
|
|
452
|
-
*
|
|
461
|
+
* 收到连麦邀请
|
|
453
462
|
*/
|
|
454
|
-
|
|
463
|
+
onRequestJoinOtherRoom: (info: IPKInviteInfo) => {};
|
|
464
|
+
/**
|
|
465
|
+
* 收到取消连麦邀请
|
|
466
|
+
*/
|
|
467
|
+
onCancelRequestOtherRoom: (info: IPKInviteInfo) => {};
|
|
468
|
+
/**
|
|
469
|
+
* 收到连麦 PK 请求响应结果
|
|
470
|
+
*/
|
|
471
|
+
onResponseJoinOtherRoom: (info: IPKInviteAnswerInfo) => {};
|
|
472
|
+
/**
|
|
473
|
+
* 收到 PK 结束
|
|
474
|
+
*/
|
|
475
|
+
onFinishOtherRoom: (info: IPKEndInfo) => {};
|
|
455
476
|
}
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
477
|
+
declare class RCLivingPKHandler {
|
|
478
|
+
private _PKInfo;
|
|
479
|
+
private readonly _context;
|
|
480
|
+
private readonly _runtime;
|
|
481
|
+
private readonly _service;
|
|
482
|
+
private readonly _initOptions;
|
|
460
483
|
/**
|
|
461
|
-
*
|
|
484
|
+
* 主直播房间
|
|
462
485
|
*/
|
|
463
|
-
|
|
486
|
+
private readonly _mainLivingRoom;
|
|
487
|
+
private readonly _registerPKMsgListener;
|
|
464
488
|
/**
|
|
465
|
-
*
|
|
466
|
-
* 需与 mediaType 拼接使用
|
|
489
|
+
* 加入 PK 房间回调
|
|
467
490
|
*/
|
|
468
|
-
|
|
491
|
+
private readonly _onJoinedPKRoom;
|
|
469
492
|
/**
|
|
470
|
-
*
|
|
471
|
-
* @example 举例如下:
|
|
472
|
-
* `{"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}`
|
|
493
|
+
* 退出 PK 房间回调
|
|
473
494
|
*/
|
|
474
|
-
|
|
495
|
+
private readonly _onLeavePKRoom;
|
|
475
496
|
/**
|
|
476
|
-
*
|
|
477
|
-
* @description 此参数存疑,MediaServer 似乎并未下发此字段,Web 端暂不启用
|
|
478
|
-
* @deprecated
|
|
497
|
+
* PK 邀请超时时间,默认 30s
|
|
479
498
|
*/
|
|
480
|
-
|
|
481
|
-
}
|
|
482
|
-
/**
|
|
483
|
-
* 向房间内发布的媒体数据
|
|
484
|
-
*/
|
|
485
|
-
interface IPublishedResource extends IResource {
|
|
499
|
+
private readonly _inviteTimeout;
|
|
486
500
|
/**
|
|
487
|
-
*
|
|
501
|
+
* PK 房间信息
|
|
488
502
|
*/
|
|
489
|
-
|
|
503
|
+
private _appListener;
|
|
504
|
+
private _mainRoomId;
|
|
490
505
|
/**
|
|
491
|
-
*
|
|
506
|
+
* 跨房间连麦加入的 PK 房间
|
|
492
507
|
*/
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
interface ISubscribeAttr {
|
|
508
|
+
private _joinedPKRooms;
|
|
509
|
+
constructor(_PKInfo: IPKInfo, _context: RTCPluginContext, _runtime: IRuntime, _service: RCMediaService, _initOptions: IRCRTCInitOptions,
|
|
496
510
|
/**
|
|
497
|
-
*
|
|
511
|
+
* 主直播房间
|
|
498
512
|
*/
|
|
499
|
-
|
|
513
|
+
_mainLivingRoom: RCLivingRoom, _registerPKMsgListener: (listener: IOnRecvPKMsg) => void,
|
|
500
514
|
/**
|
|
501
|
-
*
|
|
515
|
+
* 加入 PK 房间回调
|
|
502
516
|
*/
|
|
503
|
-
|
|
504
|
-
}
|
|
505
|
-
/**
|
|
506
|
-
* 视频配置
|
|
507
|
-
*/
|
|
508
|
-
interface IVideoProfile {
|
|
517
|
+
_onJoinedPKRoom: (roomId: string, room: RCLivingRoom) => void,
|
|
509
518
|
/**
|
|
510
|
-
*
|
|
519
|
+
* 退出 PK 房间回调
|
|
511
520
|
*/
|
|
512
|
-
|
|
521
|
+
_onLeavePKRoom: (roomId: string) => void);
|
|
522
|
+
private _callAppListener;
|
|
513
523
|
/**
|
|
514
|
-
*
|
|
524
|
+
* 收到连麦邀请
|
|
515
525
|
*/
|
|
516
|
-
|
|
517
|
-
}
|
|
518
|
-
/**
|
|
519
|
-
* 屏幕共享流配置
|
|
520
|
-
*/
|
|
521
|
-
interface IScreenVideoProfile extends IVideoProfile {
|
|
526
|
+
private _onInvite;
|
|
522
527
|
/**
|
|
523
|
-
*
|
|
524
|
-
* @see `https://www.electronjs.org/docs/api/desktop-capturer`
|
|
528
|
+
* 收到取消连麦
|
|
525
529
|
*/
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
/**
|
|
529
|
-
* 待发布资源数据
|
|
530
|
-
*/
|
|
531
|
-
interface IPublishAttrs {
|
|
530
|
+
private _onCancelInvite;
|
|
531
|
+
private _onInviteTimeout;
|
|
532
532
|
/**
|
|
533
|
-
*
|
|
533
|
+
* 收到响应连麦
|
|
534
534
|
*/
|
|
535
|
-
|
|
535
|
+
private _onInviteAnswer;
|
|
536
536
|
/**
|
|
537
|
-
*
|
|
537
|
+
* 收到连麦结束
|
|
538
538
|
*/
|
|
539
|
-
|
|
540
|
-
}
|
|
541
|
-
/**
|
|
542
|
-
* peerConnection 抛出给用户的 track 字段
|
|
543
|
-
*/
|
|
544
|
-
interface IRCTrackStat {
|
|
539
|
+
private _onPKEnd;
|
|
545
540
|
/**
|
|
546
|
-
*
|
|
547
|
-
|
|
548
|
-
|
|
541
|
+
* 处理跨房间连麦相关消息
|
|
542
|
+
*/
|
|
543
|
+
private _onRecvPKMsg;
|
|
549
544
|
/**
|
|
550
|
-
*
|
|
545
|
+
* 注册跨房间连麦监听事件
|
|
551
546
|
*/
|
|
552
|
-
|
|
547
|
+
registerRoomPKEventListener(listener: IRoomPKEventListener): void;
|
|
553
548
|
/**
|
|
554
|
-
*
|
|
549
|
+
* 发起跨房间连麦请求
|
|
550
|
+
* @param inviteeRoomId 被邀请者所处的房间 roomId
|
|
551
|
+
* @param inviteeUserId 被邀请者 userId
|
|
552
|
+
* @param options.autoMix 是否要把邀请者发布的资源,合并到被邀请者房间内的 MCU 流中
|
|
553
|
+
* @param options.extra 拓展字段,可随邀请连麦消息透传给被邀请者
|
|
555
554
|
*/
|
|
556
|
-
|
|
555
|
+
requestJoinOtherRoom(inviteeRoomId: string, inviteeUserId: string, options?: IReqResPKOptions): Promise<{
|
|
556
|
+
code: RCRTCCode | ErrorCode;
|
|
557
|
+
}>;
|
|
557
558
|
/**
|
|
558
|
-
*
|
|
559
|
+
* 取消跨房间连麦请求
|
|
560
|
+
* @param inviteeRoomId 被邀请者所处的房间 roomId
|
|
561
|
+
* @param inviteeUserId 被邀请者 userId
|
|
562
|
+
* @param extra 附加信息,可随取消邀请连麦消息透传给被邀请者
|
|
559
563
|
*/
|
|
560
|
-
|
|
564
|
+
cancelRequestJoinOtherRoom(inviteeRoomId: string, inviteeUserId: string, extra?: string): Promise<{
|
|
565
|
+
code: RCRTCCode | ErrorCode;
|
|
566
|
+
}>;
|
|
561
567
|
/**
|
|
562
|
-
*
|
|
568
|
+
* 响应跨房间连麦请求
|
|
569
|
+
* @param inviterRoomId 邀请者所处的房间 roomId
|
|
570
|
+
* @param inviterUserId 邀请者 userId
|
|
571
|
+
* @param agree 是否同意连麦
|
|
572
|
+
* @param options.autoMix 是否要把被邀请者发布的资源,合并到邀请者房间内的 MCU 流中
|
|
573
|
+
* @param options.extra 附加信息,可随响应连麦消息透传给邀请者
|
|
563
574
|
*/
|
|
564
|
-
|
|
575
|
+
responseJoinOtherRoom(inviterRoomId: string, inviterUserId: string, agree: boolean, options?: IReqResPKOptions): Promise<{
|
|
576
|
+
code: RCRTCCode | ErrorCode;
|
|
577
|
+
}>;
|
|
565
578
|
/**
|
|
566
|
-
*
|
|
579
|
+
* 结束跨房间连麦
|
|
580
|
+
* @param roomId 需要结束连麦的房间 roomId
|
|
567
581
|
*/
|
|
568
|
-
|
|
582
|
+
private _quitRoomPK;
|
|
583
|
+
private _relaseCrtRoom;
|
|
569
584
|
/**
|
|
570
|
-
*
|
|
585
|
+
* 加入副直播房间
|
|
586
|
+
* @roomId 副房间的 roomId
|
|
571
587
|
*/
|
|
572
|
-
|
|
588
|
+
joinOtherRoom(roomId: string): Promise<{
|
|
589
|
+
code: RCRTCCode;
|
|
590
|
+
room?: RCLivingRoom;
|
|
591
|
+
userIds?: string[];
|
|
592
|
+
tracks?: RCRemoteTrack[];
|
|
593
|
+
CDNEnable?: boolean;
|
|
594
|
+
}>;
|
|
573
595
|
/**
|
|
574
|
-
*
|
|
596
|
+
* 退出副房间
|
|
597
|
+
* @param room 要退出的副房间的 room 实例
|
|
598
|
+
* @param isQuitPK 是否要结束连麦
|
|
575
599
|
*/
|
|
576
|
-
|
|
600
|
+
leaveOtherRoom(room: RCLivingRoom, isQuitPK?: boolean): Promise<{
|
|
601
|
+
code: RCRTCCode;
|
|
602
|
+
}>;
|
|
603
|
+
private _leaveOtherRoom;
|
|
577
604
|
/**
|
|
578
|
-
*
|
|
605
|
+
* 获取连麦信息
|
|
606
|
+
* @param roomId 连麦房间的 roomId
|
|
579
607
|
*/
|
|
580
|
-
|
|
608
|
+
getPKInfo(roomId: string): {
|
|
609
|
+
inviteSessionId: string;
|
|
610
|
+
inviterRoomId: string;
|
|
611
|
+
inviterUserId: string;
|
|
612
|
+
inviterUserAutoMix?: boolean | undefined;
|
|
613
|
+
inviteeRoomId: string;
|
|
614
|
+
inviteeUserAutoMix?: boolean | undefined;
|
|
615
|
+
};
|
|
581
616
|
/**
|
|
582
|
-
*
|
|
617
|
+
* 获取所有连麦信息
|
|
583
618
|
*/
|
|
584
|
-
|
|
619
|
+
getAllPKInfo(): IPKInfo;
|
|
585
620
|
/**
|
|
586
|
-
*
|
|
587
|
-
* @description 下行数据中,同道流中只有一个 track 会有值,另一轨道数据值为 `0`
|
|
621
|
+
* 获取已加入的副房间
|
|
588
622
|
*/
|
|
589
|
-
|
|
623
|
+
getJoinedPKRooms(): {
|
|
624
|
+
[roomId: string]: RCLivingRoom;
|
|
625
|
+
};
|
|
590
626
|
}
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
*/
|
|
594
|
-
interface IRCCandidatePairStat {
|
|
627
|
+
|
|
628
|
+
declare class RCRTCPeerCManager {
|
|
595
629
|
/**
|
|
596
|
-
*
|
|
630
|
+
* 是否使用多 peerConnection
|
|
597
631
|
*/
|
|
598
|
-
|
|
632
|
+
private readonly _useMutilPeerC;
|
|
599
633
|
/**
|
|
600
|
-
*
|
|
634
|
+
* roomId 或观众端 userId
|
|
601
635
|
*/
|
|
602
|
-
|
|
636
|
+
private readonly _roomId;
|
|
603
637
|
/**
|
|
604
|
-
*
|
|
638
|
+
* 断线重连每一条 peerConnection
|
|
605
639
|
*/
|
|
606
|
-
|
|
640
|
+
private readonly _reTryExchange;
|
|
607
641
|
/**
|
|
608
|
-
*
|
|
642
|
+
* 北极星上报模块
|
|
609
643
|
*/
|
|
610
|
-
|
|
644
|
+
private readonly _polarisReport?;
|
|
611
645
|
/**
|
|
612
|
-
*
|
|
646
|
+
* 存储创建的所有 peerC,key 为 pcName
|
|
613
647
|
*/
|
|
614
|
-
|
|
648
|
+
private _mutilPeerC;
|
|
649
|
+
constructor(
|
|
615
650
|
/**
|
|
616
|
-
*
|
|
651
|
+
* 是否使用多 peerConnection
|
|
617
652
|
*/
|
|
618
|
-
|
|
653
|
+
_useMutilPeerC: boolean,
|
|
619
654
|
/**
|
|
620
|
-
*
|
|
655
|
+
* roomId 或观众端 userId
|
|
621
656
|
*/
|
|
622
|
-
|
|
657
|
+
_roomId: string,
|
|
623
658
|
/**
|
|
624
|
-
*
|
|
659
|
+
* 断线重连每一条 peerConnection
|
|
625
660
|
*/
|
|
626
|
-
|
|
661
|
+
_reTryExchange: Function,
|
|
627
662
|
/**
|
|
628
|
-
*
|
|
663
|
+
* 北极星上报模块
|
|
629
664
|
*/
|
|
630
|
-
|
|
665
|
+
_polarisReport?: PolarisReporter | undefined);
|
|
631
666
|
/**
|
|
632
|
-
*
|
|
667
|
+
* 根据 track 判断是否为上行
|
|
633
668
|
*/
|
|
634
|
-
|
|
669
|
+
private _isPub;
|
|
635
670
|
/**
|
|
636
|
-
*
|
|
671
|
+
* 按 tag 分 tracks
|
|
637
672
|
*/
|
|
638
|
-
|
|
639
|
-
}
|
|
640
|
-
/**
|
|
641
|
-
* iceCandidatePair 所有字段
|
|
642
|
-
* 含 peerConnection 抛出给用户的 iceCandidatePair 字段
|
|
643
|
-
* 含 北极星上报 R3、R4 所需的 totalPacketsLost
|
|
644
|
-
*/
|
|
645
|
-
interface IInnerIcePair extends IRCCandidatePairStat {
|
|
646
|
-
/**
|
|
647
|
-
* 上、下行总丢包率
|
|
648
|
-
*/
|
|
649
|
-
totalPacketsLost?: number;
|
|
650
|
-
}
|
|
651
|
-
/**
|
|
652
|
-
* send track 所有字段
|
|
653
|
-
* 含 peerConnection 抛出给用户的 track 字段
|
|
654
|
-
* 含 北极星上报 R3 track 所需字段
|
|
655
|
-
*/
|
|
656
|
-
interface ISendTrackState extends IRCTrackStat {
|
|
673
|
+
private _groupTracksByTag;
|
|
657
674
|
/**
|
|
658
|
-
*
|
|
675
|
+
* 按规则生成 pcName
|
|
676
|
+
* 单 peerC roomId_pub
|
|
677
|
+
* 多 peerC 上行: roomId_tag、下行: roomId_sub
|
|
678
|
+
* 观众加房间: roomId_sub
|
|
679
|
+
* 观众不加房间: userId_sub
|
|
680
|
+
* @param isPub 是否为上行、下行
|
|
681
|
+
* @param tag 多 peerC 时,上行需资源标识
|
|
659
682
|
*/
|
|
660
|
-
|
|
683
|
+
private _genPCName;
|
|
661
684
|
/**
|
|
662
|
-
*
|
|
685
|
+
* 创建一个 peerC
|
|
686
|
+
* @param pcName 使用的 peerConnection 名称
|
|
687
|
+
* @param tracks 本次要操作的资源
|
|
663
688
|
*/
|
|
664
|
-
|
|
689
|
+
private _createOnePeerCItem;
|
|
665
690
|
/**
|
|
666
|
-
*
|
|
691
|
+
* 创建一组 peerC
|
|
692
|
+
* @param pcName
|
|
693
|
+
* @returns
|
|
667
694
|
*/
|
|
668
|
-
|
|
695
|
+
createPeerCList(tracks: TrackParam[]): IMutilPeerC[];
|
|
669
696
|
/**
|
|
670
|
-
*
|
|
697
|
+
* 移除所有 peerConnection 的上行资源
|
|
671
698
|
*/
|
|
672
|
-
|
|
699
|
+
private _removeAllLocalTrack;
|
|
673
700
|
/**
|
|
674
|
-
*
|
|
701
|
+
* 销毁某一个 peerConnection
|
|
675
702
|
*/
|
|
676
|
-
|
|
703
|
+
destroyPeerC(pcName: string): void;
|
|
677
704
|
/**
|
|
678
|
-
*
|
|
705
|
+
* 销毁所有 peerConnection
|
|
679
706
|
*/
|
|
680
|
-
|
|
707
|
+
private _destroyAllPeerC;
|
|
681
708
|
/**
|
|
682
|
-
*
|
|
709
|
+
* 获取某一个 peerC
|
|
683
710
|
*/
|
|
684
|
-
|
|
711
|
+
getPCItemByPCName(pcName: string): {
|
|
712
|
+
/**
|
|
713
|
+
* /exchange 请求中 request header 中的 Peer-Connection-Id 值
|
|
714
|
+
*/
|
|
715
|
+
pcId: string;
|
|
716
|
+
/**
|
|
717
|
+
* RCRTCPeerConnection 对象
|
|
718
|
+
*/
|
|
719
|
+
pc: RCRTCPeerConnection;
|
|
720
|
+
/**
|
|
721
|
+
* 存放 peerConnection 上本次要发布、取消发布、订阅、取消订阅的 track
|
|
722
|
+
*/
|
|
723
|
+
tracks: TrackParam[];
|
|
724
|
+
/**
|
|
725
|
+
* 当前 peerC 是否为发上行的 peerConnection
|
|
726
|
+
*/
|
|
727
|
+
isPub: boolean;
|
|
728
|
+
/**
|
|
729
|
+
* peerConnection 上行资源,暂不需要
|
|
730
|
+
*/
|
|
731
|
+
publishList?: IPublishedResource[] | undefined;
|
|
732
|
+
/**
|
|
733
|
+
* peerConnection 下行资源,暂不需要
|
|
734
|
+
*/
|
|
735
|
+
subscribeList?: ISubscribeAttr[] | undefined;
|
|
736
|
+
};
|
|
685
737
|
/**
|
|
686
|
-
*
|
|
687
|
-
*/
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
738
|
+
* 根据 trackId 获取 peerConnection 对象
|
|
739
|
+
*/
|
|
740
|
+
getPCByTrackId(trackId: string, isPub?: boolean): RCRTCPeerConnection;
|
|
741
|
+
/**
|
|
742
|
+
* 获取所有的 peerConnection
|
|
743
|
+
*/
|
|
744
|
+
getPCList(): RCRTCPeerConnection[];
|
|
745
|
+
/**
|
|
746
|
+
* 获取存储的多 peerConnection 数据
|
|
747
|
+
*/
|
|
748
|
+
getMutilPeerCData(): {
|
|
749
|
+
[key: string]: {
|
|
750
|
+
/**
|
|
751
|
+
* /exchange 请求中 request header 中的 Peer-Connection-Id 值
|
|
752
|
+
*/
|
|
753
|
+
pcId: string;
|
|
754
|
+
/**
|
|
755
|
+
* RCRTCPeerConnection 对象
|
|
756
|
+
*/
|
|
757
|
+
pc: RCRTCPeerConnection;
|
|
758
|
+
/**
|
|
759
|
+
* 存放 peerConnection 上本次要发布、取消发布、订阅、取消订阅的 track
|
|
760
|
+
*/
|
|
761
|
+
tracks: TrackParam[];
|
|
762
|
+
/**
|
|
763
|
+
* 当前 peerC 是否为发上行的 peerConnection
|
|
764
|
+
*/
|
|
765
|
+
isPub: boolean;
|
|
766
|
+
/**
|
|
767
|
+
* peerConnection 上行资源,暂不需要
|
|
768
|
+
*/
|
|
769
|
+
publishList?: IPublishedResource[] | undefined;
|
|
770
|
+
/**
|
|
771
|
+
* peerConnection 下行资源,暂不需要
|
|
772
|
+
*/
|
|
773
|
+
subscribeList?: ISubscribeAttr[] | undefined;
|
|
774
|
+
};
|
|
775
|
+
};
|
|
776
|
+
setPeerCData(pcName: string, key: string, value: any): void;
|
|
696
777
|
/**
|
|
697
|
-
*
|
|
778
|
+
* 销毁资源
|
|
698
779
|
*/
|
|
699
|
-
|
|
700
|
-
samplingRate: number;
|
|
701
|
-
nackCount: number;
|
|
702
|
-
pliCount: number;
|
|
703
|
-
rtt: number | null;
|
|
704
|
-
googFirsReceived: number;
|
|
705
|
-
googRenderDelayMs: number;
|
|
706
|
-
trackState: TrackState;
|
|
780
|
+
clear(): void;
|
|
707
781
|
}
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
782
|
+
|
|
783
|
+
interface IPubSuccessRes {
|
|
784
|
+
code: RCRTCCode;
|
|
785
|
+
liveUrl?: string;
|
|
786
|
+
failedTracks?: {
|
|
787
|
+
code: RCRTCCode;
|
|
788
|
+
tracks: RCLocalTrack[];
|
|
789
|
+
}[];
|
|
716
790
|
}
|
|
717
791
|
/**
|
|
718
|
-
*
|
|
719
|
-
* peerConnection stats 抛给用户的字段
|
|
792
|
+
* 房间抽象基类
|
|
720
793
|
*/
|
|
721
|
-
|
|
794
|
+
declare abstract class RCAbstractRoom {
|
|
795
|
+
protected readonly _context: RTCPluginContext;
|
|
796
|
+
private readonly _runtime;
|
|
797
|
+
readonly _roomId: string;
|
|
798
|
+
protected readonly _roomMode: RTCMode;
|
|
799
|
+
protected readonly _service: RCMediaService;
|
|
800
|
+
protected readonly _initOptions: IRCRTCInitOptions;
|
|
801
|
+
private readonly _ntfClearRoomItem;
|
|
802
|
+
protected _isMainRoom?: boolean | undefined;
|
|
722
803
|
/**
|
|
723
|
-
*
|
|
804
|
+
* 是否使用多 peerConnection
|
|
724
805
|
*/
|
|
725
|
-
|
|
806
|
+
protected readonly _useMutilPeerC?: boolean | undefined;
|
|
726
807
|
/**
|
|
727
|
-
*
|
|
808
|
+
* 房间资源数据
|
|
728
809
|
*/
|
|
729
|
-
|
|
810
|
+
protected readonly _roomResources: RoomData;
|
|
730
811
|
/**
|
|
731
|
-
*
|
|
812
|
+
* 远端 track
|
|
732
813
|
*/
|
|
733
|
-
|
|
814
|
+
private _remoteTracks;
|
|
734
815
|
/**
|
|
735
|
-
*
|
|
816
|
+
* 已订阅参数
|
|
736
817
|
*/
|
|
737
|
-
|
|
738
|
-
}
|
|
739
|
-
interface IRCRTCReportListener {
|
|
818
|
+
protected readonly _subscribedList: ISubscribeAttr[];
|
|
740
819
|
/**
|
|
741
|
-
*
|
|
742
|
-
* @param report
|
|
820
|
+
* 房间保活 rtcPing
|
|
743
821
|
*/
|
|
744
|
-
|
|
822
|
+
private readonly _pinger;
|
|
745
823
|
/**
|
|
746
|
-
*
|
|
747
|
-
* @since version 5.1.5
|
|
824
|
+
* 与 MediaServer 交互需要的 token 信息
|
|
748
825
|
*/
|
|
749
|
-
|
|
826
|
+
protected readonly _token: string;
|
|
750
827
|
/**
|
|
751
|
-
*
|
|
828
|
+
* 每次加入房间后都会改变
|
|
752
829
|
*/
|
|
753
|
-
|
|
754
|
-
}
|
|
755
|
-
interface IRCRTCTrackEventListener {
|
|
830
|
+
private readonly _sessionId;
|
|
756
831
|
/**
|
|
757
|
-
*
|
|
758
|
-
* @param track RCRemoteTrack 类实例
|
|
832
|
+
* PeerConnection 连接实例
|
|
759
833
|
*/
|
|
760
|
-
|
|
761
|
-
}
|
|
762
|
-
interface IRoomEventListener extends IRCRTCTrackEventListener {
|
|
834
|
+
protected _destroyed: boolean;
|
|
763
835
|
/**
|
|
764
|
-
*
|
|
765
|
-
* 引起连接异常中断的原因包括但不限于:电脑休眠、浏览器页面长期后台运行等
|
|
766
|
-
* @since 5.1.5
|
|
836
|
+
* 北极星上报实例
|
|
767
837
|
*/
|
|
768
|
-
|
|
838
|
+
protected _polarisReport: PolarisReporter | null;
|
|
769
839
|
/**
|
|
770
|
-
*
|
|
771
|
-
* @description 被踢出房间可能是由于服务端超出一定时间未能收到 rtcPing 消息,所以认为己方离线。
|
|
772
|
-
* 另一种可能是己方 rtcPing 失败次数超出上限
|
|
773
|
-
* @param byServer 当值为 `false` 时,说明本端 rtcPing 超时;当值为 `true` 时,说明本端收到被踢出房间通知
|
|
840
|
+
* 音量上报实例
|
|
774
841
|
*/
|
|
775
|
-
|
|
842
|
+
private _audioLevelReport;
|
|
776
843
|
/**
|
|
777
|
-
*
|
|
778
|
-
* @param name 信令名
|
|
779
|
-
* @param content 信令内容
|
|
780
|
-
* @param senderUserId 发送者 Id
|
|
781
|
-
* @param messageUId 消息唯一标识
|
|
844
|
+
* peerConnection 管理类
|
|
782
845
|
*/
|
|
783
|
-
|
|
846
|
+
protected _peerCManager: RCRTCPeerCManager | null;
|
|
847
|
+
constructor(_context: RTCPluginContext, _runtime: IRuntime, _roomId: string, data: IJoinRTCRoomData, _roomMode: RTCMode, _service: RCMediaService, _initOptions: IRCRTCInitOptions, _ntfClearRoomItem: Function, isUpgrade?: boolean, _isMainRoom?: boolean | undefined,
|
|
784
848
|
/**
|
|
785
|
-
*
|
|
786
|
-
* @param name
|
|
787
|
-
* @param content
|
|
849
|
+
* 是否使用多 peerConnection
|
|
788
850
|
*/
|
|
789
|
-
|
|
851
|
+
_useMutilPeerC?: boolean | undefined);
|
|
852
|
+
private _initRemoteTracks;
|
|
853
|
+
private _handlePingResult;
|
|
790
854
|
/**
|
|
791
|
-
*
|
|
792
|
-
* @
|
|
855
|
+
* 设置房间上行资源的总码率配置
|
|
856
|
+
* @description
|
|
857
|
+
* * 自 v5.1.0 版本开始,推荐使用 `RCLocalTrack.setBitrate` 对不同流分别指定码率。
|
|
858
|
+
* * 该方法仅在 SDP `plan-b` 协议下(Chrome 92 与 Safari 11 之前的版本)有效。
|
|
859
|
+
* @param max 音视频发送码率上限,不可小于 200 且不可小于 `min`
|
|
860
|
+
* @param min 音视频发送码率下限,默认值为 1,且不可小于 1,不可大于 `max`
|
|
861
|
+
* @param start 起始码率,默认为码率上限的 70%
|
|
793
862
|
*/
|
|
794
|
-
|
|
863
|
+
setBitrate(max: number, min: number, start?: number): void;
|
|
864
|
+
private _onTrackReady;
|
|
865
|
+
protected _callAppListener(eventType: keyof IRoomEventListener, ...attrs: any[]): void;
|
|
866
|
+
private _onUserUnpublish;
|
|
867
|
+
private _onTrackUnpublish;
|
|
868
|
+
private _unpublishPrev;
|
|
869
|
+
__parseInnerMessage(message: IReceivedMessage): boolean;
|
|
870
|
+
private msgTaskQueue;
|
|
795
871
|
/**
|
|
796
|
-
*
|
|
797
|
-
* @param
|
|
872
|
+
* 被踢出房间通知
|
|
873
|
+
* @param byServer
|
|
874
|
+
* * 当值为 false 时,说明本端 rtcPing 超时
|
|
875
|
+
* * 当值为 true 时,说明本端收到被踢出房间通知
|
|
798
876
|
*/
|
|
799
|
-
|
|
877
|
+
private _kickoff;
|
|
878
|
+
private _rtcpeerClosed;
|
|
800
879
|
/**
|
|
801
|
-
*
|
|
802
|
-
* @param
|
|
880
|
+
* 处理资源变更事件
|
|
881
|
+
* @param content
|
|
882
|
+
* @param messageType 消息类型
|
|
883
|
+
* @param userId 消息发送者
|
|
803
884
|
*/
|
|
804
|
-
|
|
885
|
+
protected _resourceHandle(content: {
|
|
886
|
+
/**
|
|
887
|
+
* 旧版本兼容参数,当收到非 `RTCMessageName.TOTAL_CONTENT_RESOURCE` 时:
|
|
888
|
+
* * ignore 值为 `true` 表示该消息由 signal server 向旧版本 RTCLib 提供的兼容消息,无需处理
|
|
889
|
+
* * 否则认为该消息是由旧版本 RTCLib 主动发出的增量变更消息,需要处理
|
|
890
|
+
*/
|
|
891
|
+
ignore?: boolean;
|
|
892
|
+
/**
|
|
893
|
+
* 发布到房间内的资源列表,`RTCMessageName.TOTAL_CONTENT_RESOURCE` 消息携带全量数据,否则为增量数据
|
|
894
|
+
*/
|
|
895
|
+
uris: IPublishedResource[];
|
|
896
|
+
}, messageType: string, userId: string): Promise<void>;
|
|
897
|
+
private _onTrackPublish;
|
|
805
898
|
/**
|
|
806
|
-
*
|
|
807
|
-
* @param
|
|
808
|
-
* @description 当资源被取消发布时,SDK 内部会取消对相关资源的订阅,业务层仅需处理 UI 业务
|
|
899
|
+
* 处理 `RCRTCMessageType.STATE` 消息
|
|
900
|
+
* @param content
|
|
809
901
|
*/
|
|
810
|
-
|
|
902
|
+
private _stateHandle;
|
|
811
903
|
/**
|
|
812
|
-
*
|
|
813
|
-
* @param userIds 加入的人员 id 列表
|
|
904
|
+
* 获取房间 Id
|
|
814
905
|
*/
|
|
815
|
-
|
|
906
|
+
getRoomId(): string;
|
|
816
907
|
/**
|
|
817
|
-
*
|
|
818
|
-
* @param userIds
|
|
908
|
+
* 获取当前 userId
|
|
819
909
|
*/
|
|
820
|
-
|
|
910
|
+
getCrtUserId(): string;
|
|
821
911
|
/**
|
|
822
|
-
*
|
|
912
|
+
* 获取 _pc 实例
|
|
823
913
|
*/
|
|
824
|
-
|
|
914
|
+
__getPC(): RCRTCPeerConnection[];
|
|
825
915
|
/**
|
|
826
|
-
*
|
|
827
|
-
* @since version: 5.1.5
|
|
916
|
+
* 获取远程用户列表,不包含当前用户
|
|
828
917
|
*/
|
|
829
|
-
|
|
918
|
+
getRemoteUserIds(): string[];
|
|
830
919
|
/**
|
|
831
|
-
*
|
|
920
|
+
* 获取所有房间已发布的远端资源列表
|
|
921
|
+
* @returns
|
|
832
922
|
*/
|
|
833
|
-
|
|
834
|
-
}
|
|
835
|
-
/**
|
|
836
|
-
* RTCClient 初始化配置
|
|
837
|
-
* @public
|
|
838
|
-
*/
|
|
839
|
-
interface IRCRTCInitOptions {
|
|
923
|
+
getRemoteTracks(): RCRemoteTrack[];
|
|
840
924
|
/**
|
|
841
|
-
*
|
|
842
|
-
* @
|
|
843
|
-
*
|
|
844
|
-
* 2. 当该值有效时,将不再从 IMLib 导航数据中获取 mediaServer 地址
|
|
925
|
+
* 获取远端用户的资源列表
|
|
926
|
+
* @param userId
|
|
927
|
+
* @returns
|
|
845
928
|
*/
|
|
846
|
-
|
|
929
|
+
getRemoteTracksByUserId(userId: string): RCRemoteTrack[];
|
|
847
930
|
/**
|
|
848
|
-
*
|
|
849
|
-
* @description
|
|
850
|
-
* * 0 - DEBUG
|
|
851
|
-
* * 1 - INFO
|
|
852
|
-
* * 2 - WARN
|
|
853
|
-
* * 3 - ERROR
|
|
931
|
+
* 获取房间当前会话 Id,当房间内已无成员时房间会回收,重新加入时 sessionId 将更新
|
|
854
932
|
*/
|
|
855
|
-
|
|
933
|
+
getSessionId(): string;
|
|
856
934
|
/**
|
|
857
|
-
*
|
|
858
|
-
|
|
859
|
-
|
|
935
|
+
* 向房间内发消息
|
|
936
|
+
* @param name 消息名称
|
|
937
|
+
* @param content 消息内容
|
|
938
|
+
*/
|
|
939
|
+
sendMessage(name: string, content: any): Promise<{
|
|
940
|
+
code: RCRTCCode;
|
|
941
|
+
}>;
|
|
860
942
|
/**
|
|
861
|
-
*
|
|
862
|
-
*
|
|
943
|
+
* 设置房间属性
|
|
944
|
+
* @param key 属性名
|
|
945
|
+
* @param value 属性值
|
|
946
|
+
* @param message 是否在设置属性的时候携带消息内容,传空则不往房间中发送消息
|
|
947
|
+
* @param isInner RTC 业务内部使用参数,用户忽略
|
|
863
948
|
*/
|
|
864
|
-
|
|
949
|
+
setRoomAttribute(key: string, value: string, message?: {
|
|
950
|
+
name: string;
|
|
951
|
+
content: string;
|
|
952
|
+
}, isInner?: boolean): Promise<{
|
|
953
|
+
code: RCRTCCode;
|
|
954
|
+
}>;
|
|
865
955
|
/**
|
|
866
|
-
*
|
|
956
|
+
* 删除房间属性
|
|
957
|
+
* @param keys 待删除的属性名数组
|
|
958
|
+
* @param message 是否在删除属性的时候携带消息内容,传空则不往房间中发送消息
|
|
959
|
+
* @param isInner RTC 业务内部使用参数,用户忽略
|
|
867
960
|
*/
|
|
868
|
-
|
|
961
|
+
deleteRoomAttributes(keys: string[], message?: {
|
|
962
|
+
name: string;
|
|
963
|
+
content: string;
|
|
964
|
+
}, isInner?: boolean): Promise<{
|
|
965
|
+
code: RCRTCCode;
|
|
966
|
+
}>;
|
|
869
967
|
/**
|
|
870
|
-
*
|
|
968
|
+
* 获取房间属性
|
|
969
|
+
* @param keys 要查询的属性名数组,当数组长度为空时,取所有已设置的 kv 值
|
|
970
|
+
* @param isInner RTC 业务内部使用参数,用户忽略
|
|
871
971
|
*/
|
|
872
|
-
|
|
972
|
+
getRoomAttributes(keys?: string[], isInner?: boolean): Promise<{
|
|
973
|
+
code: RCRTCCode;
|
|
974
|
+
data?: KVString;
|
|
975
|
+
}>;
|
|
873
976
|
/**
|
|
874
|
-
*
|
|
977
|
+
* 设置当前用户属性(暂不开放)
|
|
978
|
+
* @param key 属性名
|
|
979
|
+
* @param value 属性值
|
|
980
|
+
* @param message 是否在设置属性的时候携带消息内容,传空则不往房间中发送消息
|
|
875
981
|
*/
|
|
876
|
-
|
|
982
|
+
private _setUserAttributeValue;
|
|
877
983
|
/**
|
|
878
|
-
*
|
|
984
|
+
* 删除当前用户属性(暂不开放)
|
|
985
|
+
* @param keys 待删除的属性名数组
|
|
986
|
+
* @param message 是否在删除属性的时候携带消息内容,传空则不往房间中发送消息
|
|
879
987
|
*/
|
|
880
|
-
|
|
881
|
-
}
|
|
882
|
-
interface ICameraVideoProfile extends IVideoProfile {
|
|
883
|
-
cameraId?: string;
|
|
884
|
-
faceMode?: 'user' | 'environment';
|
|
885
|
-
}
|
|
886
|
-
interface IMicphoneAudioProfile {
|
|
887
|
-
micphoneId?: string;
|
|
888
|
-
sampleRate?: number;
|
|
889
|
-
}
|
|
890
|
-
interface ICreateLocalTrackOptions {
|
|
988
|
+
private _deleteUserAttributes;
|
|
891
989
|
/**
|
|
892
|
-
*
|
|
990
|
+
* 获取当前用户属性(暂不开放)
|
|
991
|
+
* @param keys 要查询的属性名数组
|
|
893
992
|
*/
|
|
894
|
-
|
|
993
|
+
private _getUserAttributes;
|
|
895
994
|
/**
|
|
896
|
-
*
|
|
995
|
+
* 查询房间是否已销毁
|
|
897
996
|
*/
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
/**
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
997
|
+
isDestroyed(): boolean;
|
|
998
|
+
/**
|
|
999
|
+
* 退出并销毁当前房间实例,退出后该房间的所有方法将不可用
|
|
1000
|
+
*/
|
|
1001
|
+
__destroy(quitRoom: boolean): Promise<void>;
|
|
1002
|
+
private _leaveHandle;
|
|
1003
|
+
/**
|
|
1004
|
+
* 释放 PCManager 上的资源
|
|
1005
|
+
*/
|
|
1006
|
+
private _releasePCManager;
|
|
1007
|
+
private _onLocalTrackDestroied;
|
|
1008
|
+
/**
|
|
1009
|
+
* 本端流状态修改,需通知房间内其他成员
|
|
1010
|
+
* @param localTrack
|
|
1011
|
+
*/
|
|
1012
|
+
private _onLocalTrackMuted;
|
|
1013
|
+
/**
|
|
1014
|
+
* 从 pc 移除当次发布失败的资源
|
|
1015
|
+
*/
|
|
1016
|
+
private _removePubFailedTracks;
|
|
1017
|
+
/**
|
|
1018
|
+
* 增量发布资源,若发布的资源 tag 及媒体类型重复,后者将覆盖前者进行发布。
|
|
1019
|
+
* @param tracks 待发布的 RCLocalTrack 实例
|
|
1020
|
+
* @returns
|
|
1021
|
+
*/
|
|
1022
|
+
publish(tracks: (RCLocalTrack | IPublishAttrs)[]): Promise<IPubSuccessRes>;
|
|
1023
|
+
private __publish;
|
|
1024
|
+
/**
|
|
1025
|
+
* 处理批量 /exhcange 的返回数据,作为一次 publish 接口返回
|
|
1026
|
+
* @param pubResList 每一个 tag 的发布结果[]
|
|
1027
|
+
*/
|
|
1028
|
+
private _mergePublishRes;
|
|
1029
|
+
/**
|
|
1030
|
+
* 获取跨房间连麦需携带参数 pushOtherRooms 的值
|
|
1031
|
+
*/
|
|
1032
|
+
protected _getPushOtherRoomsParams(): IPushOtherRooms[];
|
|
1033
|
+
/**
|
|
1034
|
+
* ice 断线后,尝试重新走 exchange
|
|
1035
|
+
*/
|
|
1036
|
+
protected _reTryExchange(pcName: string, isPub: boolean): Promise<void>;
|
|
1037
|
+
protected _exchangeHandle(body: IExchangeReqBody, pcId: string): Promise<{
|
|
1038
|
+
code: RCRTCCode;
|
|
1039
|
+
data?: IExchangeResponse | undefined;
|
|
1040
|
+
}>;
|
|
1041
|
+
protected _getRTCReqestHeaders(pcId?: string): IRTCReqHeader;
|
|
1042
|
+
/**
|
|
1043
|
+
* 获取 exchange 接口的请求体数据
|
|
1044
|
+
* @param subscribeList 订阅清单
|
|
1045
|
+
* @param iceRestart
|
|
1046
|
+
*/
|
|
1047
|
+
protected _createExchangeParams(subscribeList: ISubscribeAttr[], iceRestart: boolean, pc: RCRTCPeerConnection): Promise<IExchangeReqBody>;
|
|
1048
|
+
/**
|
|
1049
|
+
* 获取已发布资源的 state 数据
|
|
1050
|
+
* @param trackId
|
|
1051
|
+
*/
|
|
1052
|
+
private _getResourceState;
|
|
1053
|
+
/**
|
|
1054
|
+
* 增量取消资源发布,若相应资源中存在小流资源,则同时取消发布
|
|
1055
|
+
* @param tracks 取消发布的 RCLocalTrack 列表
|
|
1056
|
+
*/
|
|
1057
|
+
unpublish(tracks: RCLocalTrack[]): Promise<IPubSuccessRes>;
|
|
1058
|
+
private __unpublish;
|
|
1059
|
+
private _mergeUnpublishRes;
|
|
1060
|
+
/**
|
|
1061
|
+
* 根据资源 Id 获取资源数据
|
|
1062
|
+
* @param resourceId
|
|
1063
|
+
*/
|
|
1064
|
+
private _getResourceById;
|
|
1065
|
+
/**
|
|
1066
|
+
* resourceId 有效性验证
|
|
1067
|
+
* @param resourceId
|
|
1068
|
+
*/
|
|
1069
|
+
protected _isValidResourceId(resourceId: string): boolean;
|
|
1070
|
+
/**
|
|
1071
|
+
* 订阅资源
|
|
1072
|
+
* @param tracks
|
|
1073
|
+
*/
|
|
1074
|
+
subscribe(tracks: (RCRemoteTrack | ISubscribeAttr)[]): Promise<{
|
|
1075
|
+
code: RCRTCCode;
|
|
1076
|
+
failedList?: ISubscribeAttr[];
|
|
1077
|
+
}>;
|
|
1078
|
+
private __subscribe;
|
|
1079
|
+
/**
|
|
1080
|
+
* 取消订阅资源
|
|
1081
|
+
* @param tracks 预取消远端资源
|
|
1082
|
+
*/
|
|
1083
|
+
unsubscribe(tracks: RCRemoteTrack[]): Promise<{
|
|
1084
|
+
code: RCRTCCode;
|
|
1085
|
+
failedList?: ISubscribeAttr[];
|
|
1086
|
+
}>;
|
|
1087
|
+
private __unsubscribe;
|
|
1088
|
+
protected _assertRoomDestroyed(): RCRTCCode | undefined;
|
|
1089
|
+
/**
|
|
1090
|
+
* 获取已发布的本地资源
|
|
1091
|
+
* @param trackId
|
|
1092
|
+
* @returns
|
|
1093
|
+
*/
|
|
1094
|
+
getLocalTrack(trackId: string): RCLocalTrack | null;
|
|
1095
|
+
/**
|
|
1096
|
+
* 获取所有已发布的资源
|
|
1097
|
+
*/
|
|
1098
|
+
getLocalTracks(): RCLocalTrack[];
|
|
1099
|
+
/**
|
|
1100
|
+
* 根据 trackId 获取房间内的远端资源
|
|
1101
|
+
* @param trackId
|
|
1102
|
+
* @returns
|
|
1103
|
+
*/
|
|
1104
|
+
getRemoteTrack(trackId: string): RCRemoteTrack | null;
|
|
1105
|
+
/**
|
|
1106
|
+
* 强制修改订阅列表,仅订阅数组中的资源,取消订阅其他已订阅资源。
|
|
1107
|
+
* 当参数为 `[]` 时,意味着不再订阅任何资源
|
|
1108
|
+
* @param tracks 变更的资源列表
|
|
1109
|
+
*/
|
|
1110
|
+
updateSubList(tracks: (RCRemoteTrack | ISubscribeAttr)[]): Promise<{
|
|
1111
|
+
code: RCRTCCode;
|
|
1112
|
+
}>;
|
|
1113
|
+
private _updateSubListHandle;
|
|
1114
|
+
private _appListener;
|
|
1115
|
+
/**
|
|
1116
|
+
* 注册事件监听器,多次注册会导致后者覆盖前者,可以通过使用 `registerRoomEventListener(null)` 取消注册
|
|
1117
|
+
* @param listener
|
|
1118
|
+
*/
|
|
1119
|
+
registerRoomEventListener(listener: IRoomEventListener | null): void;
|
|
1120
|
+
private _reportListener;
|
|
1121
|
+
/**
|
|
1122
|
+
* 注册房间数据监控
|
|
1123
|
+
* @param listener
|
|
1124
|
+
* @description 该方法暂仅支持 Chrome 浏览器
|
|
1125
|
+
*/
|
|
1126
|
+
registerReportListener(listener: IRCRTCReportListener | null): void;
|
|
1127
|
+
/**
|
|
1128
|
+
* 音量上报
|
|
1129
|
+
* @param handler 业务端传入的音量上报事件
|
|
1130
|
+
* @param gap 上报时间间隔
|
|
1131
|
+
*/
|
|
1132
|
+
onAudioLevelChange(handler: IAudioLevelChangeHandler | null, gap?: number): void;
|
|
1133
|
+
/**
|
|
1134
|
+
* 断线重连后尝试补发断线过程中的通知信息
|
|
1135
|
+
*/
|
|
1136
|
+
__onReconnected(livingType?: RCLivingType): Promise<{
|
|
1137
|
+
data: IJoinRTCRoomData | undefined;
|
|
1138
|
+
} | void>;
|
|
1139
|
+
private _onAudioMuteChange;
|
|
1140
|
+
private _onVideoMuteChange;
|
|
1141
|
+
/**
|
|
1142
|
+
* 观众切换为主播后直接处理人员变更及资源变更
|
|
1143
|
+
*/
|
|
1144
|
+
protected _afterChangedRole(data: IJoinRTCRoomData): void;
|
|
1145
|
+
/**
|
|
1146
|
+
* 销毁远端资源
|
|
1147
|
+
*/
|
|
1148
|
+
private _removeRemoteTracks;
|
|
1149
|
+
/**
|
|
1150
|
+
* 存储连麦监听事件
|
|
1151
|
+
*/
|
|
1152
|
+
private _onRecvPKMsg;
|
|
1153
|
+
/**
|
|
1154
|
+
* 注册 PK 业务监听方法
|
|
1155
|
+
*/
|
|
1156
|
+
protected _registerPKMsgListener(listener: IOnRecvPKMsg | null): void;
|
|
1157
|
+
/**
|
|
1158
|
+
* 退出 PK 房间
|
|
1159
|
+
*/
|
|
1160
|
+
protected _quitAllPKRoom(): void;
|
|
927
1161
|
}
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
1162
|
+
|
|
1163
|
+
declare class RCLocalMediaStream {
|
|
1164
|
+
readonly msid: string;
|
|
1165
|
+
readonly mediaStream: MediaStream;
|
|
1166
|
+
readonly tinyStream: MediaStream;
|
|
1167
|
+
readonly tag: string;
|
|
1168
|
+
constructor(msid: string);
|
|
934
1169
|
}
|
|
935
|
-
|
|
1170
|
+
|
|
1171
|
+
interface IAudienceRoomEventListener extends IRCRTCTrackEventListener {
|
|
936
1172
|
/**
|
|
937
|
-
*
|
|
1173
|
+
* 主播加入
|
|
1174
|
+
* @param userIds 加入主播的 id 列表
|
|
938
1175
|
*/
|
|
939
|
-
|
|
1176
|
+
onAnchorJoin?(userId: string[]): void;
|
|
940
1177
|
/**
|
|
941
|
-
*
|
|
1178
|
+
* 主播退出
|
|
1179
|
+
* @param userIds 退出主播的 id 列表
|
|
942
1180
|
*/
|
|
943
|
-
|
|
944
|
-
}
|
|
945
|
-
interface IPKInviteeBaseInfo {
|
|
1181
|
+
onAnchorLeave?(userId: string[]): void;
|
|
946
1182
|
/**
|
|
947
|
-
*
|
|
1183
|
+
* 房间内合流发布资源
|
|
1184
|
+
* @param tracks 新发布的合流音轨与视轨数据列表,包含新发布的 RCRemoteAudioTrack 与 RCRemoteVideoTrack 实例
|
|
1185
|
+
* @description
|
|
1186
|
+
* 当房间内某个主播第一次发布资源时触发
|
|
948
1187
|
*/
|
|
949
|
-
|
|
1188
|
+
onTrackPublish?(tracks: RCRemoteTrack[]): void;
|
|
950
1189
|
/**
|
|
951
|
-
*
|
|
1190
|
+
* 房间内取消合流发布资源
|
|
1191
|
+
* @param tracks 被取消发布的合流音轨与视轨数据列表
|
|
1192
|
+
* @description
|
|
1193
|
+
* 当房间内全部主播退出房间时,SDK 内部会取消对资源的订阅,业务层仅需处理 UI 业务
|
|
952
1194
|
*/
|
|
953
|
-
|
|
954
|
-
}
|
|
955
|
-
/**
|
|
956
|
-
* 业务层监听收到连麦邀请、取消连麦的字段
|
|
957
|
-
*/
|
|
958
|
-
interface IPKInviteInfo extends IPKInviterBaseInfo {
|
|
1195
|
+
onTrackUnpublish?(tracks: RCRemoteTrack[]): void;
|
|
959
1196
|
/**
|
|
960
|
-
*
|
|
1197
|
+
* 房间内主播发布资源
|
|
1198
|
+
* @param tracks 主播新发布的音轨与视轨数据列表,包含新发布的 RCRemoteAudioTrack 与 RCRemoteVideoTrack 实例
|
|
961
1199
|
*/
|
|
962
|
-
|
|
1200
|
+
onAnchorTrackPublish?(tracks: RCRemoteTrack[]): void;
|
|
1201
|
+
/**
|
|
1202
|
+
* 房间内主播取消发布资源
|
|
1203
|
+
* @param tracks 被主播取消发布的音轨与视轨数据列表
|
|
1204
|
+
* @description 当资源被取消发布时,SDK 内部会取消对相关资源的订阅,业务层仅需处理 UI 业务
|
|
1205
|
+
*/
|
|
1206
|
+
onAnchorTrackUnpublish?(tracks: RCRemoteTrack[]): void;
|
|
1207
|
+
/**
|
|
1208
|
+
* 房间主播禁用/启用音频
|
|
1209
|
+
* @param audioTrack RCRemoteAudioTrack 类实例
|
|
1210
|
+
*/
|
|
1211
|
+
onAudioMuteChange?(audioTrack: RCRemoteAudioTrack): void;
|
|
1212
|
+
/**
|
|
1213
|
+
* 房间主播禁用/启用视频
|
|
1214
|
+
* @param videoTrack RCRemoteVideoTrack 类实例对象
|
|
1215
|
+
*/
|
|
1216
|
+
onVideoMuteChange?(videoTrack: RCRemoteVideoTrack): void;
|
|
1217
|
+
/**
|
|
1218
|
+
* 房间内主播把发布的资源推至 CDN
|
|
1219
|
+
*/
|
|
1220
|
+
onCDNInfoEnable?(CDNInfo: {
|
|
1221
|
+
resolution: RCResolution;
|
|
1222
|
+
fps: RCFrameRate;
|
|
1223
|
+
}): void;
|
|
1224
|
+
/**
|
|
1225
|
+
* 主播停止推 CDN
|
|
1226
|
+
*/
|
|
1227
|
+
onCDNInfoDisable?(): void;
|
|
1228
|
+
/**
|
|
1229
|
+
* 主播改变推 CDN 的分辨率或帧率
|
|
1230
|
+
*/
|
|
1231
|
+
onCDNInfoChange?(CDNInfo: {
|
|
1232
|
+
resolution: RCResolution;
|
|
1233
|
+
fps: RCFrameRate;
|
|
1234
|
+
}): void;
|
|
963
1235
|
}
|
|
964
1236
|
/**
|
|
965
|
-
*
|
|
1237
|
+
* 观众直播房间类
|
|
1238
|
+
* 处理:
|
|
1239
|
+
* 1、通知观众房间内 人员变更、资源变更
|
|
1240
|
+
* 2、观众订阅、取消订阅资源
|
|
966
1241
|
*/
|
|
967
|
-
|
|
1242
|
+
declare class RCAudienceLivingRoom {
|
|
1243
|
+
private readonly _context;
|
|
1244
|
+
private readonly _runtime;
|
|
1245
|
+
private readonly _initOptions;
|
|
1246
|
+
readonly _roomId: string;
|
|
1247
|
+
private readonly _joinResData;
|
|
1248
|
+
readonly _livingType: RCLivingType;
|
|
1249
|
+
private _useMutilPeerC?;
|
|
1250
|
+
private readonly _service;
|
|
968
1251
|
/**
|
|
969
|
-
*
|
|
1252
|
+
* 主播列表
|
|
970
1253
|
*/
|
|
971
|
-
|
|
1254
|
+
private _roomAnchorList;
|
|
972
1255
|
/**
|
|
973
|
-
*
|
|
1256
|
+
* 合流、分流资源
|
|
974
1257
|
*/
|
|
975
|
-
|
|
976
|
-
}
|
|
977
|
-
/**
|
|
978
|
-
* 业务层监听收到连麦结束的字段
|
|
979
|
-
*/
|
|
980
|
-
interface IPKEndInfo {
|
|
1258
|
+
private _roomRes;
|
|
981
1259
|
/**
|
|
982
|
-
*
|
|
1260
|
+
* 主播分流资源
|
|
983
1261
|
*/
|
|
984
|
-
|
|
1262
|
+
private _roomAnchorRes;
|
|
985
1263
|
/**
|
|
986
|
-
*
|
|
1264
|
+
* 合流、分流 remoteTracks
|
|
987
1265
|
*/
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
resolution?: RCResolution;
|
|
995
|
-
fps?: RCFrameRate;
|
|
996
|
-
CDNEnable?: boolean;
|
|
997
|
-
}
|
|
998
|
-
|
|
999
|
-
declare enum RCInnerCDNPushMode {
|
|
1000
|
-
AUTOMATIC = 0,
|
|
1001
|
-
MANUAL = 1
|
|
1002
|
-
}
|
|
1003
|
-
|
|
1004
|
-
declare enum RCInnerCDNBroadcast {
|
|
1005
|
-
SPREAD = 0,
|
|
1006
|
-
NO_SPREAD = -1
|
|
1007
|
-
}
|
|
1008
|
-
|
|
1009
|
-
/**
|
|
1010
|
-
* 与 MediaServer 交互所需的 Request Header 信息
|
|
1011
|
-
*/
|
|
1012
|
-
interface IRTCReqHeader {
|
|
1266
|
+
private _remoteTracks;
|
|
1267
|
+
private _appListener;
|
|
1268
|
+
private _pc;
|
|
1269
|
+
private _subscribedList;
|
|
1270
|
+
private _sessionId;
|
|
1271
|
+
private _destroyed;
|
|
1013
1272
|
/**
|
|
1014
|
-
*
|
|
1015
|
-
* @todo 有效期问题处理
|
|
1273
|
+
* 北极星上报实例
|
|
1016
1274
|
*/
|
|
1017
|
-
|
|
1275
|
+
protected _polarisReport: PolarisReporter | null;
|
|
1018
1276
|
/**
|
|
1019
|
-
*
|
|
1277
|
+
* 音量上报实例
|
|
1020
1278
|
*/
|
|
1021
|
-
|
|
1279
|
+
private _audioLevelReport;
|
|
1022
1280
|
/**
|
|
1023
|
-
*
|
|
1281
|
+
* cdn_uris 资源
|
|
1024
1282
|
*/
|
|
1025
|
-
|
|
1283
|
+
private _CDNUris;
|
|
1026
1284
|
/**
|
|
1027
|
-
*
|
|
1285
|
+
* 使用的 peerConnection 对应 id
|
|
1028
1286
|
*/
|
|
1029
|
-
|
|
1287
|
+
private _pcId;
|
|
1030
1288
|
/**
|
|
1031
|
-
*
|
|
1032
|
-
|
|
1033
|
-
|
|
1289
|
+
* peerConnection 管理类
|
|
1290
|
+
*/
|
|
1291
|
+
private _peerCManager;
|
|
1292
|
+
constructor(_context: RTCPluginContext, _runtime: IRuntime, _initOptions: IRCRTCInitOptions, _roomId: string, _joinResData: {
|
|
1293
|
+
token: string;
|
|
1294
|
+
kvEntries: IServerRTCRoomEntry[];
|
|
1295
|
+
}, _livingType: RCLivingType, _useMutilPeerC?: boolean | undefined);
|
|
1034
1296
|
/**
|
|
1035
|
-
*
|
|
1297
|
+
* 解析服务端返回的 KV 数据,赋值 room 内数据
|
|
1036
1298
|
*/
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
interface IMCUReqHeaders {
|
|
1040
|
-
'App-Key': string;
|
|
1041
|
-
Token: string;
|
|
1042
|
-
RoomId: string;
|
|
1043
|
-
UserId: string;
|
|
1044
|
-
SessionId: string;
|
|
1045
|
-
}
|
|
1046
|
-
/**
|
|
1047
|
-
* exchange 接口的请求体结构
|
|
1048
|
-
*/
|
|
1049
|
-
interface IExchangeReqBody {
|
|
1299
|
+
private _setInitData;
|
|
1300
|
+
protected _assertRoomDestroyed(): RCRTCCode | undefined;
|
|
1050
1301
|
/**
|
|
1051
|
-
*
|
|
1302
|
+
* @description 信令数据处理
|
|
1303
|
+
* @param roomId 数据对应的房间 Id
|
|
1304
|
+
* @param singalData 拉取到的数据
|
|
1305
|
+
* * key RC_ANCHOR_LIST value: 为主播 ID 集合
|
|
1306
|
+
* * key RC_RES_`userId` value: 为主播发布的资源
|
|
1307
|
+
* * key RC_RTC_SESSIONID value: sessionId
|
|
1308
|
+
* * key RC_CDN value: CDN 资源数据
|
|
1052
1309
|
*/
|
|
1053
|
-
|
|
1310
|
+
private singalDataChange;
|
|
1054
1311
|
/**
|
|
1055
|
-
*
|
|
1312
|
+
* 计算加入离开的主播 ID 列表
|
|
1056
1313
|
*/
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
*/
|
|
1061
|
-
uri: string;
|
|
1062
|
-
/**
|
|
1063
|
-
* 大小流订阅,`1` 为大流,`2` 为小流,默认使用大流
|
|
1064
|
-
*/
|
|
1065
|
-
simulcast: RCStreamType;
|
|
1066
|
-
/**
|
|
1067
|
-
* 分辨率信息
|
|
1068
|
-
*/
|
|
1069
|
-
resolution: string;
|
|
1070
|
-
}[];
|
|
1314
|
+
private _diffAnchorList;
|
|
1315
|
+
private _handleNewJoinedAnchor;
|
|
1316
|
+
private _handleLeftedAnchor;
|
|
1071
1317
|
/**
|
|
1072
|
-
*
|
|
1073
|
-
* @example `{"resolutionInfo":[{"trackId":"021ad6e8-a50c-479c-96c8-5f3f09d2352d","simulcast":1,"resolution":"640x480"}]}`
|
|
1318
|
+
* 计算新发布和取消发布的合流资源
|
|
1074
1319
|
*/
|
|
1075
|
-
|
|
1320
|
+
private _diffRoomResource;
|
|
1076
1321
|
/**
|
|
1077
|
-
*
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
*/
|
|
1083
|
-
roomId: string;
|
|
1084
|
-
/**
|
|
1085
|
-
* 是否默认合流
|
|
1086
|
-
*/
|
|
1087
|
-
autoMix: boolean;
|
|
1088
|
-
/**
|
|
1089
|
-
* 房间 Id 对应的 SessionId
|
|
1090
|
-
*/
|
|
1091
|
-
sessionId: string;
|
|
1092
|
-
}[];
|
|
1322
|
+
* 计算主播发布和取消发布的资源,以及资源的状态变更
|
|
1323
|
+
*/
|
|
1324
|
+
private _diffAnchorResource;
|
|
1325
|
+
private _onUserUnpublish;
|
|
1326
|
+
private _callAppListener;
|
|
1093
1327
|
/**
|
|
1094
|
-
*
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
}
|
|
1098
|
-
interface ILiveUrls {
|
|
1328
|
+
* ice 断线后,尝试重新走 exchange
|
|
1329
|
+
*/
|
|
1330
|
+
private _reTryExchange;
|
|
1099
1331
|
/**
|
|
1100
|
-
*
|
|
1332
|
+
* 获取 subscribe 接口的请求体数据
|
|
1333
|
+
* @param subscribeList 订阅清单
|
|
1334
|
+
* @param publishedStreams 已发布流
|
|
1335
|
+
* @param iceRestart
|
|
1101
1336
|
*/
|
|
1102
|
-
|
|
1337
|
+
protected _createSubscribeParams(subscribeList: ISubscribeAttr[], publishedStreams: {
|
|
1338
|
+
[msid: string]: RCLocalMediaStream;
|
|
1339
|
+
}, iceRestart: boolean): Promise<{
|
|
1340
|
+
reqBody: IBroadcastSubReqBody;
|
|
1341
|
+
offer: RTCSessionDescriptionInit;
|
|
1342
|
+
dynamicBitrate: {
|
|
1343
|
+
min: number;
|
|
1344
|
+
max: number;
|
|
1345
|
+
};
|
|
1346
|
+
}>;
|
|
1347
|
+
private _subscribeHandle;
|
|
1103
1348
|
/**
|
|
1104
|
-
*
|
|
1349
|
+
* 添加 peerConnection 事件
|
|
1105
1350
|
*/
|
|
1106
|
-
|
|
1351
|
+
private _addPeerCEvent;
|
|
1352
|
+
private _getReqHeaders;
|
|
1353
|
+
private _exchangeHandle;
|
|
1354
|
+
private _updateSubListHandle;
|
|
1107
1355
|
/**
|
|
1108
|
-
*
|
|
1356
|
+
* 对比 cdn_uris 资源
|
|
1357
|
+
* @param newCDNUris 新的 cdn_uris 数据
|
|
1109
1358
|
*/
|
|
1110
|
-
|
|
1111
|
-
}
|
|
1112
|
-
interface IRTCResponse {
|
|
1359
|
+
private _diffCDNUris;
|
|
1113
1360
|
/**
|
|
1114
|
-
*
|
|
1361
|
+
* 获取 CDN 资源对应的拉流地址
|
|
1362
|
+
* _CDNUris 无 url 时,说明未开启 CDN 推送
|
|
1363
|
+
* @returns CDNPlayUrl
|
|
1115
1364
|
*/
|
|
1116
|
-
|
|
1365
|
+
private _getCDNPlayUrl;
|
|
1117
1366
|
/**
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1367
|
+
* 获取 CDN 资源对应的拉流地址
|
|
1368
|
+
* @returns CDNPlayUrl
|
|
1369
|
+
*/
|
|
1370
|
+
getCDNPlayUrl(resolution?: RCResolution, fps?: RCFrameRate): Promise<{
|
|
1371
|
+
code: RCRTCCode;
|
|
1372
|
+
CDNPlayUrl?: string;
|
|
1373
|
+
}>;
|
|
1121
1374
|
/**
|
|
1122
|
-
*
|
|
1375
|
+
* 订阅资源
|
|
1376
|
+
* @param tracks
|
|
1123
1377
|
*/
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
interface IExchangeResponse extends IRTCResponse {
|
|
1378
|
+
subscribe(tracks: (RCRemoteTrack | ISubscribeAttr)[]): Promise<{
|
|
1379
|
+
code: RCRTCCode;
|
|
1380
|
+
failedList?: ISubscribeAttr[];
|
|
1381
|
+
}>;
|
|
1382
|
+
private __unsubscribe;
|
|
1130
1383
|
/**
|
|
1131
|
-
*
|
|
1384
|
+
* 取消订阅资源
|
|
1385
|
+
* @param tracks
|
|
1132
1386
|
*/
|
|
1133
|
-
|
|
1387
|
+
unsubscribe(tracks: RCRemoteTrack[]): Promise<{
|
|
1388
|
+
code: RCRTCCode;
|
|
1389
|
+
failedList?: ISubscribeAttr[];
|
|
1390
|
+
}>;
|
|
1134
1391
|
/**
|
|
1135
|
-
*
|
|
1392
|
+
* 退出房间并销毁当前房间实例,退出后该房间的所有方法将不可用
|
|
1136
1393
|
*/
|
|
1137
|
-
|
|
1394
|
+
__destroy(quitRoom: boolean): Promise<void>;
|
|
1138
1395
|
/**
|
|
1139
|
-
*
|
|
1396
|
+
* 根据 trackId 获取房间内的远端资源
|
|
1397
|
+
* @param trackId
|
|
1140
1398
|
*/
|
|
1141
|
-
|
|
1399
|
+
getRemoteTrack(trackId: string): RCRemoteTrack;
|
|
1142
1400
|
/**
|
|
1143
|
-
*
|
|
1401
|
+
* 获取 _pc 实例
|
|
1144
1402
|
*/
|
|
1145
|
-
|
|
1146
|
-
type: 'answer';
|
|
1147
|
-
sdp: string;
|
|
1148
|
-
};
|
|
1403
|
+
__getPC(): RCRTCPeerConnection[];
|
|
1149
1404
|
/**
|
|
1150
|
-
*
|
|
1405
|
+
* TODO 待优化
|
|
1406
|
+
* @param trackId
|
|
1151
1407
|
*/
|
|
1152
|
-
|
|
1408
|
+
getLocalTrack(trackId: string): RCRemoteTrack;
|
|
1153
1409
|
/**
|
|
1154
|
-
*
|
|
1410
|
+
* 断线重连后处理逻辑, SDK 内部处理调用
|
|
1155
1411
|
*/
|
|
1156
|
-
|
|
1157
|
-
[roomId: string]: ILiveUrls;
|
|
1158
|
-
};
|
|
1412
|
+
__onReconnected(): Promise<void>;
|
|
1159
1413
|
/**
|
|
1160
|
-
*
|
|
1161
|
-
*
|
|
1414
|
+
* 观众房间事件注册
|
|
1415
|
+
* @param tag 参数描述
|
|
1162
1416
|
*/
|
|
1163
|
-
|
|
1417
|
+
registerRoomEventListener(listener: IAudienceRoomEventListener | null): void;
|
|
1164
1418
|
/**
|
|
1165
|
-
*
|
|
1419
|
+
* 音量上报
|
|
1420
|
+
* @param handler 业务端传入的音量上报事件
|
|
1421
|
+
* @param gap 上报时间间隔
|
|
1166
1422
|
*/
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
msid: string;
|
|
1170
|
-
userId: string;
|
|
1171
|
-
simulcast?: RCStreamType;
|
|
1172
|
-
}[];
|
|
1173
|
-
}
|
|
1174
|
-
interface IBroadcastSubReqBody {
|
|
1423
|
+
onAudioLevelChange(handler: IAudioLevelChangeHandler | null, gap?: number): void;
|
|
1424
|
+
private _reportListener;
|
|
1175
1425
|
/**
|
|
1176
|
-
*
|
|
1426
|
+
* 注册房间数据监控
|
|
1427
|
+
* @param listener
|
|
1177
1428
|
*/
|
|
1178
|
-
|
|
1179
|
-
type: 'offer';
|
|
1180
|
-
sdp: string;
|
|
1181
|
-
};
|
|
1429
|
+
registerReportListener(listener: IRCRTCReportListener | null): void;
|
|
1182
1430
|
/**
|
|
1183
|
-
*
|
|
1431
|
+
* 获取房间 Id
|
|
1184
1432
|
*/
|
|
1185
|
-
|
|
1433
|
+
getRoomId(): string;
|
|
1186
1434
|
/**
|
|
1187
|
-
*
|
|
1435
|
+
* 获取当前 userId
|
|
1188
1436
|
*/
|
|
1189
|
-
|
|
1437
|
+
getCrtUserId(): string;
|
|
1190
1438
|
/**
|
|
1191
|
-
*
|
|
1439
|
+
* 获取房间当前会话 Id,当房间内已无成员时房间会回收,重新加入时 sessionId 将更新
|
|
1192
1440
|
*/
|
|
1193
|
-
|
|
1441
|
+
getSessionId(): string;
|
|
1194
1442
|
/**
|
|
1195
|
-
*
|
|
1443
|
+
* 获取远程主播用户列表
|
|
1196
1444
|
*/
|
|
1197
|
-
|
|
1445
|
+
getRemoteUserIds(): string[];
|
|
1198
1446
|
/**
|
|
1199
|
-
*
|
|
1447
|
+
* 获取远端用户的资源列表
|
|
1448
|
+
* @param userId
|
|
1449
|
+
* @returns
|
|
1200
1450
|
*/
|
|
1201
|
-
|
|
1202
|
-
/**
|
|
1203
|
-
* 流资源 uri
|
|
1204
|
-
*/
|
|
1205
|
-
uri: string;
|
|
1206
|
-
/**
|
|
1207
|
-
* 大小流订阅,`1` 为大流,`2` 为小流,默认使用大流
|
|
1208
|
-
*/
|
|
1209
|
-
simulcast: RCStreamType;
|
|
1210
|
-
/**
|
|
1211
|
-
* 分辨率信息
|
|
1212
|
-
*/
|
|
1213
|
-
resolution: string;
|
|
1214
|
-
}[];
|
|
1451
|
+
getRemoteTracksByUserId(userId: string): RCRemoteTrack[];
|
|
1215
1452
|
/**
|
|
1216
|
-
*
|
|
1453
|
+
* 获取房间内所有已发布的远端资源列表, 包含合流资源
|
|
1454
|
+
* @returns
|
|
1217
1455
|
*/
|
|
1218
|
-
|
|
1219
|
-
}
|
|
1220
|
-
interface IBroadcastSubRespBody extends IRTCResponse {
|
|
1456
|
+
getRemoteTracks(): RCRemoteTrack[];
|
|
1221
1457
|
/**
|
|
1222
|
-
*
|
|
1458
|
+
* 获取远端 RTC tracks
|
|
1223
1459
|
*/
|
|
1224
|
-
|
|
1460
|
+
getRemoteRTCTracks(): RCRemoteTrack[];
|
|
1225
1461
|
/**
|
|
1226
|
-
*
|
|
1462
|
+
* 获取远端 MCU tracks
|
|
1227
1463
|
*/
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
*/
|
|
1241
|
-
interface ICDNPlayUrlResponse extends IRTCResponse {
|
|
1242
|
-
data: {
|
|
1243
|
-
fps: number;
|
|
1244
|
-
h: number;
|
|
1245
|
-
'pull_url': string;
|
|
1246
|
-
w: number;
|
|
1464
|
+
getRemoteMCUTracks(): RCRemoteTrack[];
|
|
1465
|
+
/**
|
|
1466
|
+
* 获取房间内 CDN 信息
|
|
1467
|
+
*/
|
|
1468
|
+
getCDNInfo(): {
|
|
1469
|
+
resolution: RCResolution;
|
|
1470
|
+
fps: RCFrameRate;
|
|
1471
|
+
CDNEnable: boolean | undefined;
|
|
1472
|
+
} | {
|
|
1473
|
+
CDNEnable: boolean;
|
|
1474
|
+
resolution?: undefined;
|
|
1475
|
+
fps?: undefined;
|
|
1247
1476
|
};
|
|
1248
1477
|
}
|
|
1478
|
+
|
|
1249
1479
|
/**
|
|
1250
|
-
*
|
|
1480
|
+
* 北极星上报角色
|
|
1251
1481
|
*/
|
|
1252
|
-
|
|
1482
|
+
declare enum PolarisRole {
|
|
1253
1483
|
/**
|
|
1254
|
-
*
|
|
1484
|
+
* 会议参会者、主播
|
|
1255
1485
|
*/
|
|
1256
|
-
|
|
1486
|
+
MeetingOrAnchor = 1,
|
|
1257
1487
|
/**
|
|
1258
|
-
*
|
|
1488
|
+
* 观众
|
|
1259
1489
|
*/
|
|
1260
|
-
|
|
1490
|
+
Audience = 2
|
|
1491
|
+
}
|
|
1492
|
+
|
|
1493
|
+
declare class PolarisReporter {
|
|
1494
|
+
private readonly _context;
|
|
1495
|
+
private readonly _runtime;
|
|
1496
|
+
private readonly _roomId;
|
|
1497
|
+
private readonly _crtRTCRoom;
|
|
1498
|
+
private readonly _userRole;
|
|
1499
|
+
constructor(_context: RTCPluginContext, _runtime: IRuntime, _roomId: string, _crtRTCRoom: RCAbstractRoom | RCAudienceLivingRoom, _userRole?: PolarisRole);
|
|
1500
|
+
private _send;
|
|
1501
|
+
private _getClientID;
|
|
1261
1502
|
/**
|
|
1262
|
-
*
|
|
1503
|
+
* 小流需去掉 _tiny,小流 resourceId 为 userId_tag_mediaType_tiny
|
|
1263
1504
|
*/
|
|
1264
|
-
|
|
1265
|
-
/**
|
|
1266
|
-
* 帧率
|
|
1267
|
-
*/
|
|
1268
|
-
fps?: number;
|
|
1505
|
+
private _getRealResourceId;
|
|
1269
1506
|
/**
|
|
1270
|
-
*
|
|
1507
|
+
* 生成北极星上报的 trackId
|
|
1508
|
+
* @param resourceId userId_11_1_tiny 改为 userId_11_tiny_video
|
|
1271
1509
|
*/
|
|
1272
|
-
|
|
1510
|
+
private _getPolarisTrackId;
|
|
1511
|
+
sendR3R4Data(data: IInnerRCRTCStateReport): void;
|
|
1273
1512
|
/**
|
|
1274
|
-
*
|
|
1513
|
+
* 加入房间
|
|
1275
1514
|
*/
|
|
1276
|
-
|
|
1515
|
+
sendR1(): void;
|
|
1277
1516
|
/**
|
|
1278
|
-
*
|
|
1517
|
+
* RTC 和 LIVE 发布、取消发布
|
|
1518
|
+
* RTC 订阅、取消订阅
|
|
1279
1519
|
*/
|
|
1280
|
-
|
|
1281
|
-
'pull_safe': boolean;
|
|
1520
|
+
sendR2(action: string, status: string, trackIds: string[]): void;
|
|
1282
1521
|
}
|
|
1283
1522
|
|
|
1284
1523
|
/**
|
|
1285
|
-
*
|
|
1524
|
+
* PC 实例管理类
|
|
1286
1525
|
*/
|
|
1287
|
-
declare
|
|
1526
|
+
declare class RCRTCPeerConnection extends EventEmitter {
|
|
1288
1527
|
/**
|
|
1289
|
-
*
|
|
1528
|
+
* peerConnection 对应名称
|
|
1529
|
+
*/
|
|
1530
|
+
private readonly _pcName;
|
|
1531
|
+
/**
|
|
1532
|
+
* _reTryExchange 方法
|
|
1290
1533
|
*/
|
|
1291
|
-
|
|
1534
|
+
private readonly _reTryExchange;
|
|
1292
1535
|
/**
|
|
1293
|
-
*
|
|
1536
|
+
* 北极星上传实例
|
|
1294
1537
|
*/
|
|
1295
|
-
|
|
1538
|
+
private readonly _polarisReport?;
|
|
1539
|
+
static __INNER_EVENT_TRACK_READY__: string;
|
|
1540
|
+
private readonly _rtcPeerConn;
|
|
1541
|
+
private readonly _sdpStrategy;
|
|
1542
|
+
reportParser: IStatParser | null;
|
|
1543
|
+
private pubLocalTracks;
|
|
1544
|
+
private _reTryExchangeTimer;
|
|
1545
|
+
private _reportStatsTimer;
|
|
1546
|
+
constructor(
|
|
1296
1547
|
/**
|
|
1297
|
-
*
|
|
1548
|
+
* peerConnection 对应名称
|
|
1549
|
+
*/
|
|
1550
|
+
_pcName: string,
|
|
1551
|
+
/**
|
|
1552
|
+
* _reTryExchange 方法
|
|
1298
1553
|
*/
|
|
1299
|
-
|
|
1300
|
-
}
|
|
1301
|
-
|
|
1302
|
-
/**
|
|
1303
|
-
* 合流布局对视频的填充模式
|
|
1304
|
-
*/
|
|
1305
|
-
declare enum MixVideoRenderMode {
|
|
1554
|
+
_reTryExchange: Function,
|
|
1306
1555
|
/**
|
|
1307
|
-
*
|
|
1556
|
+
* 北极星上传实例
|
|
1308
1557
|
*/
|
|
1309
|
-
|
|
1558
|
+
_polarisReport?: PolarisReporter | undefined);
|
|
1559
|
+
getLocalTracks(): RCLocalTrack[];
|
|
1560
|
+
private _onConnectionStateChange;
|
|
1561
|
+
private _onICEConnectionStateChange;
|
|
1562
|
+
private _onTrackReady;
|
|
1563
|
+
setBitrate(max: number, min: number, start?: number): Promise<void>;
|
|
1564
|
+
createOffer(iceRestart: boolean): Promise<IOfferInfo>;
|
|
1565
|
+
setRemoteAnswer(answer: string): Promise<RCRTCCode>;
|
|
1566
|
+
getLocalTrack(trackId: string): RCLocalTrack | null;
|
|
1567
|
+
addLocalTrack(track: RCLocalTrack): void;
|
|
1568
|
+
removeLocalTrackById(trackId: string): void;
|
|
1569
|
+
removeAllLocalTrack(): void;
|
|
1570
|
+
removeLocalTrack(track: RCLocalTrack): void;
|
|
1571
|
+
private _updateRecvTransceiverMap;
|
|
1572
|
+
updateSubRemoteTracks(remoteTracks: RCRemoteTrack[]): void;
|
|
1310
1573
|
/**
|
|
1311
|
-
*
|
|
1574
|
+
* 获取当前已发布视频流信息
|
|
1312
1575
|
*/
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
OPEN = 1,
|
|
1318
|
-
STOP = 2
|
|
1319
|
-
}
|
|
1320
|
-
|
|
1321
|
-
declare enum RCMixInputFilterMode {
|
|
1322
|
-
/** 全合流,后续加入房间的用户会自动合流 */
|
|
1323
|
-
AUDIO_VIDEO_ALL = 0,
|
|
1324
|
-
/** 全不合流,后续加入本房间的用户 */
|
|
1325
|
-
AUDIO_VIDEO_NO = 1,
|
|
1326
|
-
/** 音频全订阅, 视频全不订阅 */
|
|
1327
|
-
AUDIO_ALL_VIDEO_NO = 2,
|
|
1328
|
-
/** 视频全订阅, 音频全不订阅 */
|
|
1329
|
-
AUDIO_NO_VIDEO_ALL = 3,
|
|
1576
|
+
getOutboundVideoInfo(): OutboundVideoInfo[];
|
|
1577
|
+
private _onLocalTrackMuted;
|
|
1578
|
+
private _onLocalTrackDestroied;
|
|
1579
|
+
private _reportListener;
|
|
1330
1580
|
/**
|
|
1331
|
-
*
|
|
1581
|
+
* 注册连接数据监控,开启质量数据上报定时器
|
|
1582
|
+
* @param listener
|
|
1332
1583
|
*/
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
AUDIO_ALL_VIDEO_INPUT = 5,
|
|
1336
|
-
/** 音频全不订阅, 视频根据input里面的视频项订阅 */
|
|
1337
|
-
AUDIO_NO_VIDEO_INPUT = 6,
|
|
1338
|
-
/** 视频全订阅, 音频根据input里面的音频项订阅 */
|
|
1339
|
-
AUDIO_INPUT_VIDEO_ALL = 7,
|
|
1340
|
-
/** 视频全不订阅, 音频根据input里面的音频项订阅 */
|
|
1341
|
-
AUDIO_INPUT_VIDEO_NO = 8,
|
|
1342
|
-
/** 按房间列表订阅音视频(保留当前已经订阅的, 但没在房间列表里的音视频) */
|
|
1343
|
-
ROOM_AUDIO_VIDEO_APPEND = 9,
|
|
1344
|
-
/** 按房间列表订阅音视频(清理当前已经订阅的, 但没在房间列表里的音视频) */
|
|
1345
|
-
ROOM_AUDIO_VIDEO_NOT_APPEND = 10,
|
|
1346
|
-
/** 按房间列表订阅音频, 不订阅视频(保留当前已经订阅的, 但没在房间列表里的音频) */
|
|
1347
|
-
ROOM_AUDIO_APPEND = 11,
|
|
1348
|
-
/** 按房间列表订阅音视, 不订阅视频(清理当前已经订阅的, 但没在房间列表里的音频) */
|
|
1349
|
-
ROOM_AUDIO_NOT_APPEND = 12,
|
|
1350
|
-
/** 按房间列表订阅视频, 不订阅音频(保留当前已经订阅的, 但没在房间列表里的视频) */
|
|
1351
|
-
ROOM_VIDEO_APPEND = 13,
|
|
1352
|
-
/** 按房间列表订阅视频, 不订阅音频(清理当前已经订阅的, 但没在房间列表里的视频) */
|
|
1353
|
-
ROOM_VIDEO_NOT_APPEND = 14
|
|
1354
|
-
}
|
|
1355
|
-
|
|
1356
|
-
/**
|
|
1357
|
-
* 合流后的 video 输出编码配置,包含分辨率、帧率、码率配置项
|
|
1358
|
-
*/
|
|
1359
|
-
interface IMCUOutputVideoAttrs {
|
|
1584
|
+
registerReportListener(listener: IRCRTCReportListener | null): void;
|
|
1585
|
+
private _createRCRTCStateReport;
|
|
1360
1586
|
/**
|
|
1361
|
-
*
|
|
1587
|
+
* 获取 peerConnection stats 数据并格式化
|
|
1588
|
+
* @returns 返回格式化后的数据
|
|
1589
|
+
*/
|
|
1590
|
+
private _getStatsData;
|
|
1591
|
+
getAudioLevelReportData(): Promise<{
|
|
1592
|
+
trackId: string;
|
|
1593
|
+
audioLevel: number | null;
|
|
1594
|
+
}[] | undefined>;
|
|
1595
|
+
/**
|
|
1596
|
+
* 通知用户质量数据、peerConnection 北极星数据上报
|
|
1597
|
+
* @todo
|
|
1362
1598
|
*/
|
|
1363
|
-
|
|
1599
|
+
private _reportHandle;
|
|
1600
|
+
getRTCPeerConn(): RTCPeerConnection;
|
|
1601
|
+
destroy(): void;
|
|
1602
|
+
clearReTryExchangeTimer(): void;
|
|
1603
|
+
}
|
|
1604
|
+
|
|
1605
|
+
interface IRCTrackBitrate {
|
|
1364
1606
|
/**
|
|
1365
|
-
*
|
|
1607
|
+
* 最大码率
|
|
1366
1608
|
*/
|
|
1367
|
-
|
|
1609
|
+
max: number;
|
|
1368
1610
|
/**
|
|
1369
|
-
*
|
|
1611
|
+
* 最小码率
|
|
1370
1612
|
*/
|
|
1371
|
-
|
|
1613
|
+
min: number;
|
|
1372
1614
|
/**
|
|
1373
|
-
*
|
|
1615
|
+
* 上行起始码率
|
|
1374
1616
|
*/
|
|
1375
|
-
|
|
1376
|
-
}
|
|
1377
|
-
/**
|
|
1378
|
-
* 合并入 MCU 的音频流
|
|
1379
|
-
*/
|
|
1380
|
-
interface IMCUInputAudio {
|
|
1381
|
-
user_id: string;
|
|
1382
|
-
stream_id: string;
|
|
1383
|
-
}
|
|
1384
|
-
/**
|
|
1385
|
-
* 自定义布局中的单一视频流布局
|
|
1386
|
-
*/
|
|
1387
|
-
interface IMCUInputVideoLayout {
|
|
1388
|
-
user_id: string;
|
|
1389
|
-
stream_id: string;
|
|
1390
|
-
x: number;
|
|
1391
|
-
y: number;
|
|
1392
|
-
width: number;
|
|
1393
|
-
height: number;
|
|
1617
|
+
start?: number;
|
|
1394
1618
|
}
|
|
1395
1619
|
/**
|
|
1396
|
-
*
|
|
1620
|
+
* MediaServer 返回的媒体资源数据
|
|
1397
1621
|
*/
|
|
1398
|
-
interface
|
|
1399
|
-
/**
|
|
1400
|
-
* 资源下载地址,需包含协议
|
|
1401
|
-
*/
|
|
1402
|
-
uri: string;
|
|
1622
|
+
interface IResource {
|
|
1403
1623
|
/**
|
|
1404
|
-
*
|
|
1624
|
+
* 媒体类型
|
|
1405
1625
|
*/
|
|
1406
|
-
|
|
1626
|
+
mediaType: RCMediaType.AUDIO_ONLY | RCMediaType.VIDEO_ONLY;
|
|
1407
1627
|
/**
|
|
1408
|
-
*
|
|
1628
|
+
* MediaStream Id,基本为 `userId` 与 `tag` 以 `_` 拼接而来。该值无法直接作为资源的唯一性标识属性,
|
|
1629
|
+
* 需与 mediaType 拼接使用
|
|
1409
1630
|
*/
|
|
1410
|
-
|
|
1631
|
+
msid: string;
|
|
1411
1632
|
/**
|
|
1412
|
-
*
|
|
1633
|
+
* MediaServer 返回的资源地址
|
|
1634
|
+
* @example 举例如下:
|
|
1635
|
+
* `{"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}`
|
|
1413
1636
|
*/
|
|
1414
|
-
|
|
1637
|
+
uri: string;
|
|
1415
1638
|
/**
|
|
1416
|
-
*
|
|
1639
|
+
* 资源特征,simulcast 代表这道流支持大小流
|
|
1640
|
+
* @description 此参数存疑,MediaServer 似乎并未下发此字段,Web 端暂不启用
|
|
1641
|
+
* @deprecated
|
|
1417
1642
|
*/
|
|
1418
|
-
|
|
1643
|
+
features?: ['simulcast'] | [];
|
|
1419
1644
|
}
|
|
1420
1645
|
/**
|
|
1421
|
-
*
|
|
1646
|
+
* 向房间内发布的媒体数据
|
|
1422
1647
|
*/
|
|
1423
|
-
interface
|
|
1648
|
+
interface IPublishedResource extends IResource {
|
|
1424
1649
|
/**
|
|
1425
|
-
*
|
|
1650
|
+
* 资源禁用/启用标识,用于向 signal 同步本端资源状态,1 为启用,0 为禁用
|
|
1426
1651
|
*/
|
|
1427
|
-
|
|
1652
|
+
state: 0 | 1;
|
|
1428
1653
|
/**
|
|
1429
|
-
*
|
|
1654
|
+
* 资源标识,同标识的资源将视作同道流,标识不可重复
|
|
1430
1655
|
*/
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
* 合流布局时,对视频流的填充方式
|
|
1435
|
-
*/
|
|
1436
|
-
renderMode: MixVideoRenderMode;
|
|
1437
|
-
};
|
|
1656
|
+
tag: string;
|
|
1657
|
+
}
|
|
1658
|
+
interface ISubscribeAttr {
|
|
1438
1659
|
/**
|
|
1439
|
-
*
|
|
1660
|
+
* 要订阅的音视轨数据 Id
|
|
1440
1661
|
*/
|
|
1441
|
-
|
|
1662
|
+
track: RCRemoteTrack;
|
|
1442
1663
|
/**
|
|
1443
|
-
*
|
|
1664
|
+
* 订阅小流,默认为 `false`
|
|
1444
1665
|
*/
|
|
1445
|
-
|
|
1446
|
-
/**
|
|
1447
|
-
* 填充模式:
|
|
1448
|
-
* 1. 按比例裁剪
|
|
1449
|
-
* 2. 不裁剪,按比例压缩
|
|
1450
|
-
*/
|
|
1451
|
-
fillMode: 1 | 2;
|
|
1452
|
-
/**
|
|
1453
|
-
* 资源列表
|
|
1454
|
-
*/
|
|
1455
|
-
picture: IPictureAttrs[];
|
|
1456
|
-
};
|
|
1666
|
+
subTiny?: boolean;
|
|
1457
1667
|
}
|
|
1458
1668
|
/**
|
|
1459
|
-
*
|
|
1669
|
+
* 视频配置
|
|
1460
1670
|
*/
|
|
1461
|
-
interface
|
|
1462
|
-
/**
|
|
1463
|
-
* 输出视频配置
|
|
1464
|
-
*/
|
|
1465
|
-
video: IMCUOutputVideoConfig;
|
|
1671
|
+
interface IVideoProfile {
|
|
1466
1672
|
/**
|
|
1467
|
-
*
|
|
1673
|
+
* 视频帧率
|
|
1468
1674
|
*/
|
|
1469
|
-
|
|
1470
|
-
/**
|
|
1471
|
-
* 音频码率
|
|
1472
|
-
*/
|
|
1473
|
-
bitrate: number;
|
|
1474
|
-
};
|
|
1675
|
+
frameRate: RCFrameRate;
|
|
1475
1676
|
/**
|
|
1476
|
-
*
|
|
1677
|
+
* 视频分辨率
|
|
1477
1678
|
*/
|
|
1478
|
-
|
|
1479
|
-
/**
|
|
1480
|
-
* 推流地址,如:`'rtmp://xxxx'`
|
|
1481
|
-
*/
|
|
1482
|
-
pushurl: string;
|
|
1483
|
-
}[];
|
|
1679
|
+
resolution: RCResolution;
|
|
1484
1680
|
}
|
|
1485
1681
|
/**
|
|
1486
|
-
*
|
|
1682
|
+
* 屏幕共享流配置
|
|
1487
1683
|
*/
|
|
1488
|
-
interface
|
|
1489
|
-
/**
|
|
1490
|
-
* 时区
|
|
1491
|
-
*/
|
|
1492
|
-
timezone: number;
|
|
1493
|
-
/**
|
|
1494
|
-
* 字体像素大小
|
|
1495
|
-
*/
|
|
1496
|
-
fontSize: number;
|
|
1497
|
-
/**
|
|
1498
|
-
* 字体颜色
|
|
1499
|
-
*/
|
|
1500
|
-
color: 'black' | 'white';
|
|
1684
|
+
interface IScreenVideoProfile extends IVideoProfile {
|
|
1501
1685
|
/**
|
|
1502
|
-
*
|
|
1686
|
+
* Electron 平台下通过 `desktopCapturer.getSources` 获取到的 sourceId,在 Electron 环境下为必填项。
|
|
1687
|
+
* @see `https://www.electronjs.org/docs/api/desktop-capturer`
|
|
1503
1688
|
*/
|
|
1504
|
-
|
|
1689
|
+
chromeMediaSourceId?: string;
|
|
1690
|
+
}
|
|
1691
|
+
/**
|
|
1692
|
+
* 待发布资源数据
|
|
1693
|
+
*/
|
|
1694
|
+
interface IPublishAttrs {
|
|
1505
1695
|
/**
|
|
1506
|
-
*
|
|
1696
|
+
* 待发布的轨道数据
|
|
1507
1697
|
*/
|
|
1508
|
-
|
|
1698
|
+
track: RCLocalTrack;
|
|
1509
1699
|
/**
|
|
1510
|
-
*
|
|
1700
|
+
* 是否同时发布小流
|
|
1511
1701
|
*/
|
|
1512
|
-
|
|
1702
|
+
pubTiny?: boolean | IVideoProfile;
|
|
1513
1703
|
}
|
|
1514
1704
|
/**
|
|
1515
|
-
*
|
|
1705
|
+
* peerConnection 抛出给用户的 track 字段
|
|
1516
1706
|
*/
|
|
1517
|
-
interface
|
|
1518
|
-
/**
|
|
1519
|
-
* 文字内容
|
|
1520
|
-
*/
|
|
1521
|
-
content: string;
|
|
1707
|
+
interface IRCTrackStat {
|
|
1522
1708
|
/**
|
|
1523
|
-
*
|
|
1524
|
-
|
|
1525
|
-
|
|
1709
|
+
* stat id
|
|
1710
|
+
*/
|
|
1711
|
+
id?: string;
|
|
1526
1712
|
/**
|
|
1527
|
-
*
|
|
1713
|
+
* 资源 Id
|
|
1528
1714
|
*/
|
|
1529
|
-
|
|
1715
|
+
trackId: string;
|
|
1530
1716
|
/**
|
|
1531
|
-
*
|
|
1717
|
+
* 资源类型
|
|
1532
1718
|
*/
|
|
1533
|
-
|
|
1719
|
+
kind: 'audio' | 'video';
|
|
1534
1720
|
/**
|
|
1535
|
-
*
|
|
1721
|
+
* 丢包率,有效值 `0` - `1`
|
|
1536
1722
|
*/
|
|
1537
|
-
|
|
1723
|
+
packetsLostRate: number | null;
|
|
1538
1724
|
/**
|
|
1539
|
-
*
|
|
1725
|
+
* 是否是远端资源
|
|
1540
1726
|
*/
|
|
1541
|
-
|
|
1542
|
-
}
|
|
1543
|
-
/**
|
|
1544
|
-
* 屏幕水印配置
|
|
1545
|
-
*/
|
|
1546
|
-
interface IWaterMarkConfig {
|
|
1727
|
+
remoteResource: boolean;
|
|
1547
1728
|
/**
|
|
1548
|
-
*
|
|
1729
|
+
* 音量
|
|
1549
1730
|
*/
|
|
1550
|
-
|
|
1731
|
+
audioLevel?: number | null;
|
|
1551
1732
|
/**
|
|
1552
|
-
*
|
|
1733
|
+
* 视频高度
|
|
1553
1734
|
*/
|
|
1554
|
-
|
|
1735
|
+
frameHeight?: number | null;
|
|
1555
1736
|
/**
|
|
1556
|
-
*
|
|
1737
|
+
* 视频宽度
|
|
1557
1738
|
*/
|
|
1558
|
-
|
|
1559
|
-
}
|
|
1560
|
-
/**
|
|
1561
|
-
* 合流前的单一视频流水印配置
|
|
1562
|
-
*/
|
|
1563
|
-
interface IMCUSignalScreenWaterMarkConfig extends IWaterMarkConfig {
|
|
1739
|
+
frameWidth?: number | null;
|
|
1564
1740
|
/**
|
|
1565
|
-
*
|
|
1741
|
+
* 视频帧率
|
|
1566
1742
|
*/
|
|
1567
|
-
|
|
1568
|
-
}
|
|
1569
|
-
interface IMCUWaterMarkConfig {
|
|
1743
|
+
frameRate?: number | null;
|
|
1570
1744
|
/**
|
|
1571
|
-
*
|
|
1745
|
+
* 码率
|
|
1572
1746
|
*/
|
|
1573
|
-
|
|
1747
|
+
bitrate: number;
|
|
1574
1748
|
/**
|
|
1575
|
-
*
|
|
1749
|
+
* 网络抖动,单位 ms
|
|
1750
|
+
* @description 下行数据中,同道流中只有一个 track 会有值,另一轨道数据值为 `0`
|
|
1576
1751
|
*/
|
|
1577
|
-
|
|
1752
|
+
jitter: number | null;
|
|
1578
1753
|
}
|
|
1579
1754
|
/**
|
|
1580
|
-
*
|
|
1755
|
+
* peerConnection 抛出给用户的 iceCandidatePair 字段
|
|
1581
1756
|
*/
|
|
1582
|
-
interface
|
|
1583
|
-
/**
|
|
1584
|
-
* 为向后兼容,当前为常量 1
|
|
1585
|
-
*/
|
|
1586
|
-
version: 1;
|
|
1587
|
-
/**
|
|
1588
|
-
* 布局模式,在只配置推流 CDN 时,该值不存在
|
|
1589
|
-
*/
|
|
1590
|
-
mode: MixLayoutMode;
|
|
1591
|
-
/**
|
|
1592
|
-
* 渲染到主位置上的流 Id,当该值为空时,输出到主位置的流按发布时间顺序优先选择最早发布的流
|
|
1593
|
-
*/
|
|
1594
|
-
host_stream_id?: string;
|
|
1595
|
-
/**
|
|
1596
|
-
* 自定义布局输入定义,只有在 mode 值为 `MixLayoutMode.CUSTOMIZE` 时需传值
|
|
1597
|
-
*/
|
|
1598
|
-
input?: {
|
|
1599
|
-
video?: IMCUInputVideoLayout[];
|
|
1600
|
-
audio?: IMCUInputAudio[];
|
|
1601
|
-
};
|
|
1757
|
+
interface IRCCandidatePairStat {
|
|
1602
1758
|
/**
|
|
1603
|
-
*
|
|
1759
|
+
* 本端 IP
|
|
1604
1760
|
*/
|
|
1605
|
-
|
|
1761
|
+
IP: string;
|
|
1606
1762
|
/**
|
|
1607
|
-
*
|
|
1763
|
+
* 本地 UDP 端口
|
|
1608
1764
|
*/
|
|
1609
|
-
|
|
1765
|
+
port: number;
|
|
1610
1766
|
/**
|
|
1611
|
-
*
|
|
1767
|
+
* 本地网络类型
|
|
1612
1768
|
*/
|
|
1613
|
-
|
|
1769
|
+
networkType: string | null;
|
|
1614
1770
|
/**
|
|
1615
|
-
*
|
|
1771
|
+
* 远端 IP
|
|
1616
1772
|
*/
|
|
1617
|
-
|
|
1618
|
-
}
|
|
1619
|
-
/**
|
|
1620
|
-
* 设置开启、停用内置 CDN 数据
|
|
1621
|
-
*/
|
|
1622
|
-
interface ISetEnableCDN {
|
|
1623
|
-
version: 2;
|
|
1624
|
-
output: {
|
|
1625
|
-
/**
|
|
1626
|
-
* 手动开启/停用内置 CDN
|
|
1627
|
-
*/
|
|
1628
|
-
inCDNModel: RCInnerCDNModel;
|
|
1629
|
-
};
|
|
1630
|
-
}
|
|
1631
|
-
|
|
1632
|
-
declare class RCMediaService {
|
|
1633
|
-
private readonly _runtime;
|
|
1634
|
-
private readonly _context;
|
|
1773
|
+
remoteIP: string;
|
|
1635
1774
|
/**
|
|
1636
|
-
*
|
|
1775
|
+
* 远端 UDP 端口
|
|
1637
1776
|
*/
|
|
1638
|
-
|
|
1777
|
+
remotePort: number;
|
|
1639
1778
|
/**
|
|
1640
|
-
*
|
|
1779
|
+
* 协议
|
|
1641
1780
|
*/
|
|
1642
|
-
|
|
1781
|
+
protocol: string;
|
|
1643
1782
|
/**
|
|
1644
|
-
*
|
|
1783
|
+
* 发送总码率,单位 kbps
|
|
1645
1784
|
*/
|
|
1646
|
-
|
|
1785
|
+
bitrateSend: number;
|
|
1647
1786
|
/**
|
|
1648
|
-
*
|
|
1787
|
+
* 接收总码率,单位 kbps
|
|
1649
1788
|
*/
|
|
1650
|
-
|
|
1789
|
+
bitrateRecv: number;
|
|
1651
1790
|
/**
|
|
1652
|
-
*
|
|
1791
|
+
* (Round-Trip-Time)往返时延,单位 ms
|
|
1653
1792
|
*/
|
|
1654
|
-
|
|
1793
|
+
rtt: number | null;
|
|
1655
1794
|
/**
|
|
1656
|
-
*
|
|
1795
|
+
* 可用上行带宽,单位 bit
|
|
1657
1796
|
*/
|
|
1658
|
-
|
|
1797
|
+
availableOutgoingBitrate: number | null;
|
|
1659
1798
|
/**
|
|
1660
|
-
*
|
|
1799
|
+
* 可用下行带宽,在无下行资源时,其值为 `0`,单位: `bit`
|
|
1661
1800
|
*/
|
|
1662
|
-
|
|
1663
|
-
|
|
1801
|
+
availableIncomingBitrate: number | null;
|
|
1802
|
+
}
|
|
1803
|
+
/**
|
|
1804
|
+
* iceCandidatePair 所有字段
|
|
1805
|
+
* 含 peerConnection 抛出给用户的 iceCandidatePair 字段
|
|
1806
|
+
* 含 北极星上报 R3、R4 所需的 totalPacketsLost
|
|
1807
|
+
*/
|
|
1808
|
+
interface IInnerIcePair extends IRCCandidatePairStat {
|
|
1664
1809
|
/**
|
|
1665
|
-
*
|
|
1810
|
+
* 上、下行总丢包率
|
|
1666
1811
|
*/
|
|
1667
|
-
|
|
1812
|
+
totalPacketsLost?: number;
|
|
1813
|
+
}
|
|
1814
|
+
/**
|
|
1815
|
+
* send track 所有字段
|
|
1816
|
+
* 含 peerConnection 抛出给用户的 track 字段
|
|
1817
|
+
* 含 北极星上报 R3 track 所需字段
|
|
1818
|
+
*/
|
|
1819
|
+
interface ISendTrackState extends IRCTrackStat {
|
|
1668
1820
|
/**
|
|
1669
|
-
*
|
|
1821
|
+
* (Round-Trip-Time)往返时延,单位 ms
|
|
1670
1822
|
*/
|
|
1671
|
-
|
|
1672
|
-
getNaviMS(): string[];
|
|
1823
|
+
rtt: number | null;
|
|
1673
1824
|
/**
|
|
1674
|
-
*
|
|
1675
|
-
* @param path
|
|
1676
|
-
* @param header
|
|
1677
|
-
* @param body
|
|
1825
|
+
* 编码方式
|
|
1678
1826
|
*/
|
|
1679
|
-
|
|
1827
|
+
encoderImplementation: string | null;
|
|
1680
1828
|
/**
|
|
1681
|
-
*
|
|
1682
|
-
* 并通过 subscribeList 和 publishList 表明最终发布和订阅的资源。本端产出 offer,服务器产出 answer
|
|
1683
|
-
* 每次接口调用,都会全量覆盖发布和订阅的资源。
|
|
1684
|
-
* @param header
|
|
1685
|
-
* @param body
|
|
1829
|
+
* PLI 请求数
|
|
1686
1830
|
*/
|
|
1687
|
-
|
|
1688
|
-
code: RCRTCCode;
|
|
1689
|
-
data?: IExchangeResponse | undefined;
|
|
1690
|
-
}>;
|
|
1831
|
+
pliCount: number;
|
|
1691
1832
|
/**
|
|
1692
|
-
*
|
|
1833
|
+
* nack 数量
|
|
1693
1834
|
*/
|
|
1694
|
-
|
|
1835
|
+
nackCount: number;
|
|
1695
1836
|
/**
|
|
1696
|
-
*
|
|
1837
|
+
* 第一个关键帧是否正常收到
|
|
1697
1838
|
*/
|
|
1698
|
-
|
|
1699
|
-
code: RCRTCCode;
|
|
1700
|
-
data?: IBroadcastSubRespBody | undefined;
|
|
1701
|
-
}>;
|
|
1839
|
+
googFirsSent: number;
|
|
1702
1840
|
/**
|
|
1703
|
-
*
|
|
1841
|
+
* 音频采样率
|
|
1704
1842
|
*/
|
|
1705
|
-
|
|
1706
|
-
code: RCRTCCode;
|
|
1707
|
-
}>;
|
|
1843
|
+
samplingRate: number;
|
|
1708
1844
|
/**
|
|
1709
|
-
*
|
|
1845
|
+
* 接收卡顿(间隔时间, 单位: ms)
|
|
1710
1846
|
*/
|
|
1711
|
-
|
|
1712
|
-
code: RCRTCCode;
|
|
1713
|
-
res?: any;
|
|
1714
|
-
}>;
|
|
1847
|
+
googRenderDelayMs: number;
|
|
1715
1848
|
/**
|
|
1716
|
-
*
|
|
1849
|
+
* 流状态(0:不可用, 1:可用)
|
|
1717
1850
|
*/
|
|
1718
|
-
|
|
1719
|
-
code: RCRTCCode;
|
|
1720
|
-
res?: ICDNPlayUrlResponse;
|
|
1721
|
-
}>;
|
|
1851
|
+
trackState: TrackState;
|
|
1722
1852
|
}
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
|
|
1853
|
+
/**
|
|
1854
|
+
* receive track 所有字段
|
|
1855
|
+
* 含 peerConnection 抛出给用户的 track 字段
|
|
1856
|
+
* 含 北极星上报 R4 track 所需字段
|
|
1857
|
+
*/
|
|
1858
|
+
interface IRecvTrackState extends IRCTrackStat {
|
|
1859
|
+
/**
|
|
1860
|
+
* 解码方式
|
|
1861
|
+
*/
|
|
1862
|
+
codecImplementationName: string | null;
|
|
1863
|
+
samplingRate: number;
|
|
1864
|
+
nackCount: number;
|
|
1865
|
+
pliCount: number;
|
|
1866
|
+
rtt: number | null;
|
|
1867
|
+
googFirsReceived: number;
|
|
1868
|
+
googRenderDelayMs: number;
|
|
1869
|
+
trackState: TrackState;
|
|
1730
1870
|
}
|
|
1731
|
-
|
|
1732
1871
|
/**
|
|
1733
|
-
*
|
|
1872
|
+
* peerConnection stats 解析出来业务所需的所有字段
|
|
1734
1873
|
*/
|
|
1735
|
-
|
|
1874
|
+
interface IInnerRCRTCStateReport {
|
|
1875
|
+
timestamp: number;
|
|
1876
|
+
iceCandidatePair?: IInnerIcePair;
|
|
1877
|
+
senders: ISendTrackState[];
|
|
1878
|
+
receivers: IRecvTrackState[];
|
|
1879
|
+
}
|
|
1880
|
+
/**
|
|
1881
|
+
* /**
|
|
1882
|
+
* peerConnection stats 抛给用户的字段
|
|
1883
|
+
*/
|
|
1884
|
+
interface IRCRTCStateReport {
|
|
1885
|
+
pcName?: string;
|
|
1736
1886
|
/**
|
|
1737
|
-
*
|
|
1887
|
+
* 报告生成时间戳
|
|
1738
1888
|
*/
|
|
1739
|
-
|
|
1889
|
+
timestamp: number;
|
|
1740
1890
|
/**
|
|
1741
|
-
*
|
|
1891
|
+
* 对等连接状态数据
|
|
1742
1892
|
*/
|
|
1743
|
-
|
|
1893
|
+
iceCandidatePair?: IRCCandidatePairStat;
|
|
1894
|
+
/**
|
|
1895
|
+
* 上行状态数据
|
|
1896
|
+
*/
|
|
1897
|
+
senders: IRCTrackStat[];
|
|
1898
|
+
/**
|
|
1899
|
+
* 下行状态数据
|
|
1900
|
+
*/
|
|
1901
|
+
receivers: IRCTrackStat[];
|
|
1744
1902
|
}
|
|
1745
|
-
|
|
1746
|
-
interface IAudienceRoomEventListener extends IRCRTCTrackEventListener {
|
|
1903
|
+
interface IRCRTCReportListener {
|
|
1747
1904
|
/**
|
|
1748
|
-
*
|
|
1749
|
-
* @param
|
|
1905
|
+
* RTCPeerConnection 的详细状态数据
|
|
1906
|
+
* @param report
|
|
1750
1907
|
*/
|
|
1751
|
-
|
|
1908
|
+
onStateReport?(report: IRCRTCStateReport): void;
|
|
1752
1909
|
/**
|
|
1753
|
-
*
|
|
1754
|
-
* @
|
|
1910
|
+
* ICE 连接状态变更通知
|
|
1911
|
+
* @since version 5.1.5
|
|
1755
1912
|
*/
|
|
1756
|
-
|
|
1913
|
+
onICEConnectionStateChange?(state: RTCIceConnectionState, pcName?: string): void;
|
|
1757
1914
|
/**
|
|
1758
|
-
*
|
|
1759
|
-
* @param tracks 新发布的合流音轨与视轨数据列表,包含新发布的 RCRemoteAudioTrack 与 RCRemoteVideoTrack 实例
|
|
1760
|
-
* @description
|
|
1761
|
-
* 当房间内某个主播第一次发布资源时触发
|
|
1915
|
+
* @deprecated
|
|
1762
1916
|
*/
|
|
1763
|
-
|
|
1917
|
+
onConnectionStateChange?(state: RTCPeerConnectionState, pcName?: string): void;
|
|
1918
|
+
}
|
|
1919
|
+
interface IRCRTCTrackEventListener {
|
|
1764
1920
|
/**
|
|
1765
|
-
*
|
|
1766
|
-
* @param
|
|
1767
|
-
* @description
|
|
1768
|
-
* 当房间内全部主播退出房间时,SDK 内部会取消对资源的订阅,业务层仅需处理 UI 业务
|
|
1921
|
+
* 订阅的音视频流通道已建立, track 已可以进行播放
|
|
1922
|
+
* @param track RCRemoteTrack 类实例
|
|
1769
1923
|
*/
|
|
1770
|
-
|
|
1924
|
+
onTrackReady?(track: RCRemoteTrack): void;
|
|
1925
|
+
}
|
|
1926
|
+
interface IRoomEventListener extends IRCRTCTrackEventListener {
|
|
1771
1927
|
/**
|
|
1772
|
-
*
|
|
1773
|
-
*
|
|
1928
|
+
* 当 RTCPeerConnection 连接被异常关闭时触发,此时需业务层重新加入房间并重新发布、订阅资源。
|
|
1929
|
+
* 引起连接异常中断的原因包括但不限于:电脑休眠、浏览器页面长期后台运行等
|
|
1930
|
+
* @since 5.1.5
|
|
1774
1931
|
*/
|
|
1775
|
-
|
|
1932
|
+
onRTCPeerConnectionCloseByException?(): void;
|
|
1776
1933
|
/**
|
|
1777
|
-
*
|
|
1778
|
-
* @
|
|
1779
|
-
*
|
|
1934
|
+
* 当本端被剔出房间时触发
|
|
1935
|
+
* @description 被踢出房间可能是由于服务端超出一定时间未能收到 rtcPing 消息,所以认为己方离线。
|
|
1936
|
+
* 另一种可能是己方 rtcPing 失败次数超出上限
|
|
1937
|
+
* @param byServer 当值为 `false` 时,说明本端 rtcPing 超时;当值为 `true` 时,说明本端收到被踢出房间通知
|
|
1780
1938
|
*/
|
|
1781
|
-
|
|
1939
|
+
onKickOff?(byServer: boolean, state?: RCKickReason): void;
|
|
1782
1940
|
/**
|
|
1783
|
-
*
|
|
1784
|
-
* @param
|
|
1941
|
+
* 接收到房间信令时回调,用户可通过房间实例的 sendMessage 接口发送信令
|
|
1942
|
+
* @param name 信令名
|
|
1943
|
+
* @param content 信令内容
|
|
1944
|
+
* @param senderUserId 发送者 Id
|
|
1945
|
+
* @param messageUId 消息唯一标识
|
|
1785
1946
|
*/
|
|
1786
|
-
|
|
1947
|
+
onMessageReceive?(name: string, content: any, senderUserId: string, messageUId: string): void;
|
|
1787
1948
|
/**
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
|
|
1791
|
-
|
|
1949
|
+
* 房间属性变更回调
|
|
1950
|
+
* @param name
|
|
1951
|
+
* @param content
|
|
1952
|
+
*/
|
|
1953
|
+
onRoomAttributeChange?(name: string, content?: string): void;
|
|
1792
1954
|
/**
|
|
1793
|
-
*
|
|
1955
|
+
* 房间用户禁用/启用音频
|
|
1956
|
+
* @param audioTrack RCRemoteAudioTrack 类实例
|
|
1794
1957
|
*/
|
|
1795
|
-
|
|
1796
|
-
resolution: RCResolution;
|
|
1797
|
-
fps: RCFrameRate;
|
|
1798
|
-
}): void;
|
|
1958
|
+
onAudioMuteChange?(audioTrack: RCRemoteAudioTrack): void;
|
|
1799
1959
|
/**
|
|
1800
|
-
*
|
|
1960
|
+
* 房间用户禁用/启用视频
|
|
1961
|
+
* @param videoTrack RCRemoteVideoTrack 类实例对象
|
|
1801
1962
|
*/
|
|
1802
|
-
|
|
1963
|
+
onVideoMuteChange?(videoTrack: RCRemoteVideoTrack): void;
|
|
1803
1964
|
/**
|
|
1804
|
-
*
|
|
1965
|
+
* 房间内用户发布资源
|
|
1966
|
+
* @param tracks 新发布的音轨与视轨数据列表,包含新发布的 RCRemoteAudioTrack 与 RCRemoteVideoTrack 实例
|
|
1805
1967
|
*/
|
|
1806
|
-
|
|
1807
|
-
resolution: RCResolution;
|
|
1808
|
-
fps: RCFrameRate;
|
|
1809
|
-
}): void;
|
|
1810
|
-
}
|
|
1811
|
-
/**
|
|
1812
|
-
* 观众直播房间类
|
|
1813
|
-
* 处理:
|
|
1814
|
-
* 1、通知观众房间内 人员变更、资源变更
|
|
1815
|
-
* 2、观众订阅、取消订阅资源
|
|
1816
|
-
*/
|
|
1817
|
-
declare class RCAudienceLivingRoom {
|
|
1818
|
-
private readonly _context;
|
|
1819
|
-
private readonly _runtime;
|
|
1820
|
-
private readonly _initOptions;
|
|
1821
|
-
readonly _roomId: string;
|
|
1822
|
-
private readonly _joinResData;
|
|
1823
|
-
readonly _livingType: RCLivingType;
|
|
1824
|
-
private readonly _service;
|
|
1968
|
+
onTrackPublish?(tracks: RCRemoteTrack[]): void;
|
|
1825
1969
|
/**
|
|
1826
|
-
*
|
|
1970
|
+
* 房间用户取消发布资源
|
|
1971
|
+
* @param tracks 被取消发布的音轨与视轨数据列表
|
|
1972
|
+
* @description 当资源被取消发布时,SDK 内部会取消对相关资源的订阅,业务层仅需处理 UI 业务
|
|
1827
1973
|
*/
|
|
1828
|
-
|
|
1974
|
+
onTrackUnpublish?(tracks: RCRemoteTrack[]): void;
|
|
1829
1975
|
/**
|
|
1830
|
-
*
|
|
1976
|
+
* 人员加入
|
|
1977
|
+
* @param userIds 加入的人员 id 列表
|
|
1831
1978
|
*/
|
|
1832
|
-
|
|
1979
|
+
onUserJoin?(userIds: string[]): void;
|
|
1833
1980
|
/**
|
|
1834
|
-
*
|
|
1981
|
+
* 人员退出
|
|
1982
|
+
* @param userIds
|
|
1835
1983
|
*/
|
|
1836
|
-
|
|
1984
|
+
onUserLeave?(userIds: string[]): void;
|
|
1837
1985
|
/**
|
|
1838
|
-
*
|
|
1986
|
+
* 主播开启、停止推 CDN 状态通知
|
|
1839
1987
|
*/
|
|
1840
|
-
|
|
1841
|
-
private _appListener;
|
|
1842
|
-
private _pc;
|
|
1843
|
-
private _subscribedList;
|
|
1844
|
-
private _sessionId;
|
|
1845
|
-
private _destroyed;
|
|
1988
|
+
onCDNEnableChange?(enable: boolean): void;
|
|
1846
1989
|
/**
|
|
1847
|
-
*
|
|
1990
|
+
* RTC 每次 Ping 的结果
|
|
1991
|
+
* @since version: 5.1.5
|
|
1848
1992
|
*/
|
|
1849
|
-
|
|
1993
|
+
onPing?(result: RCRTCPingResult): void;
|
|
1850
1994
|
/**
|
|
1851
|
-
*
|
|
1995
|
+
* 主播和观众切换身份通知
|
|
1852
1996
|
*/
|
|
1853
|
-
|
|
1997
|
+
onSwitchRole?(userId: string, role: RCRTCLiveRole): void;
|
|
1998
|
+
}
|
|
1999
|
+
/**
|
|
2000
|
+
* RTCClient 初始化配置
|
|
2001
|
+
* @public
|
|
2002
|
+
*/
|
|
2003
|
+
interface IRCRTCInitOptions {
|
|
1854
2004
|
/**
|
|
1855
|
-
*
|
|
2005
|
+
* 自定义 MediaServer Url,公有云用户无需关注
|
|
2006
|
+
* @description
|
|
2007
|
+
* 1. 仅当 `location.hostname` 为 `localhost` 时,`http` 协议地址有效,否则必须使用 `https` 协议地址
|
|
2008
|
+
* 2. 当该值有效时,将不再从 IMLib 导航数据中获取 mediaServer 地址
|
|
1856
2009
|
*/
|
|
1857
|
-
|
|
1858
|
-
constructor(_context: RTCPluginContext, _runtime: IRuntime, _initOptions: IRCRTCInitOptions, _roomId: string, _joinResData: {
|
|
1859
|
-
token: string;
|
|
1860
|
-
kvEntries: IServerRTCRoomEntry[];
|
|
1861
|
-
}, _livingType: RCLivingType);
|
|
2010
|
+
mediaServer?: string;
|
|
1862
2011
|
/**
|
|
1863
|
-
*
|
|
2012
|
+
* 输出日志等级,生产环境默认使用 WARN,开发环境默认为 DEBUG
|
|
2013
|
+
* @description
|
|
2014
|
+
* * 0 - DEBUG
|
|
2015
|
+
* * 1 - INFO
|
|
2016
|
+
* * 2 - WARN
|
|
2017
|
+
* * 3 - ERROR
|
|
1864
2018
|
*/
|
|
1865
|
-
|
|
1866
|
-
protected _assertRoomDestroyed(): RCRTCCode | undefined;
|
|
2019
|
+
logLevel?: LogLevel;
|
|
1867
2020
|
/**
|
|
1868
|
-
*
|
|
1869
|
-
* @param roomId 数据对应的房间 Id
|
|
1870
|
-
* @param singalData 拉取到的数据
|
|
1871
|
-
* * key RC_ANCHOR_LIST value: 为主播 ID 集合
|
|
1872
|
-
* * key RC_RES_`userId` value: 为主播发布的资源
|
|
1873
|
-
* * key RC_RTC_SESSIONID value: sessionId
|
|
1874
|
-
* * key RC_CDN value: CDN 资源数据
|
|
2021
|
+
* 修改默认的 log 输出函数
|
|
1875
2022
|
*/
|
|
1876
|
-
|
|
2023
|
+
logStdout?: (logLevel: LogLevel, content: string) => void;
|
|
1877
2024
|
/**
|
|
1878
|
-
*
|
|
2025
|
+
* 与 MediaServer 的 http 请求超时时间,单位为毫秒,默认值为 `5000`,有效值 `5000-30000`。
|
|
2026
|
+
* 优先级:用户配置 > 导航配置 > 默认时间。
|
|
1879
2027
|
*/
|
|
1880
|
-
|
|
1881
|
-
private _handleNewJoinedAnchor;
|
|
1882
|
-
private _handleLeftedAnchor;
|
|
2028
|
+
timeout?: number;
|
|
1883
2029
|
/**
|
|
1884
|
-
*
|
|
2030
|
+
* 房间 Ping 间隔时长,默认 `10000` ms,有效值 `3000`-`10000`
|
|
1885
2031
|
*/
|
|
1886
|
-
|
|
2032
|
+
pingGap?: number;
|
|
1887
2033
|
/**
|
|
1888
|
-
*
|
|
1889
|
-
|
|
1890
|
-
|
|
1891
|
-
private _onUserUnpublish;
|
|
1892
|
-
private _callAppListener;
|
|
2034
|
+
* 优化使用的 SDP 协议版本,仅当运行时浏览器支持相应 SDP 协议版本时生效
|
|
2035
|
+
*/
|
|
2036
|
+
sdpSemantics?: ISdpSemantics;
|
|
1893
2037
|
/**
|
|
1894
|
-
*
|
|
1895
|
-
|
|
1896
|
-
|
|
2038
|
+
* 观众拉内置 CDN 资源的直播拉流协议,默认为 RCInnerCDNPullKind.FLV
|
|
2039
|
+
*/
|
|
2040
|
+
pullInnerCDNProtocol?: RCInnerCDNPullKind;
|
|
1897
2041
|
/**
|
|
1898
|
-
*
|
|
1899
|
-
* @param subscribeList 订阅清单
|
|
1900
|
-
* @param publishedStreams 已发布流
|
|
1901
|
-
* @param iceRestart
|
|
2042
|
+
* 观众拉内置 CDN 资源时是否使用 https,默认为 RCInnerCDNPullIsHttps.HTTPS
|
|
1902
2043
|
*/
|
|
1903
|
-
|
|
1904
|
-
|
|
1905
|
-
|
|
1906
|
-
|
|
1907
|
-
|
|
1908
|
-
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
|
|
1913
|
-
|
|
1914
|
-
private _getReqHeaders;
|
|
1915
|
-
private _exchangeHandle;
|
|
1916
|
-
private _updateSubListHandle;
|
|
2044
|
+
pullInnerCDNUseHttps?: RCInnerCDNPullIsHttps;
|
|
2045
|
+
}
|
|
2046
|
+
interface ICameraVideoProfile extends IVideoProfile {
|
|
2047
|
+
cameraId?: string;
|
|
2048
|
+
faceMode?: 'user' | 'environment';
|
|
2049
|
+
}
|
|
2050
|
+
interface IMicphoneAudioProfile {
|
|
2051
|
+
micphoneId?: string;
|
|
2052
|
+
sampleRate?: number;
|
|
2053
|
+
}
|
|
2054
|
+
interface ICreateLocalTrackOptions {
|
|
1917
2055
|
/**
|
|
1918
|
-
*
|
|
1919
|
-
* @param newCDNUris 新的 cdn_uris 数据
|
|
2056
|
+
* 剔除音轨
|
|
1920
2057
|
*/
|
|
1921
|
-
|
|
2058
|
+
withoutAudio?: boolean;
|
|
1922
2059
|
/**
|
|
1923
|
-
*
|
|
1924
|
-
* _CDNUris 无 url 时,说明未开启 CDN 推送
|
|
1925
|
-
* @returns CDNPlayUrl
|
|
2060
|
+
* 剔除视轨
|
|
1926
2061
|
*/
|
|
1927
|
-
|
|
2062
|
+
withoutVideo?: boolean;
|
|
2063
|
+
}
|
|
2064
|
+
/**
|
|
2065
|
+
* 音量上报事件接口
|
|
2066
|
+
*/
|
|
2067
|
+
interface IAudioLevelChangeHandler {
|
|
2068
|
+
(audioLevelReportList: {
|
|
2069
|
+
track: RCLocalAudioTrack | RCRemoteAudioTrack;
|
|
2070
|
+
audioLevel: number;
|
|
2071
|
+
}[]): void;
|
|
2072
|
+
}
|
|
2073
|
+
/**
|
|
2074
|
+
* 房间资源数据
|
|
2075
|
+
*/
|
|
2076
|
+
declare type RoomData = {
|
|
2077
|
+
[userId: string]: IPublishedResource[];
|
|
2078
|
+
};
|
|
2079
|
+
/**
|
|
2080
|
+
* IMutilPeerC 中的 track 类型
|
|
2081
|
+
*/
|
|
2082
|
+
declare type TrackParam = RCLocalTrack | IPublishAttrs | RCRemoteTrack | ISubscribeAttr;
|
|
2083
|
+
/**
|
|
2084
|
+
* RCRTCPeerCManager 创建的一条 pcItem 上的数据类型
|
|
2085
|
+
*/
|
|
2086
|
+
interface IMutilPeerC {
|
|
1928
2087
|
/**
|
|
1929
|
-
*
|
|
1930
|
-
* @returns CDNPlayUrl
|
|
2088
|
+
* pcName
|
|
1931
2089
|
*/
|
|
1932
|
-
|
|
1933
|
-
code: RCRTCCode;
|
|
1934
|
-
CDNPlayUrl?: string;
|
|
1935
|
-
}>;
|
|
2090
|
+
pcName: string;
|
|
1936
2091
|
/**
|
|
1937
|
-
*
|
|
1938
|
-
* @param tracks
|
|
2092
|
+
* /exchange 请求中 request header 中的 Peer-Connection-Id 值
|
|
1939
2093
|
*/
|
|
1940
|
-
|
|
1941
|
-
code: RCRTCCode;
|
|
1942
|
-
failedList?: ISubscribeAttr[];
|
|
1943
|
-
}>;
|
|
1944
|
-
private __unsubscribe;
|
|
2094
|
+
pcId: string;
|
|
1945
2095
|
/**
|
|
1946
|
-
*
|
|
1947
|
-
* @param tracks
|
|
2096
|
+
* RCRTCPeerConnection 对象
|
|
1948
2097
|
*/
|
|
1949
|
-
|
|
1950
|
-
code: RCRTCCode;
|
|
1951
|
-
failedList?: ISubscribeAttr[];
|
|
1952
|
-
}>;
|
|
2098
|
+
pc: RCRTCPeerConnection;
|
|
1953
2099
|
/**
|
|
1954
|
-
*
|
|
2100
|
+
* 存放 peerConnection 上本次要发布、取消发布、订阅、取消订阅的 track
|
|
1955
2101
|
*/
|
|
1956
|
-
|
|
2102
|
+
tracks: TrackParam[];
|
|
2103
|
+
}
|
|
2104
|
+
interface IPKInfo {
|
|
2105
|
+
[roomId: string]: {
|
|
2106
|
+
inviteSessionId: string;
|
|
2107
|
+
inviterRoomId: string;
|
|
2108
|
+
inviterUserId: string;
|
|
2109
|
+
inviterUserAutoMix?: boolean;
|
|
2110
|
+
inviteeRoomId: string;
|
|
2111
|
+
inviteeUserAutoMix?: boolean;
|
|
2112
|
+
};
|
|
2113
|
+
}
|
|
2114
|
+
/**
|
|
2115
|
+
* 业务层发起连麦、响应连麦可选参数定义
|
|
2116
|
+
*/
|
|
2117
|
+
interface IReqResPKOptions {
|
|
2118
|
+
autoMix?: boolean;
|
|
2119
|
+
extra?: string;
|
|
2120
|
+
}
|
|
2121
|
+
interface IPKInviterBaseInfo {
|
|
1957
2122
|
/**
|
|
1958
|
-
*
|
|
1959
|
-
* @param trackId
|
|
2123
|
+
* 邀请者房间 ID
|
|
1960
2124
|
*/
|
|
1961
|
-
|
|
2125
|
+
inviterRoomId: string;
|
|
1962
2126
|
/**
|
|
1963
|
-
*
|
|
2127
|
+
* 邀请者用户 ID
|
|
1964
2128
|
*/
|
|
1965
|
-
|
|
2129
|
+
inviterUserId: string;
|
|
2130
|
+
}
|
|
2131
|
+
interface IPKInviteeBaseInfo {
|
|
1966
2132
|
/**
|
|
1967
|
-
*
|
|
1968
|
-
* @param trackId
|
|
2133
|
+
* 被邀请者房间 ID
|
|
1969
2134
|
*/
|
|
1970
|
-
|
|
2135
|
+
inviteeRoomId: string;
|
|
1971
2136
|
/**
|
|
1972
|
-
*
|
|
2137
|
+
* 被邀请者用户 ID
|
|
1973
2138
|
*/
|
|
1974
|
-
|
|
2139
|
+
inviteeUserId: string;
|
|
2140
|
+
}
|
|
2141
|
+
/**
|
|
2142
|
+
* 业务层监听收到连麦邀请、取消连麦的字段
|
|
2143
|
+
*/
|
|
2144
|
+
interface IPKInviteInfo extends IPKInviterBaseInfo {
|
|
1975
2145
|
/**
|
|
1976
|
-
*
|
|
1977
|
-
* @param tag 参数描述
|
|
2146
|
+
* 邀请额外信息
|
|
1978
2147
|
*/
|
|
1979
|
-
|
|
2148
|
+
extra?: string;
|
|
2149
|
+
}
|
|
2150
|
+
/**
|
|
2151
|
+
* 业务层监听收到连麦应答的字段
|
|
2152
|
+
*/
|
|
2153
|
+
interface IPKInviteAnswerInfo extends IPKInviterBaseInfo, IPKInviteeBaseInfo {
|
|
1980
2154
|
/**
|
|
1981
|
-
*
|
|
1982
|
-
* @param handler 业务端传入的音量上报事件
|
|
1983
|
-
* @param gap 上报时间间隔
|
|
2155
|
+
* 是否同意邀请
|
|
1984
2156
|
*/
|
|
1985
|
-
|
|
2157
|
+
agree: boolean;
|
|
1986
2158
|
/**
|
|
1987
|
-
*
|
|
1988
|
-
* @param listener
|
|
2159
|
+
* 响应额外信息
|
|
1989
2160
|
*/
|
|
1990
|
-
|
|
2161
|
+
extra?: string;
|
|
2162
|
+
}
|
|
2163
|
+
/**
|
|
2164
|
+
* 业务层监听收到连麦结束的字段
|
|
2165
|
+
*/
|
|
2166
|
+
interface IPKEndInfo {
|
|
1991
2167
|
/**
|
|
1992
|
-
*
|
|
2168
|
+
* 发起结束的房间 ID
|
|
1993
2169
|
*/
|
|
1994
|
-
|
|
2170
|
+
endRoomId: string;
|
|
1995
2171
|
/**
|
|
1996
|
-
*
|
|
2172
|
+
* 发起结束的用户 ID
|
|
1997
2173
|
*/
|
|
1998
|
-
|
|
2174
|
+
endUserId: string;
|
|
2175
|
+
}
|
|
2176
|
+
/**
|
|
2177
|
+
* 观众加房间返回给客户的 CDN 信息
|
|
2178
|
+
*/
|
|
2179
|
+
interface IJoinResCDNInfo {
|
|
2180
|
+
resolution?: RCResolution;
|
|
2181
|
+
fps?: RCFrameRate;
|
|
2182
|
+
CDNEnable?: boolean;
|
|
2183
|
+
}
|
|
2184
|
+
|
|
2185
|
+
declare enum RCInnerCDNPushMode {
|
|
2186
|
+
AUTOMATIC = 0,
|
|
2187
|
+
MANUAL = 1
|
|
2188
|
+
}
|
|
2189
|
+
|
|
2190
|
+
declare enum RCInnerCDNBroadcast {
|
|
2191
|
+
SPREAD = 0,
|
|
2192
|
+
NO_SPREAD = -1
|
|
2193
|
+
}
|
|
2194
|
+
|
|
2195
|
+
/**
|
|
2196
|
+
* 与 MediaServer 交互所需的 Request Header 信息
|
|
2197
|
+
*/
|
|
2198
|
+
interface IRTCReqHeader {
|
|
1999
2199
|
/**
|
|
2000
|
-
*
|
|
2200
|
+
* RTC Token
|
|
2201
|
+
* @todo 有效期问题处理
|
|
2001
2202
|
*/
|
|
2002
|
-
|
|
2203
|
+
Token: string;
|
|
2003
2204
|
/**
|
|
2004
|
-
*
|
|
2205
|
+
* 房间 Id
|
|
2005
2206
|
*/
|
|
2006
|
-
|
|
2207
|
+
RoomId: string;
|
|
2007
2208
|
/**
|
|
2008
|
-
*
|
|
2009
|
-
* @param userId
|
|
2010
|
-
* @returns
|
|
2209
|
+
* 用户 Id
|
|
2011
2210
|
*/
|
|
2012
|
-
|
|
2211
|
+
UserId: string;
|
|
2013
2212
|
/**
|
|
2014
|
-
*
|
|
2015
|
-
* @returns
|
|
2213
|
+
* 仅在直播模式下需要
|
|
2016
2214
|
*/
|
|
2017
|
-
|
|
2215
|
+
RoomType?: RTCMode;
|
|
2018
2216
|
/**
|
|
2019
|
-
*
|
|
2217
|
+
* 开发者的 AppKey
|
|
2020
2218
|
*/
|
|
2021
|
-
|
|
2219
|
+
'App-Key': string;
|
|
2022
2220
|
/**
|
|
2023
|
-
*
|
|
2221
|
+
* signal 会话 session id
|
|
2024
2222
|
*/
|
|
2025
|
-
|
|
2223
|
+
'Session-Id'?: string;
|
|
2026
2224
|
/**
|
|
2027
|
-
*
|
|
2225
|
+
* peerConnection Id
|
|
2028
2226
|
*/
|
|
2029
|
-
|
|
2030
|
-
|
|
2031
|
-
|
|
2032
|
-
|
|
2033
|
-
|
|
2034
|
-
|
|
2035
|
-
|
|
2036
|
-
|
|
2037
|
-
};
|
|
2227
|
+
'Peer-Connection-Id'?: string;
|
|
2228
|
+
}
|
|
2229
|
+
interface IMCUReqHeaders {
|
|
2230
|
+
'App-Key': string;
|
|
2231
|
+
Token: string;
|
|
2232
|
+
RoomId: string;
|
|
2233
|
+
UserId: string;
|
|
2234
|
+
SessionId: string;
|
|
2038
2235
|
}
|
|
2039
|
-
|
|
2040
2236
|
/**
|
|
2041
|
-
*
|
|
2237
|
+
* exchange 接口中 pushOtherRooms 字段接口
|
|
2042
2238
|
*/
|
|
2043
|
-
|
|
2239
|
+
interface IPushOtherRooms {
|
|
2044
2240
|
/**
|
|
2045
|
-
*
|
|
2241
|
+
* 房间 Id
|
|
2046
2242
|
*/
|
|
2047
|
-
|
|
2243
|
+
roomId: string;
|
|
2048
2244
|
/**
|
|
2049
|
-
|
|
2050
|
-
|
|
2051
|
-
|
|
2245
|
+
* 是否默认合流
|
|
2246
|
+
*/
|
|
2247
|
+
autoMix: boolean;
|
|
2248
|
+
/**
|
|
2249
|
+
* 房间 Id 对应的 SessionId
|
|
2250
|
+
*/
|
|
2251
|
+
sessionId: string;
|
|
2052
2252
|
}
|
|
2053
|
-
|
|
2054
|
-
|
|
2055
|
-
|
|
2056
|
-
|
|
2057
|
-
private readonly _roomId;
|
|
2058
|
-
private readonly _crtRTCRoom;
|
|
2059
|
-
private readonly _userRole;
|
|
2060
|
-
constructor(_context: RTCPluginContext, _runtime: IRuntime, _roomId: string, _crtRTCRoom: RCAbstractRoom | RCAudienceLivingRoom, _userRole?: PolarisRole);
|
|
2061
|
-
private _send;
|
|
2062
|
-
private _getClientID;
|
|
2253
|
+
/**
|
|
2254
|
+
* exchange 接口的请求体结构
|
|
2255
|
+
*/
|
|
2256
|
+
interface IExchangeReqBody {
|
|
2063
2257
|
/**
|
|
2064
|
-
*
|
|
2258
|
+
* local description
|
|
2065
2259
|
*/
|
|
2066
|
-
|
|
2260
|
+
sdp: IOfferInfo;
|
|
2067
2261
|
/**
|
|
2068
|
-
*
|
|
2069
|
-
* @param resourceId userId_11_1_tiny 改为 userId_11_tiny_video
|
|
2262
|
+
* 订阅列表
|
|
2070
2263
|
*/
|
|
2071
|
-
|
|
2072
|
-
|
|
2264
|
+
subscribeList: {
|
|
2265
|
+
/**
|
|
2266
|
+
* 流资源 uri
|
|
2267
|
+
*/
|
|
2268
|
+
uri: string;
|
|
2269
|
+
/**
|
|
2270
|
+
* 大小流订阅,`1` 为大流,`2` 为小流,默认使用大流
|
|
2271
|
+
*/
|
|
2272
|
+
simulcast: RCStreamType;
|
|
2273
|
+
/**
|
|
2274
|
+
* 分辨率信息
|
|
2275
|
+
*/
|
|
2276
|
+
resolution: string;
|
|
2277
|
+
}[];
|
|
2073
2278
|
/**
|
|
2074
|
-
*
|
|
2279
|
+
* 透传参数,一般用于传递参数给其他服务,如 MCU/Record 等,MediaServer 仅透传不处理
|
|
2280
|
+
* @example `{"resolutionInfo":[{"trackId":"021ad6e8-a50c-479c-96c8-5f3f09d2352d","simulcast":1,"resolution":"640x480"}]}`
|
|
2075
2281
|
*/
|
|
2076
|
-
|
|
2282
|
+
extend: string;
|
|
2077
2283
|
/**
|
|
2078
|
-
*
|
|
2079
|
-
* RTC 订阅、取消订阅
|
|
2284
|
+
* 跨房间连麦时其他房间的推流信息
|
|
2080
2285
|
*/
|
|
2081
|
-
|
|
2286
|
+
pushOtherRooms?: IPushOtherRooms[];
|
|
2287
|
+
/**
|
|
2288
|
+
* server 根据网络动态切换大小流开关,默认为 `false`
|
|
2289
|
+
*/
|
|
2290
|
+
switchstream: boolean;
|
|
2082
2291
|
}
|
|
2083
|
-
|
|
2084
|
-
/**
|
|
2085
|
-
* PC 实例管理类
|
|
2086
|
-
*/
|
|
2087
|
-
declare class RCRTCPeerConnection extends EventEmitter {
|
|
2292
|
+
interface ILiveUrls {
|
|
2088
2293
|
/**
|
|
2089
|
-
*
|
|
2294
|
+
* MCU 服务地址,直播模式中用于向 MCU 服务提交 CDN 及合流配置
|
|
2090
2295
|
*/
|
|
2091
|
-
|
|
2296
|
+
configUrl: string;
|
|
2092
2297
|
/**
|
|
2093
|
-
*
|
|
2298
|
+
* 观众端订阅地址,由业务层分发
|
|
2094
2299
|
*/
|
|
2095
|
-
|
|
2096
|
-
static __INNER_EVENT_TRACK_READY__: string;
|
|
2097
|
-
private readonly _rtcPeerConn;
|
|
2098
|
-
private readonly _sdpStrategy;
|
|
2099
|
-
reportParser: IStatParser | null;
|
|
2100
|
-
private pubLocalTracks;
|
|
2101
|
-
private _reTryExchangeTimer;
|
|
2102
|
-
private _reportStatsTimer;
|
|
2103
|
-
constructor(
|
|
2300
|
+
liveUrl: string;
|
|
2104
2301
|
/**
|
|
2105
|
-
*
|
|
2302
|
+
* 自动推 CDN 模式下,发布资源后返回的 CDN 信息
|
|
2106
2303
|
*/
|
|
2107
|
-
|
|
2304
|
+
pull_url?: string;
|
|
2305
|
+
}
|
|
2306
|
+
interface IRTCResponse {
|
|
2108
2307
|
/**
|
|
2109
|
-
*
|
|
2308
|
+
* 请求响应码,只有在 resultCode 值为 `10000` 时才为正常响应
|
|
2110
2309
|
*/
|
|
2111
|
-
|
|
2112
|
-
getLocalTracks(): RCLocalTrack[];
|
|
2113
|
-
private _onConnectionStateChange;
|
|
2114
|
-
private _onICEConnectionStateChange;
|
|
2115
|
-
private _onTrackReady;
|
|
2116
|
-
setBitrate(max: number, min: number, start?: number): Promise<void>;
|
|
2117
|
-
createOffer(iceRestart: boolean): Promise<IOfferInfo>;
|
|
2118
|
-
setRemoteAnswer(answer: string): Promise<RCRTCCode>;
|
|
2119
|
-
getLocalTrack(trackId: string): RCLocalTrack | null;
|
|
2120
|
-
addLocalTrack(track: RCLocalTrack): void;
|
|
2121
|
-
removeLocalTrackById(trackId: string): void;
|
|
2122
|
-
removeAllLocalTrack(): void;
|
|
2123
|
-
removeLocalTrack(track: RCLocalTrack): void;
|
|
2124
|
-
private _updateRecvTransceiverMap;
|
|
2125
|
-
updateSubRemoteTracks(remoteTracks: RCRemoteTrack[]): void;
|
|
2310
|
+
resultCode: RCRTCCode;
|
|
2126
2311
|
/**
|
|
2127
|
-
|
|
2312
|
+
* 与 resultCode 相应的可读性文字信息
|
|
2313
|
+
*/
|
|
2314
|
+
message: string;
|
|
2315
|
+
/**
|
|
2316
|
+
* 客户端发送的 Request-Id
|
|
2128
2317
|
*/
|
|
2129
|
-
|
|
2130
|
-
|
|
2131
|
-
|
|
2132
|
-
|
|
2318
|
+
'Request-Id': string;
|
|
2319
|
+
}
|
|
2320
|
+
/**
|
|
2321
|
+
* /exchange 响应结果
|
|
2322
|
+
*/
|
|
2323
|
+
interface IExchangeResponse extends IRTCResponse {
|
|
2133
2324
|
/**
|
|
2134
|
-
*
|
|
2135
|
-
* @param listener
|
|
2325
|
+
* 数据中心地址,当存在此值时,后续所有请求发送到该地址。该地址不携带协议头,故需要补全 `https://` 协议头
|
|
2136
2326
|
*/
|
|
2137
|
-
|
|
2138
|
-
private _createRCRTCStateReport;
|
|
2327
|
+
clusterId: string;
|
|
2139
2328
|
/**
|
|
2140
|
-
*
|
|
2141
|
-
* @returns 返回格式化后的数据
|
|
2329
|
+
* 发布的资源列表
|
|
2142
2330
|
*/
|
|
2143
|
-
|
|
2144
|
-
getAudioLevelReportData(): Promise<{
|
|
2145
|
-
trackId: string;
|
|
2146
|
-
audioLevel: number | null;
|
|
2147
|
-
}[] | undefined>;
|
|
2331
|
+
publishList: IResource[];
|
|
2148
2332
|
/**
|
|
2149
|
-
*
|
|
2150
|
-
* @todo
|
|
2333
|
+
* @deprecated 目前并未使用,服务器返回值为 ''
|
|
2151
2334
|
*/
|
|
2152
|
-
|
|
2153
|
-
getRTCPeerConn(): RTCPeerConnection;
|
|
2154
|
-
destroy(): void;
|
|
2155
|
-
clearReTryExchangeTimer(): void;
|
|
2156
|
-
}
|
|
2157
|
-
|
|
2158
|
-
declare type IOnRecvPKMsg = (msg: IReceivedMessage) => void;
|
|
2159
|
-
interface IRoomPKEventListener {
|
|
2335
|
+
roomId: '';
|
|
2160
2336
|
/**
|
|
2161
|
-
*
|
|
2337
|
+
* 远端 SDP 数据
|
|
2162
2338
|
*/
|
|
2163
|
-
|
|
2339
|
+
sdp: {
|
|
2340
|
+
type: 'answer';
|
|
2341
|
+
sdp: string;
|
|
2342
|
+
};
|
|
2164
2343
|
/**
|
|
2165
|
-
*
|
|
2344
|
+
* 直播模式推流数据,仅在直播模式有值
|
|
2166
2345
|
*/
|
|
2167
|
-
|
|
2346
|
+
urls?: ILiveUrls;
|
|
2168
2347
|
/**
|
|
2169
|
-
*
|
|
2348
|
+
* 跨房间连麦响应数据
|
|
2170
2349
|
*/
|
|
2171
|
-
|
|
2350
|
+
otherRoomsRes?: {
|
|
2351
|
+
[roomId: string]: ILiveUrls;
|
|
2352
|
+
};
|
|
2172
2353
|
/**
|
|
2173
|
-
*
|
|
2354
|
+
* 直播 mcu 资源
|
|
2355
|
+
* 主播发布为具体资源,会议模式为空数组
|
|
2174
2356
|
*/
|
|
2175
|
-
|
|
2357
|
+
mcuPublishList?: IResource[];
|
|
2358
|
+
/**
|
|
2359
|
+
* 订阅成功的资源
|
|
2360
|
+
*/
|
|
2361
|
+
subscribedList?: {
|
|
2362
|
+
mediaType: RCMediaType.AUDIO_ONLY | RCMediaType.VIDEO_ONLY;
|
|
2363
|
+
msid: string;
|
|
2364
|
+
userId: string;
|
|
2365
|
+
simulcast?: RCStreamType;
|
|
2366
|
+
}[];
|
|
2176
2367
|
}
|
|
2177
|
-
|
|
2178
|
-
private _PKInfo;
|
|
2179
|
-
private readonly _context;
|
|
2180
|
-
private readonly _runtime;
|
|
2181
|
-
private readonly _service;
|
|
2182
|
-
private readonly _initOptions;
|
|
2368
|
+
interface IBroadcastSubReqBody {
|
|
2183
2369
|
/**
|
|
2184
|
-
*
|
|
2370
|
+
* 客户端 offer
|
|
2185
2371
|
*/
|
|
2186
|
-
|
|
2187
|
-
|
|
2372
|
+
sdp: {
|
|
2373
|
+
type: 'offer';
|
|
2374
|
+
sdp: string;
|
|
2375
|
+
};
|
|
2188
2376
|
/**
|
|
2189
|
-
*
|
|
2377
|
+
* 直播信息
|
|
2190
2378
|
*/
|
|
2191
|
-
|
|
2379
|
+
liveUrl?: string;
|
|
2192
2380
|
/**
|
|
2193
|
-
*
|
|
2381
|
+
* 订阅的资源类型,默认为 `RCMediaType.AUDIO_VIDEO`
|
|
2194
2382
|
*/
|
|
2195
|
-
|
|
2383
|
+
mediaType?: RCMediaType;
|
|
2196
2384
|
/**
|
|
2197
|
-
*
|
|
2385
|
+
* 订阅大/小流,默认订阅大流
|
|
2198
2386
|
*/
|
|
2199
|
-
|
|
2387
|
+
simulcast?: RCStreamType;
|
|
2200
2388
|
/**
|
|
2201
|
-
*
|
|
2389
|
+
* 允许 server 根据网络状况动态切换大小流,默认为 false
|
|
2202
2390
|
*/
|
|
2203
|
-
|
|
2204
|
-
private _mainRoomId;
|
|
2391
|
+
switchstream: boolean;
|
|
2205
2392
|
/**
|
|
2206
|
-
*
|
|
2393
|
+
* 订阅列表
|
|
2207
2394
|
*/
|
|
2208
|
-
|
|
2209
|
-
|
|
2395
|
+
subscribeList?: {
|
|
2396
|
+
/**
|
|
2397
|
+
* 流资源 uri
|
|
2398
|
+
*/
|
|
2399
|
+
uri: string;
|
|
2400
|
+
/**
|
|
2401
|
+
* 大小流订阅,`1` 为大流,`2` 为小流,默认使用大流
|
|
2402
|
+
*/
|
|
2403
|
+
simulcast: RCStreamType;
|
|
2404
|
+
/**
|
|
2405
|
+
* 分辨率信息
|
|
2406
|
+
*/
|
|
2407
|
+
resolution: string;
|
|
2408
|
+
}[];
|
|
2210
2409
|
/**
|
|
2211
|
-
*
|
|
2410
|
+
* 是否采用新版本模式,加入房间
|
|
2212
2411
|
*/
|
|
2213
|
-
|
|
2412
|
+
newVersionFlag?: boolean;
|
|
2413
|
+
}
|
|
2414
|
+
interface IBroadcastSubRespBody extends IRTCResponse {
|
|
2214
2415
|
/**
|
|
2215
|
-
*
|
|
2416
|
+
* 已订阅的资源列表
|
|
2216
2417
|
*/
|
|
2217
|
-
|
|
2418
|
+
subscribedList: IResource[];
|
|
2218
2419
|
/**
|
|
2219
|
-
*
|
|
2420
|
+
* 远端 SDP
|
|
2220
2421
|
*/
|
|
2221
|
-
|
|
2222
|
-
|
|
2422
|
+
sdp: {
|
|
2423
|
+
type: 'answer';
|
|
2424
|
+
sdp: string;
|
|
2425
|
+
};
|
|
2426
|
+
}
|
|
2427
|
+
/**
|
|
2428
|
+
* 获取 CDN 资源拉流地址请求 headers
|
|
2429
|
+
*/
|
|
2430
|
+
interface ICDNPlayUrlReqHeaders extends IMCUReqHeaders {
|
|
2431
|
+
}
|
|
2432
|
+
/**
|
|
2433
|
+
* 获取 CDN 资源拉流地址响应
|
|
2434
|
+
*/
|
|
2435
|
+
interface ICDNPlayUrlResponse extends IRTCResponse {
|
|
2436
|
+
data: {
|
|
2437
|
+
fps: number;
|
|
2438
|
+
h: number;
|
|
2439
|
+
'pull_url': string;
|
|
2440
|
+
w: number;
|
|
2441
|
+
};
|
|
2442
|
+
}
|
|
2443
|
+
/**
|
|
2444
|
+
* cdn_uris 里面包含的字段
|
|
2445
|
+
*/
|
|
2446
|
+
interface ICDNUris {
|
|
2223
2447
|
/**
|
|
2224
|
-
*
|
|
2448
|
+
* 是否扩散
|
|
2225
2449
|
*/
|
|
2226
|
-
|
|
2450
|
+
broadcast: RCInnerCDNBroadcast;
|
|
2227
2451
|
/**
|
|
2228
|
-
*
|
|
2452
|
+
* 拉流资源的宽度
|
|
2229
2453
|
*/
|
|
2230
|
-
|
|
2231
|
-
private _onInviteTimeout;
|
|
2454
|
+
w?: number;
|
|
2232
2455
|
/**
|
|
2233
|
-
*
|
|
2456
|
+
* 拉流资源的高度
|
|
2234
2457
|
*/
|
|
2235
|
-
|
|
2458
|
+
h?: number;
|
|
2236
2459
|
/**
|
|
2237
|
-
|
|
2460
|
+
* 帧率
|
|
2461
|
+
*/
|
|
2462
|
+
fps?: number;
|
|
2463
|
+
/**
|
|
2464
|
+
* 获取拉流地址的 url
|
|
2238
2465
|
*/
|
|
2239
|
-
|
|
2466
|
+
url: string;
|
|
2240
2467
|
/**
|
|
2241
|
-
*
|
|
2468
|
+
* 开启、停用 CDN
|
|
2242
2469
|
*/
|
|
2243
|
-
|
|
2470
|
+
enableInnerCDN?: boolean;
|
|
2244
2471
|
/**
|
|
2245
|
-
*
|
|
2472
|
+
* 推送模式,手动 or 自动
|
|
2246
2473
|
*/
|
|
2247
|
-
|
|
2474
|
+
'push_mode': RCInnerCDNPushMode;
|
|
2475
|
+
'pull_safe': boolean;
|
|
2476
|
+
}
|
|
2477
|
+
|
|
2478
|
+
/**
|
|
2479
|
+
* 直播布局模式定义
|
|
2480
|
+
*/
|
|
2481
|
+
declare enum MixLayoutMode {
|
|
2248
2482
|
/**
|
|
2249
|
-
*
|
|
2250
|
-
* @param inviteeRoomId 被邀请者所处的房间 roomId
|
|
2251
|
-
* @param inviteeUserId 被邀请者 userId
|
|
2252
|
-
* @param options.autoMix 是否要把邀请者发布的资源,合并到被邀请者房间内的 MCU 流中
|
|
2253
|
-
* @param options.extra 拓展字段,可随邀请连麦消息透传给被邀请者
|
|
2483
|
+
* 自定义布局
|
|
2254
2484
|
*/
|
|
2255
|
-
|
|
2256
|
-
code: RCRTCCode | ErrorCode;
|
|
2257
|
-
}>;
|
|
2485
|
+
CUSTOMIZE = 1,
|
|
2258
2486
|
/**
|
|
2259
|
-
*
|
|
2260
|
-
* @param inviteeRoomId 被邀请者所处的房间 roomId
|
|
2261
|
-
* @param inviteeUserId 被邀请者 userId
|
|
2262
|
-
* @param extra 附加信息,可随取消邀请连麦消息透传给被邀请者
|
|
2487
|
+
* 悬浮布局(默认)
|
|
2263
2488
|
*/
|
|
2264
|
-
|
|
2265
|
-
code: RCRTCCode | ErrorCode;
|
|
2266
|
-
}>;
|
|
2489
|
+
SUSPENSION = 2,
|
|
2267
2490
|
/**
|
|
2268
|
-
*
|
|
2269
|
-
* @param inviterRoomId 邀请者所处的房间 roomId
|
|
2270
|
-
* @param inviterUserId 邀请者 userId
|
|
2271
|
-
* @param agree 是否同意连麦
|
|
2272
|
-
* @param options.autoMix 是否要把被邀请者发布的资源,合并到邀请者房间内的 MCU 流中
|
|
2273
|
-
* @param options.extra 附加信息,可随响应连麦消息透传给邀请者
|
|
2491
|
+
* 自适应布局
|
|
2274
2492
|
*/
|
|
2275
|
-
|
|
2276
|
-
|
|
2277
|
-
|
|
2493
|
+
ADAPTATION = 3
|
|
2494
|
+
}
|
|
2495
|
+
|
|
2496
|
+
/**
|
|
2497
|
+
* 合流布局对视频的填充模式
|
|
2498
|
+
*/
|
|
2499
|
+
declare enum MixVideoRenderMode {
|
|
2278
2500
|
/**
|
|
2279
|
-
*
|
|
2280
|
-
* @param roomId 需要结束连麦的房间 roomId
|
|
2501
|
+
* 裁剪(默认)
|
|
2281
2502
|
*/
|
|
2282
|
-
|
|
2283
|
-
private _relaseCrtRoom;
|
|
2503
|
+
CROP = 1,
|
|
2284
2504
|
/**
|
|
2285
|
-
*
|
|
2286
|
-
* @roomId 副房间的 roomId
|
|
2505
|
+
* 不裁剪
|
|
2287
2506
|
*/
|
|
2288
|
-
|
|
2289
|
-
|
|
2290
|
-
|
|
2291
|
-
|
|
2292
|
-
|
|
2293
|
-
|
|
2294
|
-
|
|
2507
|
+
WHOLE = 2
|
|
2508
|
+
}
|
|
2509
|
+
|
|
2510
|
+
declare enum RCInnerCDNModel {
|
|
2511
|
+
OPEN = 1,
|
|
2512
|
+
STOP = 2
|
|
2513
|
+
}
|
|
2514
|
+
|
|
2515
|
+
declare enum RCMixInputFilterMode {
|
|
2516
|
+
/** 全合流,后续加入房间的用户会自动合流 */
|
|
2517
|
+
AUDIO_VIDEO_ALL = 0,
|
|
2518
|
+
/** 全不合流,后续加入本房间的用户 */
|
|
2519
|
+
AUDIO_VIDEO_NO = 1,
|
|
2520
|
+
/** 音频全订阅, 视频全不订阅 */
|
|
2521
|
+
AUDIO_ALL_VIDEO_NO = 2,
|
|
2522
|
+
/** 视频全订阅, 音频全不订阅 */
|
|
2523
|
+
AUDIO_NO_VIDEO_ALL = 3,
|
|
2295
2524
|
/**
|
|
2296
|
-
*
|
|
2297
|
-
|
|
2298
|
-
|
|
2525
|
+
* 根据设置的音频合流列表和视频合流列表合并媒体流
|
|
2526
|
+
*/
|
|
2527
|
+
AUDIO_VIDEO_INPUT = 4,
|
|
2528
|
+
/** 音频全订阅,视频根据设置的视频合流列表 */
|
|
2529
|
+
AUDIO_ALL_VIDEO_INPUT = 5,
|
|
2530
|
+
/** 音频全不订阅, 视频根据input里面的视频项订阅 */
|
|
2531
|
+
AUDIO_NO_VIDEO_INPUT = 6,
|
|
2532
|
+
/** 视频全订阅, 音频根据input里面的音频项订阅 */
|
|
2533
|
+
AUDIO_INPUT_VIDEO_ALL = 7,
|
|
2534
|
+
/** 视频全不订阅, 音频根据input里面的音频项订阅 */
|
|
2535
|
+
AUDIO_INPUT_VIDEO_NO = 8,
|
|
2536
|
+
/** 按房间列表订阅音视频(保留当前已经订阅的, 但没在房间列表里的音视频) */
|
|
2537
|
+
ROOM_AUDIO_VIDEO_APPEND = 9,
|
|
2538
|
+
/** 按房间列表订阅音视频(清理当前已经订阅的, 但没在房间列表里的音视频) */
|
|
2539
|
+
ROOM_AUDIO_VIDEO_NOT_APPEND = 10,
|
|
2540
|
+
/** 按房间列表订阅音频, 不订阅视频(保留当前已经订阅的, 但没在房间列表里的音频) */
|
|
2541
|
+
ROOM_AUDIO_APPEND = 11,
|
|
2542
|
+
/** 按房间列表订阅音视, 不订阅视频(清理当前已经订阅的, 但没在房间列表里的音频) */
|
|
2543
|
+
ROOM_AUDIO_NOT_APPEND = 12,
|
|
2544
|
+
/** 按房间列表订阅视频, 不订阅音频(保留当前已经订阅的, 但没在房间列表里的视频) */
|
|
2545
|
+
ROOM_VIDEO_APPEND = 13,
|
|
2546
|
+
/** 按房间列表订阅视频, 不订阅音频(清理当前已经订阅的, 但没在房间列表里的视频) */
|
|
2547
|
+
ROOM_VIDEO_NOT_APPEND = 14
|
|
2548
|
+
}
|
|
2549
|
+
|
|
2550
|
+
/**
|
|
2551
|
+
* 合流后的 video 输出编码配置,包含分辨率、帧率、码率配置项
|
|
2552
|
+
*/
|
|
2553
|
+
interface IMCUOutputVideoAttrs {
|
|
2554
|
+
/**
|
|
2555
|
+
* 视频分辨率宽度
|
|
2299
2556
|
*/
|
|
2300
|
-
|
|
2301
|
-
code: RCRTCCode;
|
|
2302
|
-
}>;
|
|
2303
|
-
private _leaveOtherRoom;
|
|
2557
|
+
width?: number;
|
|
2304
2558
|
/**
|
|
2305
|
-
*
|
|
2306
|
-
* @param roomId 连麦房间的 roomId
|
|
2559
|
+
* 视频分辨率高度
|
|
2307
2560
|
*/
|
|
2308
|
-
|
|
2309
|
-
inviteSessionId: string;
|
|
2310
|
-
inviterRoomId: string;
|
|
2311
|
-
inviterUserId: string;
|
|
2312
|
-
inviterUserAutoMix?: boolean | undefined;
|
|
2313
|
-
inviteeRoomId: string;
|
|
2314
|
-
inviteeUserAutoMix?: boolean | undefined;
|
|
2315
|
-
};
|
|
2561
|
+
height?: number;
|
|
2316
2562
|
/**
|
|
2317
|
-
*
|
|
2563
|
+
* 帧率
|
|
2318
2564
|
*/
|
|
2319
|
-
|
|
2565
|
+
fps?: number;
|
|
2320
2566
|
/**
|
|
2321
|
-
*
|
|
2567
|
+
* 码率
|
|
2322
2568
|
*/
|
|
2323
|
-
|
|
2324
|
-
[roomId: string]: RCLivingRoom;
|
|
2325
|
-
};
|
|
2569
|
+
bitrate?: number;
|
|
2326
2570
|
}
|
|
2327
|
-
|
|
2328
|
-
|
|
2329
|
-
|
|
2330
|
-
|
|
2331
|
-
|
|
2571
|
+
/**
|
|
2572
|
+
* 合并入 MCU 的音频流
|
|
2573
|
+
*/
|
|
2574
|
+
interface IMCUInputAudio {
|
|
2575
|
+
user_id: string;
|
|
2576
|
+
stream_id: string;
|
|
2332
2577
|
}
|
|
2333
2578
|
/**
|
|
2334
|
-
*
|
|
2579
|
+
* 自定义布局中的单一视频流布局
|
|
2335
2580
|
*/
|
|
2336
|
-
|
|
2337
|
-
|
|
2338
|
-
|
|
2339
|
-
|
|
2340
|
-
|
|
2341
|
-
|
|
2342
|
-
|
|
2343
|
-
|
|
2344
|
-
|
|
2345
|
-
|
|
2346
|
-
|
|
2347
|
-
|
|
2348
|
-
protected readonly _roomResources: RoomData;
|
|
2581
|
+
interface IMCUInputVideoLayout {
|
|
2582
|
+
user_id: string;
|
|
2583
|
+
stream_id: string;
|
|
2584
|
+
x: number;
|
|
2585
|
+
y: number;
|
|
2586
|
+
width: number;
|
|
2587
|
+
height: number;
|
|
2588
|
+
}
|
|
2589
|
+
/**
|
|
2590
|
+
* 图片配置,用于水印、视频流背景图
|
|
2591
|
+
*/
|
|
2592
|
+
interface IPictureAttrs {
|
|
2349
2593
|
/**
|
|
2350
|
-
*
|
|
2594
|
+
* 资源下载地址,需包含协议
|
|
2351
2595
|
*/
|
|
2352
|
-
|
|
2596
|
+
uri: string;
|
|
2353
2597
|
/**
|
|
2354
|
-
*
|
|
2598
|
+
* 相对于整体画布的起始位置 x 坐标
|
|
2355
2599
|
*/
|
|
2356
|
-
|
|
2600
|
+
x: number;
|
|
2357
2601
|
/**
|
|
2358
|
-
*
|
|
2602
|
+
* 相对于整体画布的起始位置 y 坐标
|
|
2359
2603
|
*/
|
|
2360
|
-
|
|
2604
|
+
y: number;
|
|
2361
2605
|
/**
|
|
2362
|
-
*
|
|
2606
|
+
* 相对于整体画布的宽(百分比),有效值 `0.0` - `1.0`
|
|
2363
2607
|
*/
|
|
2364
|
-
|
|
2608
|
+
w: number;
|
|
2365
2609
|
/**
|
|
2366
|
-
*
|
|
2610
|
+
* 相对于整体画布的高(百分比),有效值 `0.0` - `1.0`
|
|
2367
2611
|
*/
|
|
2368
|
-
|
|
2612
|
+
h: number;
|
|
2613
|
+
}
|
|
2614
|
+
/**
|
|
2615
|
+
* 合流后的 Video 输出配置,包含背景图、背景色、大小流编码等配置项
|
|
2616
|
+
*/
|
|
2617
|
+
interface IMCUOutputVideoConfig {
|
|
2369
2618
|
/**
|
|
2370
|
-
*
|
|
2619
|
+
* 标准流输出定义
|
|
2371
2620
|
*/
|
|
2372
|
-
|
|
2373
|
-
private _destroyed;
|
|
2621
|
+
normal?: IMCUOutputVideoAttrs;
|
|
2374
2622
|
/**
|
|
2375
|
-
*
|
|
2623
|
+
* 小流输出定义
|
|
2376
2624
|
*/
|
|
2377
|
-
|
|
2625
|
+
tiny?: IMCUOutputVideoAttrs;
|
|
2626
|
+
exparams?: {
|
|
2627
|
+
/**
|
|
2628
|
+
* 合流布局时,对视频流的填充方式
|
|
2629
|
+
*/
|
|
2630
|
+
renderMode: MixVideoRenderMode;
|
|
2631
|
+
};
|
|
2378
2632
|
/**
|
|
2379
|
-
*
|
|
2633
|
+
* 背景色,如 `'0xf1a2c3'`
|
|
2380
2634
|
*/
|
|
2381
|
-
|
|
2382
|
-
constructor(_context: RTCPluginContext, _runtime: IRuntime, _roomId: string, data: IJoinRTCRoomData, _roomMode: RTCMode, _service: RCMediaService, _initOptions: IRCRTCInitOptions, _ntfClearRoomItem: Function, isUpgrade?: boolean, _isMainRoom?: boolean | undefined);
|
|
2383
|
-
private _initRemoteTracks;
|
|
2384
|
-
private _handlePingResult;
|
|
2635
|
+
backgroundColor?: string;
|
|
2385
2636
|
/**
|
|
2386
|
-
*
|
|
2387
|
-
* @description
|
|
2388
|
-
* * 自 v5.1.0 版本开始,推荐使用 `RCLocalTrack.setBitrate` 对不同流分别指定码率。
|
|
2389
|
-
* * 该方法仅在 SDP `plan-b` 协议下(Chrome 92 与 Safari 11 之前的版本)有效。
|
|
2390
|
-
* @param max 音视频发送码率上限,不可小于 200 且不可小于 `min`
|
|
2391
|
-
* @param min 音视频发送码率下限,默认值为 1,且不可小于 1,不可大于 `max`
|
|
2392
|
-
* @param start 起始码率,默认为码率上限的 70%
|
|
2637
|
+
* 背景图
|
|
2393
2638
|
*/
|
|
2394
|
-
|
|
2395
|
-
|
|
2396
|
-
|
|
2397
|
-
|
|
2398
|
-
|
|
2399
|
-
|
|
2400
|
-
|
|
2401
|
-
|
|
2639
|
+
backgroundPicture?: {
|
|
2640
|
+
/**
|
|
2641
|
+
* 填充模式:
|
|
2642
|
+
* 1. 按比例裁剪
|
|
2643
|
+
* 2. 不裁剪,按比例压缩
|
|
2644
|
+
*/
|
|
2645
|
+
fillMode: 1 | 2;
|
|
2646
|
+
/**
|
|
2647
|
+
* 资源列表
|
|
2648
|
+
*/
|
|
2649
|
+
picture: IPictureAttrs[];
|
|
2650
|
+
};
|
|
2651
|
+
}
|
|
2652
|
+
/**
|
|
2653
|
+
* 合流后的媒体输出定义
|
|
2654
|
+
*/
|
|
2655
|
+
interface IMCUOutputConfig {
|
|
2402
2656
|
/**
|
|
2403
|
-
*
|
|
2404
|
-
* @param byServer
|
|
2405
|
-
* * 当值为 false 时,说明本端 rtcPing 超时
|
|
2406
|
-
* * 当值为 true 时,说明本端收到被踢出房间通知
|
|
2657
|
+
* 输出视频配置
|
|
2407
2658
|
*/
|
|
2408
|
-
|
|
2409
|
-
private _rtcpeerClosed;
|
|
2659
|
+
video: IMCUOutputVideoConfig;
|
|
2410
2660
|
/**
|
|
2411
|
-
*
|
|
2412
|
-
* @param content
|
|
2413
|
-
* @param messageType 消息类型
|
|
2414
|
-
* @param userId 消息发送者
|
|
2661
|
+
* 输出音频配置
|
|
2415
2662
|
*/
|
|
2416
|
-
|
|
2417
|
-
/**
|
|
2418
|
-
* 旧版本兼容参数,当收到非 `RTCMessageName.TOTAL_CONTENT_RESOURCE` 时:
|
|
2419
|
-
* * ignore 值为 `true` 表示该消息由 signal server 向旧版本 RTCLib 提供的兼容消息,无需处理
|
|
2420
|
-
* * 否则认为该消息是由旧版本 RTCLib 主动发出的增量变更消息,需要处理
|
|
2421
|
-
*/
|
|
2422
|
-
ignore?: boolean;
|
|
2663
|
+
audio?: {
|
|
2423
2664
|
/**
|
|
2424
|
-
*
|
|
2665
|
+
* 音频码率
|
|
2425
2666
|
*/
|
|
2426
|
-
|
|
2427
|
-
}
|
|
2428
|
-
private _onTrackPublish;
|
|
2667
|
+
bitrate: number;
|
|
2668
|
+
};
|
|
2429
2669
|
/**
|
|
2430
|
-
*
|
|
2431
|
-
* @param content
|
|
2670
|
+
* CDN 推流地址列表
|
|
2432
2671
|
*/
|
|
2433
|
-
|
|
2672
|
+
cdn?: {
|
|
2673
|
+
/**
|
|
2674
|
+
* 推流地址,如:`'rtmp://xxxx'`
|
|
2675
|
+
*/
|
|
2676
|
+
pushurl: string;
|
|
2677
|
+
}[];
|
|
2678
|
+
}
|
|
2679
|
+
/**
|
|
2680
|
+
* 时间戳参数,用于水印
|
|
2681
|
+
*/
|
|
2682
|
+
interface ITimestampAttrs {
|
|
2434
2683
|
/**
|
|
2435
|
-
*
|
|
2684
|
+
* 时区
|
|
2436
2685
|
*/
|
|
2437
|
-
|
|
2686
|
+
timezone: number;
|
|
2438
2687
|
/**
|
|
2439
|
-
*
|
|
2688
|
+
* 字体像素大小
|
|
2440
2689
|
*/
|
|
2441
|
-
|
|
2690
|
+
fontSize: number;
|
|
2442
2691
|
/**
|
|
2443
|
-
*
|
|
2692
|
+
* 字体颜色
|
|
2444
2693
|
*/
|
|
2445
|
-
|
|
2694
|
+
color: 'black' | 'white';
|
|
2446
2695
|
/**
|
|
2447
|
-
*
|
|
2696
|
+
* 透明度,有效值 `0.0` 至 `1.0`
|
|
2448
2697
|
*/
|
|
2449
|
-
|
|
2698
|
+
alpha: number;
|
|
2450
2699
|
/**
|
|
2451
|
-
*
|
|
2452
|
-
* @returns
|
|
2700
|
+
* 相较于整体画布的 x 坐标(百分比),有效值 `0.0` 至 `1.0`
|
|
2453
2701
|
*/
|
|
2454
|
-
|
|
2702
|
+
x: number;
|
|
2455
2703
|
/**
|
|
2456
|
-
*
|
|
2457
|
-
* @param userId
|
|
2458
|
-
* @returns
|
|
2704
|
+
* 相较于整体画布的 y 坐标(百分比),有效值 `0.0` 至 `1.0`
|
|
2459
2705
|
*/
|
|
2460
|
-
|
|
2706
|
+
y: number;
|
|
2707
|
+
}
|
|
2708
|
+
/**
|
|
2709
|
+
* 文本参数,用于水印
|
|
2710
|
+
*/
|
|
2711
|
+
interface ITextAttrs {
|
|
2461
2712
|
/**
|
|
2462
|
-
*
|
|
2713
|
+
* 文字内容
|
|
2463
2714
|
*/
|
|
2464
|
-
|
|
2715
|
+
content: string;
|
|
2465
2716
|
/**
|
|
2466
|
-
*
|
|
2467
|
-
* @param name 消息名称
|
|
2468
|
-
* @param content 消息内容
|
|
2717
|
+
* 文字像素
|
|
2469
2718
|
*/
|
|
2470
|
-
|
|
2471
|
-
code: RCRTCCode;
|
|
2472
|
-
}>;
|
|
2719
|
+
fontSize: number;
|
|
2473
2720
|
/**
|
|
2474
|
-
*
|
|
2475
|
-
* @param key 属性名
|
|
2476
|
-
* @param value 属性值
|
|
2477
|
-
* @param message 是否在设置属性的时候携带消息内容,传空则不往房间中发送消息
|
|
2478
|
-
* @param isInner RTC 业务内部使用参数,用户忽略
|
|
2721
|
+
* 文字颜色
|
|
2479
2722
|
*/
|
|
2480
|
-
|
|
2481
|
-
name: string;
|
|
2482
|
-
content: string;
|
|
2483
|
-
}, isInner?: boolean): Promise<{
|
|
2484
|
-
code: RCRTCCode;
|
|
2485
|
-
}>;
|
|
2723
|
+
color: 'black' | 'white';
|
|
2486
2724
|
/**
|
|
2487
|
-
*
|
|
2488
|
-
* @param keys 待删除的属性名数组
|
|
2489
|
-
* @param message 是否在删除属性的时候携带消息内容,传空则不往房间中发送消息
|
|
2490
|
-
* @param isInner RTC 业务内部使用参数,用户忽略
|
|
2725
|
+
* 透明度,有效值 `0.0` 至 `1.0`
|
|
2491
2726
|
*/
|
|
2492
|
-
|
|
2493
|
-
name: string;
|
|
2494
|
-
content: string;
|
|
2495
|
-
}, isInner?: boolean): Promise<{
|
|
2496
|
-
code: RCRTCCode;
|
|
2497
|
-
}>;
|
|
2727
|
+
alpha: number;
|
|
2498
2728
|
/**
|
|
2499
|
-
*
|
|
2500
|
-
* @param keys 要查询的属性名数组,当数组长度为空时,取所有已设置的 kv 值
|
|
2501
|
-
* @param isInner RTC 业务内部使用参数,用户忽略
|
|
2729
|
+
* 相较于整体画布的 x 坐标(百分比),有效值 `0.0` 至 `1.0`
|
|
2502
2730
|
*/
|
|
2503
|
-
|
|
2504
|
-
code: RCRTCCode;
|
|
2505
|
-
data?: KVString;
|
|
2506
|
-
}>;
|
|
2731
|
+
x: number;
|
|
2507
2732
|
/**
|
|
2508
|
-
*
|
|
2509
|
-
* @param key 属性名
|
|
2510
|
-
* @param value 属性值
|
|
2511
|
-
* @param message 是否在设置属性的时候携带消息内容,传空则不往房间中发送消息
|
|
2733
|
+
* 相较于整体画布的 y 坐标(百分比),有效值 `0.0` 至 `1.0`
|
|
2512
2734
|
*/
|
|
2513
|
-
|
|
2735
|
+
y: number;
|
|
2736
|
+
}
|
|
2737
|
+
/**
|
|
2738
|
+
* 屏幕水印配置
|
|
2739
|
+
*/
|
|
2740
|
+
interface IWaterMarkConfig {
|
|
2514
2741
|
/**
|
|
2515
|
-
*
|
|
2516
|
-
* @param keys 待删除的属性名数组
|
|
2517
|
-
* @param message 是否在删除属性的时候携带消息内容,传空则不往房间中发送消息
|
|
2742
|
+
* 时间戳水印配置
|
|
2518
2743
|
*/
|
|
2519
|
-
|
|
2744
|
+
timestamp?: ITimestampAttrs;
|
|
2520
2745
|
/**
|
|
2521
|
-
*
|
|
2522
|
-
* @param keys 要查询的属性名数组
|
|
2746
|
+
* 图片水印配置
|
|
2523
2747
|
*/
|
|
2524
|
-
|
|
2748
|
+
picture?: IPictureAttrs[];
|
|
2525
2749
|
/**
|
|
2526
|
-
*
|
|
2750
|
+
* 文字水印配置
|
|
2527
2751
|
*/
|
|
2528
|
-
|
|
2752
|
+
text: ITextAttrs[];
|
|
2753
|
+
}
|
|
2754
|
+
/**
|
|
2755
|
+
* 合流前的单一视频流水印配置
|
|
2756
|
+
*/
|
|
2757
|
+
interface IMCUSignalScreenWaterMarkConfig extends IWaterMarkConfig {
|
|
2529
2758
|
/**
|
|
2530
|
-
*
|
|
2759
|
+
* 媒体流的 msid
|
|
2531
2760
|
*/
|
|
2532
|
-
|
|
2533
|
-
|
|
2534
|
-
|
|
2761
|
+
streamId: string;
|
|
2762
|
+
}
|
|
2763
|
+
interface IMCUWaterMarkConfig {
|
|
2535
2764
|
/**
|
|
2536
|
-
*
|
|
2537
|
-
* @param localTrack
|
|
2765
|
+
* 合流后的屏幕水印配置
|
|
2538
2766
|
*/
|
|
2539
|
-
|
|
2767
|
+
mixScreen: IWaterMarkConfig;
|
|
2540
2768
|
/**
|
|
2541
|
-
*
|
|
2542
|
-
* @param pubTiny 是否同步发小流
|
|
2769
|
+
* 合流前的单人视频流水印配置
|
|
2543
2770
|
*/
|
|
2771
|
+
signalScreen: IMCUSignalScreenWaterMarkConfig[];
|
|
2772
|
+
}
|
|
2773
|
+
/**
|
|
2774
|
+
* 发布到服务器的 MCU 配置数据
|
|
2775
|
+
*/
|
|
2776
|
+
interface IMCUConfig {
|
|
2544
2777
|
/**
|
|
2545
|
-
*
|
|
2778
|
+
* 为向后兼容,当前为常量 1
|
|
2546
2779
|
*/
|
|
2547
|
-
|
|
2780
|
+
version: 1;
|
|
2548
2781
|
/**
|
|
2549
|
-
*
|
|
2550
|
-
* @param tracks 待发布的 RCLocalTrack 实例
|
|
2551
|
-
* @returns
|
|
2782
|
+
* 布局模式,在只配置推流 CDN 时,该值不存在
|
|
2552
2783
|
*/
|
|
2553
|
-
|
|
2554
|
-
code: RCRTCCode;
|
|
2555
|
-
liveUrl?: string;
|
|
2556
|
-
}>;
|
|
2557
|
-
private __publish;
|
|
2784
|
+
mode: MixLayoutMode;
|
|
2558
2785
|
/**
|
|
2559
|
-
*
|
|
2786
|
+
* 渲染到主位置上的流 Id,当该值为空时,输出到主位置的流按发布时间顺序优先选择最早发布的流
|
|
2560
2787
|
*/
|
|
2561
|
-
|
|
2788
|
+
host_stream_id?: string;
|
|
2562
2789
|
/**
|
|
2563
|
-
*
|
|
2790
|
+
* 自定义布局输入定义,只有在 mode 值为 `MixLayoutMode.CUSTOMIZE` 时需传值
|
|
2564
2791
|
*/
|
|
2565
|
-
|
|
2566
|
-
|
|
2567
|
-
|
|
2568
|
-
|
|
2569
|
-
}>;
|
|
2570
|
-
protected _getRTCReqestHeaders(): IRTCReqHeader;
|
|
2792
|
+
input?: {
|
|
2793
|
+
video?: IMCUInputVideoLayout[];
|
|
2794
|
+
audio?: IMCUInputAudio[];
|
|
2795
|
+
};
|
|
2571
2796
|
/**
|
|
2572
|
-
*
|
|
2573
|
-
* @param subscribeList 订阅清单
|
|
2574
|
-
* @param iceRestart
|
|
2797
|
+
* 合流后的媒体输出配置
|
|
2575
2798
|
*/
|
|
2576
|
-
|
|
2799
|
+
output?: IMCUOutputConfig;
|
|
2577
2800
|
/**
|
|
2578
|
-
*
|
|
2579
|
-
* @param trackId
|
|
2801
|
+
* 水印配置
|
|
2580
2802
|
*/
|
|
2581
|
-
|
|
2803
|
+
waterMark?: IMCUWaterMarkConfig;
|
|
2582
2804
|
/**
|
|
2583
|
-
*
|
|
2584
|
-
* @param resourceIds 取消发布的资源 Id 列表
|
|
2805
|
+
* MCU 拉流配置,决定 MCU 从 MediaServer 拉流的方式
|
|
2585
2806
|
*/
|
|
2586
|
-
|
|
2587
|
-
code: RCRTCCode;
|
|
2588
|
-
}>;
|
|
2589
|
-
private __unpublish;
|
|
2807
|
+
inputFilterMode?: RCMixInputFilterMode;
|
|
2590
2808
|
/**
|
|
2591
|
-
*
|
|
2592
|
-
* @param resourceId
|
|
2809
|
+
* MCU 混入列表中房间内的资源
|
|
2593
2810
|
*/
|
|
2594
|
-
|
|
2811
|
+
mixRooms?: string[];
|
|
2812
|
+
}
|
|
2813
|
+
/**
|
|
2814
|
+
* 设置开启、停用内置 CDN 数据
|
|
2815
|
+
*/
|
|
2816
|
+
interface ISetEnableCDN {
|
|
2817
|
+
version: 2;
|
|
2818
|
+
output: {
|
|
2819
|
+
/**
|
|
2820
|
+
* 手动开启/停用内置 CDN
|
|
2821
|
+
*/
|
|
2822
|
+
inCDNModel: RCInnerCDNModel;
|
|
2823
|
+
};
|
|
2824
|
+
}
|
|
2825
|
+
|
|
2826
|
+
declare class RCMediaService {
|
|
2827
|
+
private readonly _runtime;
|
|
2828
|
+
private readonly _context;
|
|
2595
2829
|
/**
|
|
2596
|
-
*
|
|
2597
|
-
* @param resourceId
|
|
2830
|
+
* 自定义 MediaServer 地址,当有值时,不再使用导航内的地址
|
|
2598
2831
|
*/
|
|
2599
|
-
|
|
2832
|
+
private readonly _msUrl?;
|
|
2600
2833
|
/**
|
|
2601
|
-
*
|
|
2602
|
-
* @param tracks
|
|
2834
|
+
* 请求超时时长
|
|
2603
2835
|
*/
|
|
2604
|
-
|
|
2605
|
-
code: RCRTCCode;
|
|
2606
|
-
failedList?: ISubscribeAttr[];
|
|
2607
|
-
}>;
|
|
2608
|
-
private __subscribe;
|
|
2836
|
+
private readonly _timeout;
|
|
2609
2837
|
/**
|
|
2610
|
-
*
|
|
2611
|
-
* @param tracks 预取消远端资源
|
|
2838
|
+
* navi 中获取的媒体服务地址
|
|
2612
2839
|
*/
|
|
2613
|
-
|
|
2614
|
-
code: RCRTCCode;
|
|
2615
|
-
failedList?: ISubscribeAttr[];
|
|
2616
|
-
}>;
|
|
2617
|
-
private __unsubscribe;
|
|
2618
|
-
protected _assertRoomDestroyed(): RCRTCCode | undefined;
|
|
2840
|
+
private readonly _msInNavi;
|
|
2619
2841
|
/**
|
|
2620
|
-
*
|
|
2621
|
-
* @param trackId
|
|
2622
|
-
* @returns
|
|
2842
|
+
* 已失败的请求地址
|
|
2623
2843
|
*/
|
|
2624
|
-
|
|
2844
|
+
private readonly _failedMs;
|
|
2625
2845
|
/**
|
|
2626
|
-
*
|
|
2846
|
+
* 服务器指纹数据,客户端不得修改,直接透传
|
|
2627
2847
|
*/
|
|
2628
|
-
|
|
2848
|
+
private _rtcFinger;
|
|
2629
2849
|
/**
|
|
2630
|
-
*
|
|
2631
|
-
* @param trackId
|
|
2632
|
-
* @returns
|
|
2850
|
+
* 服务器接口返回的 clusterId 数据,当此数据有值时,后续所有请求向此服务发送
|
|
2633
2851
|
*/
|
|
2634
|
-
|
|
2852
|
+
private _clusterId;
|
|
2635
2853
|
/**
|
|
2636
|
-
*
|
|
2637
|
-
* 当参数为 `[]` 时,意味着不再订阅任何资源
|
|
2638
|
-
* @param tracks 变更的资源列表
|
|
2854
|
+
* MCU 服务地址
|
|
2639
2855
|
*/
|
|
2640
|
-
|
|
2641
|
-
|
|
2642
|
-
}>;
|
|
2643
|
-
private _updateSubListHandle;
|
|
2644
|
-
private _appListener;
|
|
2856
|
+
private _configUrl;
|
|
2857
|
+
constructor(_runtime: IRuntime, _context: RTCPluginContext,
|
|
2645
2858
|
/**
|
|
2646
|
-
*
|
|
2647
|
-
* @param listener
|
|
2859
|
+
* 自定义 MediaServer 地址,当有值时,不再使用导航内的地址
|
|
2648
2860
|
*/
|
|
2649
|
-
|
|
2861
|
+
_msUrl?: string | undefined,
|
|
2650
2862
|
/**
|
|
2651
|
-
*
|
|
2652
|
-
* @param listener
|
|
2653
|
-
* @description 该方法暂仅支持 Chrome 浏览器
|
|
2863
|
+
* 请求超时时长
|
|
2654
2864
|
*/
|
|
2655
|
-
|
|
2865
|
+
_timeout?: number);
|
|
2866
|
+
getNaviMS(): string[];
|
|
2656
2867
|
/**
|
|
2657
|
-
*
|
|
2658
|
-
* @param
|
|
2659
|
-
* @param
|
|
2868
|
+
* 发送请求,请求发送若失败,会继续尝试使用后续可用地址直到无地址可用,此时认为请求失败
|
|
2869
|
+
* @param path
|
|
2870
|
+
* @param header
|
|
2871
|
+
* @param body
|
|
2660
2872
|
*/
|
|
2661
|
-
|
|
2873
|
+
private _request;
|
|
2662
2874
|
/**
|
|
2663
|
-
*
|
|
2875
|
+
* 资源协商接口,订阅、发布、变更资源均可以使用此接口。该接口通过 sdp 字段交换 SDP 信息,
|
|
2876
|
+
* 并通过 subscribeList 和 publishList 表明最终发布和订阅的资源。本端产出 offer,服务器产出 answer
|
|
2877
|
+
* 每次接口调用,都会全量覆盖发布和订阅的资源。
|
|
2878
|
+
* @param header
|
|
2879
|
+
* @param body
|
|
2664
2880
|
*/
|
|
2665
|
-
|
|
2666
|
-
|
|
2667
|
-
|
|
2668
|
-
|
|
2669
|
-
private _onVideoMuteChange;
|
|
2881
|
+
exchange(headers: IRTCReqHeader, body: IExchangeReqBody): Promise<{
|
|
2882
|
+
code: RCRTCCode;
|
|
2883
|
+
data?: IExchangeResponse | undefined;
|
|
2884
|
+
}>;
|
|
2670
2885
|
/**
|
|
2671
|
-
*
|
|
2886
|
+
* 退出房间
|
|
2672
2887
|
*/
|
|
2673
|
-
|
|
2888
|
+
exit(headers: IRTCReqHeader): Promise<RCRTCCode>;
|
|
2674
2889
|
/**
|
|
2675
|
-
*
|
|
2890
|
+
* 观众端订阅主播资源
|
|
2676
2891
|
*/
|
|
2677
|
-
|
|
2892
|
+
broadcastSubscribe(headers: IRTCReqHeader, body: IBroadcastSubReqBody): Promise<{
|
|
2893
|
+
code: RCRTCCode;
|
|
2894
|
+
data?: IBroadcastSubRespBody | undefined;
|
|
2895
|
+
}>;
|
|
2678
2896
|
/**
|
|
2679
|
-
*
|
|
2897
|
+
* 观众端退出订阅
|
|
2680
2898
|
*/
|
|
2681
|
-
|
|
2899
|
+
broadcastExit(headers: IRTCReqHeader): Promise<{
|
|
2900
|
+
code: RCRTCCode;
|
|
2901
|
+
}>;
|
|
2682
2902
|
/**
|
|
2683
|
-
*
|
|
2903
|
+
* 直播推流、自定义布局配置
|
|
2684
2904
|
*/
|
|
2685
|
-
|
|
2905
|
+
setMcuConfig(headers: IMCUReqHeaders, body: IMCUConfig | ISetEnableCDN): Promise<{
|
|
2906
|
+
code: RCRTCCode;
|
|
2907
|
+
res?: any;
|
|
2908
|
+
}>;
|
|
2686
2909
|
/**
|
|
2687
|
-
*
|
|
2910
|
+
* 房间内观众获取 CDN 资源信息、拉流地址
|
|
2688
2911
|
*/
|
|
2689
|
-
|
|
2912
|
+
getCDNResourceInfo(headers: ICDNPlayUrlReqHeaders, url: string): Promise<{
|
|
2913
|
+
code: RCRTCCode;
|
|
2914
|
+
res?: ICDNPlayUrlResponse;
|
|
2915
|
+
}>;
|
|
2690
2916
|
}
|
|
2691
2917
|
|
|
2692
2918
|
/**
|
|
@@ -2926,7 +3152,11 @@ declare class RCLivingRoom extends RCAbstractRoom {
|
|
|
2926
3152
|
/**
|
|
2927
3153
|
* 是否是主房间
|
|
2928
3154
|
*/
|
|
2929
|
-
_isMainRoom: boolean
|
|
3155
|
+
_isMainRoom: boolean,
|
|
3156
|
+
/**
|
|
3157
|
+
* 是否使用多 peerConnection
|
|
3158
|
+
*/
|
|
3159
|
+
useMutilPeerC?: boolean);
|
|
2930
3160
|
/**
|
|
2931
3161
|
* resourceId 有效性验证
|
|
2932
3162
|
* @param resourceId
|
|
@@ -2987,7 +3217,7 @@ declare class RCLivingRoom extends RCAbstractRoom {
|
|
|
2987
3217
|
/**
|
|
2988
3218
|
* 重写父类 _exchangeHandle 方法
|
|
2989
3219
|
*/
|
|
2990
|
-
protected _exchangeHandle(body: IExchangeReqBody): Promise<{
|
|
3220
|
+
protected _exchangeHandle(body: IExchangeReqBody, pcId: string): Promise<{
|
|
2991
3221
|
code: RCRTCCode;
|
|
2992
3222
|
data?: IExchangeResponse | undefined;
|
|
2993
3223
|
}>;
|
|
@@ -3032,7 +3262,7 @@ declare class RCLivingRoom extends RCAbstractRoom {
|
|
|
3032
3262
|
/**
|
|
3033
3263
|
* 退出所有连麦房间
|
|
3034
3264
|
*/
|
|
3035
|
-
protected _quitAllPKRoom(): void
|
|
3265
|
+
protected _quitAllPKRoom(): Promise<void>;
|
|
3036
3266
|
/**
|
|
3037
3267
|
* 是否是主房间
|
|
3038
3268
|
*/
|
|
@@ -3043,7 +3273,11 @@ declare class RCLivingRoom extends RCAbstractRoom {
|
|
|
3043
3273
|
* 普通音视频房间
|
|
3044
3274
|
*/
|
|
3045
3275
|
declare class RCRTCRoom extends RCAbstractRoom {
|
|
3046
|
-
constructor(context: RTCPluginContext, runtime: IRuntime, roomId: string, data: IJoinRTCRoomData, service: RCMediaService, initOptions: IRCRTCInitOptions, clientEvent: Function
|
|
3276
|
+
constructor(context: RTCPluginContext, runtime: IRuntime, roomId: string, data: IJoinRTCRoomData, service: RCMediaService, initOptions: IRCRTCInitOptions, clientEvent: Function,
|
|
3277
|
+
/**
|
|
3278
|
+
* 是否使用多 peerConnection
|
|
3279
|
+
*/
|
|
3280
|
+
useMutilPeerC?: boolean);
|
|
3047
3281
|
}
|
|
3048
3282
|
|
|
3049
3283
|
/**
|
|
@@ -3051,6 +3285,10 @@ declare class RCRTCRoom extends RCAbstractRoom {
|
|
|
3051
3285
|
*/
|
|
3052
3286
|
declare class RCAudienceClient {
|
|
3053
3287
|
private readonly _context;
|
|
3288
|
+
/**
|
|
3289
|
+
* 是否使用多 peerConnection
|
|
3290
|
+
*/
|
|
3291
|
+
private readonly _useMutilPeerC?;
|
|
3054
3292
|
private _pc;
|
|
3055
3293
|
private _service;
|
|
3056
3294
|
/**
|
|
@@ -3069,7 +3307,19 @@ declare class RCAudienceClient {
|
|
|
3069
3307
|
* 客户端传入的数据上报事件
|
|
3070
3308
|
*/
|
|
3071
3309
|
private _reportListener;
|
|
3072
|
-
|
|
3310
|
+
/**
|
|
3311
|
+
* 使用的 peerConnection 对应 id
|
|
3312
|
+
*/
|
|
3313
|
+
private _pcId;
|
|
3314
|
+
/**
|
|
3315
|
+
* peerConnection 管理类
|
|
3316
|
+
*/
|
|
3317
|
+
private _peerCManager;
|
|
3318
|
+
constructor(_context: RTCPluginContext, runtime: IRuntime, _initOption: IRCRTCInitOptions,
|
|
3319
|
+
/**
|
|
3320
|
+
* 是否使用多 peerConnection
|
|
3321
|
+
*/
|
|
3322
|
+
_useMutilPeerC?: boolean | undefined);
|
|
3073
3323
|
private _getReqHeaders;
|
|
3074
3324
|
private _clearSubscribeInfo;
|
|
3075
3325
|
private _livingType;
|
|
@@ -3140,7 +3390,7 @@ declare class RCRTCClient {
|
|
|
3140
3390
|
* @param joinType 多端处理方式
|
|
3141
3391
|
* @param outerUserDatas 业务层设置人员属性
|
|
3142
3392
|
*/
|
|
3143
|
-
joinRTCRoom(roomId: string, joinType?: RTCJoinType, outerUserDatas?: IRTCUserData): Promise<{
|
|
3393
|
+
joinRTCRoom(roomId: string, joinType?: RTCJoinType, outerUserDatas?: IRTCUserData, useMutilPeerC?: boolean): Promise<{
|
|
3144
3394
|
room?: RCRTCRoom;
|
|
3145
3395
|
code: RCRTCCode;
|
|
3146
3396
|
userIds?: string[];
|
|
@@ -3154,7 +3404,7 @@ declare class RCRTCClient {
|
|
|
3154
3404
|
* @param joinType 多端处理方式
|
|
3155
3405
|
* @param outerUserDatas 业务层设置人员属性
|
|
3156
3406
|
*/
|
|
3157
|
-
joinLivingRoom(roomId: string, livingType: RCLivingType, joinType?: RTCJoinType, outerUserDatas?: IRTCUserData): Promise<{
|
|
3407
|
+
joinLivingRoom(roomId: string, livingType: RCLivingType, joinType?: RTCJoinType, outerUserDatas?: IRTCUserData, useMutilPeerC?: boolean): Promise<{
|
|
3158
3408
|
room?: RCLivingRoom;
|
|
3159
3409
|
code: RCRTCCode;
|
|
3160
3410
|
userIds?: string[];
|
|
@@ -3166,7 +3416,7 @@ declare class RCRTCClient {
|
|
|
3166
3416
|
/**
|
|
3167
3417
|
* 获取直播观众客户端
|
|
3168
3418
|
*/
|
|
3169
|
-
getAudienceClient(): RCAudienceClient;
|
|
3419
|
+
getAudienceClient(useMutilPeerC?: boolean): RCAudienceClient;
|
|
3170
3420
|
private _onIMStatusChange;
|
|
3171
3421
|
private _onIMDisconnect;
|
|
3172
3422
|
private _onIMUninit;
|
|
@@ -3274,7 +3524,7 @@ declare class RCRTCClient {
|
|
|
3274
3524
|
* @param roomId 房间 ID
|
|
3275
3525
|
* @param livingType 直播类型(音频直播 or 音视频直播)
|
|
3276
3526
|
*/
|
|
3277
|
-
joinLivingRoomAsAudience(roomId: string, livingType: RCLivingType): Promise<{
|
|
3527
|
+
joinLivingRoomAsAudience(roomId: string, livingType: RCLivingType, useMutilPeerC?: boolean): Promise<{
|
|
3278
3528
|
room?: RCAudienceLivingRoom;
|
|
3279
3529
|
code: RCRTCCode;
|
|
3280
3530
|
userIds?: string[];
|