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