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