@rongcloud/plugin-rtc 5.1.9 → 5.1.10-enterprise-alpha.1
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 +357 -88
- package/dist/index.esm.js +12414 -15
- package/dist/index.js +12441 -15
- package/dist/index.umd.js +12445 -15
- package/package.json +3 -3
package/dist/index.d.ts
CHANGED
|
@@ -1,65 +1,10 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* RCRTC - v5.1.
|
|
3
|
-
* CommitId -
|
|
4
|
-
* Fri
|
|
2
|
+
* RCRTC - v5.1.10-enterprise-alpha.1
|
|
3
|
+
* CommitId - fd018d861ee559d5654f78e584f53501c391cb97
|
|
4
|
+
* Fri Dec 03 2021 17:10:17 GMT+0800 (China Standard Time)
|
|
5
5
|
* ©2020 RongCloud, Inc. All rights reserved.
|
|
6
6
|
*/
|
|
7
|
-
import { EventEmitter, LogLevel, RTCMode, IRuntime, RTCPluginContext, IJoinRTCRoomData, IReceivedMessage, KVString, ErrorCode, IPluginGenerator } from '@rongcloud/engine';
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* 媒体资源类型
|
|
11
|
-
*/
|
|
12
|
-
declare enum RCMediaType {
|
|
13
|
-
/**
|
|
14
|
-
* 音频流
|
|
15
|
-
*/
|
|
16
|
-
AUDIO_ONLY = 0,
|
|
17
|
-
/**
|
|
18
|
-
* 视频流
|
|
19
|
-
*/
|
|
20
|
-
VIDEO_ONLY = 1,
|
|
21
|
-
/**
|
|
22
|
-
* 音视频混合流,只在 web 端存在混合流的情况
|
|
23
|
-
*/
|
|
24
|
-
AUDIO_VIDEO = 2
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
declare enum RCFrameRate {
|
|
28
|
-
FPS_10 = "FPS_10",
|
|
29
|
-
FPS_15 = "FPS_15",
|
|
30
|
-
FPS_24 = "FPS_24",
|
|
31
|
-
FPS_30 = "FPS_30"
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
declare enum RCResolution {
|
|
35
|
-
W176_H132 = "W176_H132",
|
|
36
|
-
W176_H144 = "W176_H144",
|
|
37
|
-
W256_H144 = "W256_H144",
|
|
38
|
-
W320_H180 = "W320_H180",
|
|
39
|
-
W240_H240 = "W240_H240",
|
|
40
|
-
W320_H240 = "W320_H240",
|
|
41
|
-
W480_H360 = "W480_H360",
|
|
42
|
-
W640_H360 = "W640_H360",
|
|
43
|
-
W480_H480 = "W480_H480",
|
|
44
|
-
W640_H480 = "W640_H480",
|
|
45
|
-
W720_H480 = "W720_H480",
|
|
46
|
-
W1280_H720 = "W1280_H720",
|
|
47
|
-
W1920_H1080 = "W1920_H1080"
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
/**
|
|
51
|
-
* 流状态
|
|
52
|
-
*/
|
|
53
|
-
declare enum TrackState {
|
|
54
|
-
/**
|
|
55
|
-
* 不可用
|
|
56
|
-
*/
|
|
57
|
-
DISABLE = 0,
|
|
58
|
-
/**
|
|
59
|
-
* 可用
|
|
60
|
-
*/
|
|
61
|
-
ENABLE = 1
|
|
62
|
-
}
|
|
7
|
+
import { EventEmitter, LogLevel, RTCMode, IRuntime, RTCPluginContext, IServerRTCRoomEntry, IJoinRTCRoomData, IReceivedMessage, KVString, ErrorCode, IPluginGenerator } from '@rongcloud/engine';
|
|
63
8
|
|
|
64
9
|
/**
|
|
65
10
|
* 错误码,与移动端对齐
|
|
@@ -132,7 +77,78 @@ declare enum RCRTCCode {
|
|
|
132
77
|
/** 公有云 SDK 包不允许使用私有云环境 */
|
|
133
78
|
PACKAGE_ENVIRONMENT_ERROR = 53025,
|
|
134
79
|
/** 单个用户发布资源超过限制 ( MediaServer 限制最多 10 个 track ) */
|
|
135
|
-
PUBLISH_TRACK_LIMIT_EXCEEDED = 53026
|
|
80
|
+
PUBLISH_TRACK_LIMIT_EXCEEDED = 53026,
|
|
81
|
+
/** 房间内无主播推 CDN */
|
|
82
|
+
CDN_RESOURCE_IS_EMPTY = 53027
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* 媒体资源类型
|
|
87
|
+
*/
|
|
88
|
+
declare enum RCMediaType {
|
|
89
|
+
/**
|
|
90
|
+
* 音频流
|
|
91
|
+
*/
|
|
92
|
+
AUDIO_ONLY = 0,
|
|
93
|
+
/**
|
|
94
|
+
* 视频流
|
|
95
|
+
*/
|
|
96
|
+
VIDEO_ONLY = 1,
|
|
97
|
+
/**
|
|
98
|
+
* 音视频混合流,只在 web 端存在混合流的情况
|
|
99
|
+
*/
|
|
100
|
+
AUDIO_VIDEO = 2
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* 资源大小流标识枚举
|
|
105
|
+
*/
|
|
106
|
+
declare enum RCStreamType {
|
|
107
|
+
/**
|
|
108
|
+
* 普通流(大流)
|
|
109
|
+
*/
|
|
110
|
+
NORMAL = 1,
|
|
111
|
+
/**
|
|
112
|
+
* 小流
|
|
113
|
+
*/
|
|
114
|
+
TINY = 2
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
declare enum RCFrameRate {
|
|
118
|
+
FPS_10 = "FPS_10",
|
|
119
|
+
FPS_15 = "FPS_15",
|
|
120
|
+
FPS_24 = "FPS_24",
|
|
121
|
+
FPS_30 = "FPS_30"
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
declare enum RCResolution {
|
|
125
|
+
W176_H132 = "W176_H132",
|
|
126
|
+
W176_H144 = "W176_H144",
|
|
127
|
+
W256_H144 = "W256_H144",
|
|
128
|
+
W320_H180 = "W320_H180",
|
|
129
|
+
W240_H240 = "W240_H240",
|
|
130
|
+
W320_H240 = "W320_H240",
|
|
131
|
+
W480_H360 = "W480_H360",
|
|
132
|
+
W640_H360 = "W640_H360",
|
|
133
|
+
W480_H480 = "W480_H480",
|
|
134
|
+
W640_H480 = "W640_H480",
|
|
135
|
+
W720_H480 = "W720_H480",
|
|
136
|
+
W1280_H720 = "W1280_H720",
|
|
137
|
+
W1920_H1080 = "W1920_H1080"
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* 流状态
|
|
142
|
+
*/
|
|
143
|
+
declare enum TrackState {
|
|
144
|
+
/**
|
|
145
|
+
* 不可用
|
|
146
|
+
*/
|
|
147
|
+
DISABLE = 0,
|
|
148
|
+
/**
|
|
149
|
+
* 可用
|
|
150
|
+
*/
|
|
151
|
+
ENABLE = 1
|
|
136
152
|
}
|
|
137
153
|
|
|
138
154
|
declare abstract class RCTrack extends EventEmitter {
|
|
@@ -339,20 +355,6 @@ declare class RCRemoteVideoTrack extends RCRemoteTrack {
|
|
|
339
355
|
constructor(tag: string, userId: string, roomId?: string);
|
|
340
356
|
}
|
|
341
357
|
|
|
342
|
-
/**
|
|
343
|
-
* 资源大小流标识枚举
|
|
344
|
-
*/
|
|
345
|
-
declare enum RCStreamType {
|
|
346
|
-
/**
|
|
347
|
-
* 普通流(大流)
|
|
348
|
-
*/
|
|
349
|
-
NORMAL = 1,
|
|
350
|
-
/**
|
|
351
|
-
* 小流
|
|
352
|
-
*/
|
|
353
|
-
TINY = 2
|
|
354
|
-
}
|
|
355
|
-
|
|
356
358
|
interface IStatParser {
|
|
357
359
|
/**
|
|
358
360
|
* 取消发布后,需把 _latestPacketsSent 中 key 为 resourceId 存储的数据清除掉
|
|
@@ -388,6 +390,17 @@ declare type OutboundVideoInfo = {
|
|
|
388
390
|
resolution: string;
|
|
389
391
|
};
|
|
390
392
|
|
|
393
|
+
declare enum RCInnerCDNPullKind {
|
|
394
|
+
RTMP = "rtmp",
|
|
395
|
+
FLV = "flv",
|
|
396
|
+
HLS = "hls"
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
declare enum RCInnerCDNPullIsHttps {
|
|
400
|
+
NOT_HTTPS = 0,
|
|
401
|
+
HTTPS = 1
|
|
402
|
+
}
|
|
403
|
+
|
|
391
404
|
interface IRCTrackBitrate {
|
|
392
405
|
/**
|
|
393
406
|
* 最大码率
|
|
@@ -767,6 +780,10 @@ interface IRoomEventListener extends IRCRTCTrackEventListener {
|
|
|
767
780
|
* @param userIds
|
|
768
781
|
*/
|
|
769
782
|
onUserLeave?(userIds: string[]): void;
|
|
783
|
+
/**
|
|
784
|
+
* 主播开启、停止推 CDN 状态通知
|
|
785
|
+
*/
|
|
786
|
+
onCDNEnableChange?(enable: boolean): void;
|
|
770
787
|
}
|
|
771
788
|
/**
|
|
772
789
|
* RTCClient 初始化配置
|
|
@@ -806,6 +823,14 @@ interface IRCRTCInitOptions {
|
|
|
806
823
|
* 优化使用的 SDP 协议版本,仅当运行时浏览器支持相应 SDP 协议版本时生效
|
|
807
824
|
*/
|
|
808
825
|
sdpSemantics?: ISdpSemantics;
|
|
826
|
+
/**
|
|
827
|
+
* 观众拉内置 CDN 资源的直播拉流协议,默认为 RCInnerCDNPullKind.FLV
|
|
828
|
+
*/
|
|
829
|
+
pullInnerCDNProtocol?: RCInnerCDNPullKind;
|
|
830
|
+
/**
|
|
831
|
+
* 观众拉内置 CDN 资源时是否使用 https,默认为 RCInnerCDNPullIsHttps.HTTPS
|
|
832
|
+
*/
|
|
833
|
+
pullInnerCDNUseHttps?: RCInnerCDNPullIsHttps;
|
|
809
834
|
}
|
|
810
835
|
interface ICameraVideoProfile extends IVideoProfile {
|
|
811
836
|
cameraId?: string;
|
|
@@ -825,12 +850,31 @@ interface ICreateLocalTrackOptions {
|
|
|
825
850
|
*/
|
|
826
851
|
withoutVideo?: boolean;
|
|
827
852
|
}
|
|
853
|
+
/**
|
|
854
|
+
* 音量上报事件接口
|
|
855
|
+
*/
|
|
828
856
|
interface IAudioLevelChangeHandler {
|
|
829
857
|
(audioLevelReportList: {
|
|
830
858
|
track: RCLocalAudioTrack | RCRemoteAudioTrack;
|
|
831
859
|
audioLevel: number;
|
|
832
860
|
}[]): void;
|
|
833
861
|
}
|
|
862
|
+
/**
|
|
863
|
+
* 房间资源数据
|
|
864
|
+
*/
|
|
865
|
+
declare type RoomData = {
|
|
866
|
+
[userId: string]: IPublishedResource[];
|
|
867
|
+
};
|
|
868
|
+
|
|
869
|
+
declare enum RCInnerCDNPushMode {
|
|
870
|
+
AUTOMATIC = 0,
|
|
871
|
+
MANUAL = 1
|
|
872
|
+
}
|
|
873
|
+
|
|
874
|
+
declare enum RCInnerCDNBroadcast {
|
|
875
|
+
SPREAD = 0,
|
|
876
|
+
NO_SPREAD = -1
|
|
877
|
+
}
|
|
834
878
|
|
|
835
879
|
/**
|
|
836
880
|
* 与 MediaServer 交互所需的 Request Header 信息
|
|
@@ -930,6 +974,10 @@ interface ILiveUrls {
|
|
|
930
974
|
* 观众端订阅地址,由业务层分发
|
|
931
975
|
*/
|
|
932
976
|
liveUrl: string;
|
|
977
|
+
/**
|
|
978
|
+
* 自动推 CDN 模式下,发布资源后返回的 CDN 信息
|
|
979
|
+
*/
|
|
980
|
+
pull_url?: string;
|
|
933
981
|
}
|
|
934
982
|
interface IRTCResponse {
|
|
935
983
|
/**
|
|
@@ -983,6 +1031,15 @@ interface IExchangeResponse extends IRTCResponse {
|
|
|
983
1031
|
* 主播发布为具体资源,会议模式为空数组
|
|
984
1032
|
*/
|
|
985
1033
|
mcuPublishList?: IResource[];
|
|
1034
|
+
/**
|
|
1035
|
+
* 订阅成功的资源
|
|
1036
|
+
*/
|
|
1037
|
+
subscribedList?: {
|
|
1038
|
+
mediaType: RCMediaType.AUDIO_ONLY | RCMediaType.VIDEO_ONLY;
|
|
1039
|
+
msid: string;
|
|
1040
|
+
userId: string;
|
|
1041
|
+
simulcast?: RCStreamType;
|
|
1042
|
+
}[];
|
|
986
1043
|
}
|
|
987
1044
|
interface IBroadcastSubReqBody {
|
|
988
1045
|
/**
|
|
@@ -1043,6 +1100,56 @@ interface IBroadcastSubRespBody extends IRTCResponse {
|
|
|
1043
1100
|
sdp: string;
|
|
1044
1101
|
};
|
|
1045
1102
|
}
|
|
1103
|
+
/**
|
|
1104
|
+
* 获取 CDN 资源拉流地址请求 headers
|
|
1105
|
+
*/
|
|
1106
|
+
interface ICDNPlayUrlReqHeaders extends IMCUReqHeaders {
|
|
1107
|
+
}
|
|
1108
|
+
/**
|
|
1109
|
+
* 获取 CDN 资源拉流地址响应
|
|
1110
|
+
*/
|
|
1111
|
+
interface ICDNPlayUrlResponse extends IRTCResponse {
|
|
1112
|
+
data: {
|
|
1113
|
+
fps: number;
|
|
1114
|
+
h: number;
|
|
1115
|
+
'pull_url': string;
|
|
1116
|
+
w: number;
|
|
1117
|
+
};
|
|
1118
|
+
}
|
|
1119
|
+
/**
|
|
1120
|
+
* cdn_uris 里面包含的字段
|
|
1121
|
+
*/
|
|
1122
|
+
interface ICDNUris {
|
|
1123
|
+
/**
|
|
1124
|
+
* 是否扩散
|
|
1125
|
+
*/
|
|
1126
|
+
broadcast: RCInnerCDNBroadcast;
|
|
1127
|
+
/**
|
|
1128
|
+
* 拉流资源的宽度
|
|
1129
|
+
*/
|
|
1130
|
+
w?: number;
|
|
1131
|
+
/**
|
|
1132
|
+
* 拉流资源的高度
|
|
1133
|
+
*/
|
|
1134
|
+
h?: number;
|
|
1135
|
+
/**
|
|
1136
|
+
* 帧率
|
|
1137
|
+
*/
|
|
1138
|
+
fps?: number;
|
|
1139
|
+
/**
|
|
1140
|
+
* 获取拉流地址的 url
|
|
1141
|
+
*/
|
|
1142
|
+
url: string;
|
|
1143
|
+
/**
|
|
1144
|
+
* 开启、停用 CDN
|
|
1145
|
+
*/
|
|
1146
|
+
enableInnerCDN?: boolean;
|
|
1147
|
+
/**
|
|
1148
|
+
* 推送模式,手动 or 自动
|
|
1149
|
+
*/
|
|
1150
|
+
'push_mode': RCInnerCDNPushMode;
|
|
1151
|
+
'pull_safe': boolean;
|
|
1152
|
+
}
|
|
1046
1153
|
|
|
1047
1154
|
/**
|
|
1048
1155
|
* 直播布局模式定义
|
|
@@ -1076,6 +1183,11 @@ declare enum MixVideoRenderMode {
|
|
|
1076
1183
|
WHOLE = 2
|
|
1077
1184
|
}
|
|
1078
1185
|
|
|
1186
|
+
declare enum RCInnerCDNModel {
|
|
1187
|
+
OPEN = 1,
|
|
1188
|
+
STOP = 2
|
|
1189
|
+
}
|
|
1190
|
+
|
|
1079
1191
|
/**
|
|
1080
1192
|
* 合流后的 video 输出编码配置,包含分辨率、帧率、码率配置项
|
|
1081
1193
|
*/
|
|
@@ -1323,6 +1435,18 @@ interface IMCUConfig {
|
|
|
1323
1435
|
*/
|
|
1324
1436
|
waterMark?: IMCUWaterMarkConfig;
|
|
1325
1437
|
}
|
|
1438
|
+
/**
|
|
1439
|
+
* 设置开启、停用内置 CDN 数据
|
|
1440
|
+
*/
|
|
1441
|
+
interface ISetEnableCDN {
|
|
1442
|
+
version: 2;
|
|
1443
|
+
output: {
|
|
1444
|
+
/**
|
|
1445
|
+
* 手动开启/停用内置 CDN
|
|
1446
|
+
*/
|
|
1447
|
+
inCDNModel: RCInnerCDNModel;
|
|
1448
|
+
};
|
|
1449
|
+
}
|
|
1326
1450
|
|
|
1327
1451
|
declare class RCMediaService {
|
|
1328
1452
|
private readonly _runtime;
|
|
@@ -1403,8 +1527,16 @@ declare class RCMediaService {
|
|
|
1403
1527
|
/**
|
|
1404
1528
|
* 直播推流、自定义布局配置
|
|
1405
1529
|
*/
|
|
1406
|
-
setMcuConfig(headers: IMCUReqHeaders, body: IMCUConfig): Promise<{
|
|
1530
|
+
setMcuConfig(headers: IMCUReqHeaders, body: IMCUConfig | ISetEnableCDN): Promise<{
|
|
1407
1531
|
code: RCRTCCode;
|
|
1532
|
+
res?: any;
|
|
1533
|
+
}>;
|
|
1534
|
+
/**
|
|
1535
|
+
* 房间内观众获取 CDN 资源信息、拉流地址
|
|
1536
|
+
*/
|
|
1537
|
+
getCDNResourceInfo(headers: ICDNPlayUrlReqHeaders, url: string): Promise<{
|
|
1538
|
+
code: RCRTCCode;
|
|
1539
|
+
res?: ICDNPlayUrlResponse;
|
|
1408
1540
|
}>;
|
|
1409
1541
|
}
|
|
1410
1542
|
|
|
@@ -1476,6 +1608,24 @@ interface IAudienceRoomEventListener extends IRCRTCTrackEventListener {
|
|
|
1476
1608
|
* @param videoTrack RCRemoteVideoTrack 类实例对象
|
|
1477
1609
|
*/
|
|
1478
1610
|
onVideoMuteChange?(videoTrack: RCRemoteVideoTrack): void;
|
|
1611
|
+
/**
|
|
1612
|
+
* 房间内主播把发布的资源推至 CDN
|
|
1613
|
+
*/
|
|
1614
|
+
onCDNInfoEnable?(CDNInfo: {
|
|
1615
|
+
resolution: RCResolution;
|
|
1616
|
+
fps: RCFrameRate;
|
|
1617
|
+
}): void;
|
|
1618
|
+
/**
|
|
1619
|
+
* 主播停止推 CDN
|
|
1620
|
+
*/
|
|
1621
|
+
onCDNInfoDisable?(): void;
|
|
1622
|
+
/**
|
|
1623
|
+
* 主播改变推 CDN 的分辨率或帧率
|
|
1624
|
+
*/
|
|
1625
|
+
onCDNInfoChange?(CDNInfo: {
|
|
1626
|
+
resolution: RCResolution;
|
|
1627
|
+
fps: RCFrameRate;
|
|
1628
|
+
}): void;
|
|
1479
1629
|
}
|
|
1480
1630
|
/**
|
|
1481
1631
|
* 观众直播房间类
|
|
@@ -1488,7 +1638,7 @@ declare class RCAudienceLivingRoom {
|
|
|
1488
1638
|
private readonly _runtime;
|
|
1489
1639
|
private readonly _initOptions;
|
|
1490
1640
|
readonly _roomId: string;
|
|
1491
|
-
private readonly
|
|
1641
|
+
private readonly _joinResData;
|
|
1492
1642
|
readonly _livingType: RCLivingType;
|
|
1493
1643
|
private readonly _service;
|
|
1494
1644
|
private _roomAnchorList;
|
|
@@ -1508,7 +1658,14 @@ declare class RCAudienceLivingRoom {
|
|
|
1508
1658
|
* 音量上报实例
|
|
1509
1659
|
*/
|
|
1510
1660
|
private _audioLevelReport;
|
|
1511
|
-
|
|
1661
|
+
/**
|
|
1662
|
+
* cdn_uris 资源
|
|
1663
|
+
*/
|
|
1664
|
+
private _CDNUris;
|
|
1665
|
+
constructor(_context: RTCPluginContext, _runtime: IRuntime, _initOptions: IRCRTCInitOptions, _roomId: string, _joinResData: {
|
|
1666
|
+
token: string;
|
|
1667
|
+
kvEntries?: IServerRTCRoomEntry[];
|
|
1668
|
+
}, _livingType: RCLivingType);
|
|
1512
1669
|
protected _assertRoomDestroyed(): RCRTCCode | undefined;
|
|
1513
1670
|
/**
|
|
1514
1671
|
* @description 信令数据处理
|
|
@@ -1517,6 +1674,7 @@ declare class RCAudienceLivingRoom {
|
|
|
1517
1674
|
* * key RC_ANCHOR_LIST value: 为主播 ID 集合
|
|
1518
1675
|
* * key RC_RES_`userId` value: 为主播发布的资源
|
|
1519
1676
|
* * key RC_RTC_SESSIONID value: sessionId
|
|
1677
|
+
* * key RC_CDN value: CDN 资源数据
|
|
1520
1678
|
*/
|
|
1521
1679
|
private singalDataChange;
|
|
1522
1680
|
/**
|
|
@@ -1559,12 +1717,33 @@ declare class RCAudienceLivingRoom {
|
|
|
1559
1717
|
private _getReqHeaders;
|
|
1560
1718
|
private _exchangeHandle;
|
|
1561
1719
|
private _updateSubListHandle;
|
|
1720
|
+
/**
|
|
1721
|
+
* 对比 cdn_uris 资源
|
|
1722
|
+
* @param newCDNUris 新的 cdn_uris 数据
|
|
1723
|
+
*/
|
|
1724
|
+
private _diffCDNUris;
|
|
1725
|
+
/**
|
|
1726
|
+
* 获取 CDN 资源对应的拉流地址
|
|
1727
|
+
* 首次获取 CDNPlayUrl 时,需传入 url,
|
|
1728
|
+
* 业务层调用时使用内存中 _CDNUris 的 url,无 _CDNUris 时说明观众端未赋值过 _CDNUris
|
|
1729
|
+
* @returns CDNPlayUrl
|
|
1730
|
+
*/
|
|
1731
|
+
private _getCDNPlayUrl;
|
|
1732
|
+
/**
|
|
1733
|
+
* 获取 CDN 资源对应的拉流地址
|
|
1734
|
+
* @returns CDNPlayUrl
|
|
1735
|
+
*/
|
|
1736
|
+
getCDNPlayUrl(resolution?: RCResolution, fps?: RCFrameRate): Promise<{
|
|
1737
|
+
code: RCRTCCode;
|
|
1738
|
+
CDNPlayUrl?: string;
|
|
1739
|
+
}>;
|
|
1562
1740
|
/**
|
|
1563
1741
|
* 订阅资源
|
|
1564
1742
|
* @param tracks
|
|
1565
1743
|
*/
|
|
1566
1744
|
subscribe(tracks: (RCRemoteTrack | ISubscribeAttr)[]): Promise<{
|
|
1567
1745
|
code: RCRTCCode;
|
|
1746
|
+
failedList?: ISubscribeAttr[];
|
|
1568
1747
|
}>;
|
|
1569
1748
|
private __unsubscribe;
|
|
1570
1749
|
/**
|
|
@@ -1573,6 +1752,7 @@ declare class RCAudienceLivingRoom {
|
|
|
1573
1752
|
*/
|
|
1574
1753
|
unsubscribe(tracks: RCRemoteTrack[]): Promise<{
|
|
1575
1754
|
code: RCRTCCode;
|
|
1755
|
+
failedList?: ISubscribeAttr[];
|
|
1576
1756
|
}>;
|
|
1577
1757
|
/**
|
|
1578
1758
|
* 退出房间并销毁当前房间实例,退出后该房间的所有方法将不可用
|
|
@@ -1759,9 +1939,6 @@ declare class RCRTCPeerConnection extends EventEmitter {
|
|
|
1759
1939
|
clearReTryExchangeTimer(): void;
|
|
1760
1940
|
}
|
|
1761
1941
|
|
|
1762
|
-
declare type RoomData = {
|
|
1763
|
-
[userId: string]: IPublishedResource[];
|
|
1764
|
-
};
|
|
1765
1942
|
/**
|
|
1766
1943
|
* 房间抽象基类
|
|
1767
1944
|
*/
|
|
@@ -1823,7 +2000,7 @@ declare abstract class RCAbstractRoom {
|
|
|
1823
2000
|
*/
|
|
1824
2001
|
setBitrate(max: number, min: number, start?: number): void;
|
|
1825
2002
|
private _onTrackReady;
|
|
1826
|
-
|
|
2003
|
+
protected _callAppListener(eventType: keyof IRoomEventListener, ...attrs: any[]): void;
|
|
1827
2004
|
private _onUserUnpublish;
|
|
1828
2005
|
private _onTrackUnpublish;
|
|
1829
2006
|
private _unpublishPrev;
|
|
@@ -1843,7 +2020,18 @@ declare abstract class RCAbstractRoom {
|
|
|
1843
2020
|
* @param messageType 消息类型
|
|
1844
2021
|
* @param userId 消息发送者
|
|
1845
2022
|
*/
|
|
1846
|
-
|
|
2023
|
+
protected _resourceHandle(content: {
|
|
2024
|
+
/**
|
|
2025
|
+
* 旧版本兼容参数,当收到非 `RTCMessageName.TOTAL_CONTENT_RESOURCE` 时:
|
|
2026
|
+
* * ignore 值为 `true` 表示该消息由 signal server 向旧版本 RTCLib 提供的兼容消息,无需处理
|
|
2027
|
+
* * 否则认为该消息是由旧版本 RTCLib 主动发出的增量变更消息,需要处理
|
|
2028
|
+
*/
|
|
2029
|
+
ignore?: boolean;
|
|
2030
|
+
/**
|
|
2031
|
+
* 发布到房间内的资源列表,`RTCMessageName.TOTAL_CONTENT_RESOURCE` 消息携带全量数据,否则为增量数据
|
|
2032
|
+
*/
|
|
2033
|
+
uris: IPublishedResource[];
|
|
2034
|
+
}, messageType: string, userId: string): Promise<void>;
|
|
1847
2035
|
private _onTrackPublish;
|
|
1848
2036
|
/**
|
|
1849
2037
|
* 处理 `RCRTCMessageType.STATE` 消息
|
|
@@ -1978,8 +2166,11 @@ declare abstract class RCAbstractRoom {
|
|
|
1978
2166
|
* ice 断线后,尝试重新走 exchange
|
|
1979
2167
|
*/
|
|
1980
2168
|
protected _reTryExchange(): Promise<void>;
|
|
1981
|
-
|
|
1982
|
-
|
|
2169
|
+
protected _exchangeHandle(body: IExchangeReqBody): Promise<{
|
|
2170
|
+
code: RCRTCCode;
|
|
2171
|
+
data?: IExchangeResponse | undefined;
|
|
2172
|
+
}>;
|
|
2173
|
+
protected _getRTCReqestHeaders(): IRTCReqHeader;
|
|
1983
2174
|
/**
|
|
1984
2175
|
* 获取 exchange 接口的请求体数据
|
|
1985
2176
|
* @param subscribeList 订阅清单
|
|
@@ -2015,6 +2206,7 @@ declare abstract class RCAbstractRoom {
|
|
|
2015
2206
|
*/
|
|
2016
2207
|
subscribe(tracks: (RCRemoteTrack | ISubscribeAttr)[]): Promise<{
|
|
2017
2208
|
code: RCRTCCode;
|
|
2209
|
+
failedList?: ISubscribeAttr[];
|
|
2018
2210
|
}>;
|
|
2019
2211
|
private __subscribe;
|
|
2020
2212
|
/**
|
|
@@ -2023,6 +2215,7 @@ declare abstract class RCAbstractRoom {
|
|
|
2023
2215
|
*/
|
|
2024
2216
|
unsubscribe(tracks: RCRemoteTrack[]): Promise<{
|
|
2025
2217
|
code: RCRTCCode;
|
|
2218
|
+
failedList?: ISubscribeAttr[];
|
|
2026
2219
|
}>;
|
|
2027
2220
|
private __unsubscribe;
|
|
2028
2221
|
protected _assertRoomDestroyed(): RCRTCCode | undefined;
|
|
@@ -2072,13 +2265,15 @@ declare abstract class RCAbstractRoom {
|
|
|
2072
2265
|
/**
|
|
2073
2266
|
* 断线重连后尝试补发断线过程中的通知信息
|
|
2074
2267
|
*/
|
|
2075
|
-
__onReconnected(livingType?: RCLivingType): Promise<
|
|
2268
|
+
__onReconnected(livingType?: RCLivingType): Promise<{
|
|
2269
|
+
data: IJoinRTCRoomData | undefined;
|
|
2270
|
+
} | void>;
|
|
2076
2271
|
private _onAudioMuteChange;
|
|
2077
2272
|
private _onVideoMuteChange;
|
|
2078
2273
|
/**
|
|
2079
2274
|
* 观众切换为主播后直接处理人员变更及资源变更
|
|
2080
2275
|
*/
|
|
2081
|
-
|
|
2276
|
+
protected _afterChangedRole(data: IJoinRTCRoomData): void;
|
|
2082
2277
|
/**
|
|
2083
2278
|
* 主播身份降级,取消己端已发布的所有资源
|
|
2084
2279
|
*/
|
|
@@ -2112,6 +2307,10 @@ declare class RCMCUConfigBuilder {
|
|
|
2112
2307
|
* trackId 有效性验证方法
|
|
2113
2308
|
*/
|
|
2114
2309
|
private readonly _isValidTrackId;
|
|
2310
|
+
/**
|
|
2311
|
+
* 扩散 cdn_uris
|
|
2312
|
+
*/
|
|
2313
|
+
private readonly _sendCDNInfoSignal;
|
|
2115
2314
|
/**
|
|
2116
2315
|
* mcu 配置数据,每次向服务器提交全量数据
|
|
2117
2316
|
*/
|
|
@@ -2126,7 +2325,11 @@ declare class RCMCUConfigBuilder {
|
|
|
2126
2325
|
/**
|
|
2127
2326
|
* trackId 有效性验证方法
|
|
2128
2327
|
*/
|
|
2129
|
-
_isValidTrackId: (trackId: string) => boolean
|
|
2328
|
+
_isValidTrackId: (trackId: string) => boolean,
|
|
2329
|
+
/**
|
|
2330
|
+
* 扩散 cdn_uris
|
|
2331
|
+
*/
|
|
2332
|
+
_sendCDNInfoSignal: () => void);
|
|
2130
2333
|
/**
|
|
2131
2334
|
* 设置合流后的主位置显示的视频流
|
|
2132
2335
|
* @param videoTrackId 视频流资源 Id
|
|
@@ -2257,6 +2460,11 @@ declare class RCMCUConfigBuilder {
|
|
|
2257
2460
|
declare class RCLivingRoom extends RCAbstractRoom {
|
|
2258
2461
|
private _livingType;
|
|
2259
2462
|
readonly _mcuConfigBuilder: RCMCUConfigBuilder;
|
|
2463
|
+
/**
|
|
2464
|
+
* cdn_uris 信令扩散数据
|
|
2465
|
+
*/
|
|
2466
|
+
private _CDNUris;
|
|
2467
|
+
private _CDNEnable;
|
|
2260
2468
|
constructor(context: RTCPluginContext, runtime: IRuntime, roomId: string, data: IJoinRTCRoomData, service: RCMediaService, initOptions: IRCRTCInitOptions, clientEvent: Function, _livingType: RCLivingType, isUpgrage?: boolean);
|
|
2261
2469
|
getLivingType(): RCLivingType;
|
|
2262
2470
|
/**
|
|
@@ -2268,7 +2476,67 @@ declare class RCLivingRoom extends RCAbstractRoom {
|
|
|
2268
2476
|
* @param data
|
|
2269
2477
|
*/
|
|
2270
2478
|
private _onMCUConfigFlush;
|
|
2479
|
+
/**
|
|
2480
|
+
* 主播端断线重连后,需更新内存中的 CDN 数据
|
|
2481
|
+
* 判断房间内 CDN 状态是否和内存数据一致,不一致时需通知到客户端
|
|
2482
|
+
*/
|
|
2271
2483
|
__onReconnected(): Promise<void>;
|
|
2484
|
+
/**
|
|
2485
|
+
* 开启/停用推 CDN
|
|
2486
|
+
*/
|
|
2487
|
+
enableInnerCDN(enable: boolean): Promise<{
|
|
2488
|
+
code: RCRTCCode;
|
|
2489
|
+
}>;
|
|
2490
|
+
/**
|
|
2491
|
+
* 开启、停用 CDN 推资源后发信令
|
|
2492
|
+
*/
|
|
2493
|
+
private _sendCDNInfoSignal;
|
|
2494
|
+
/**
|
|
2495
|
+
* 扩散 cdn_uris 资源
|
|
2496
|
+
*/
|
|
2497
|
+
private _spreadCDNInfo;
|
|
2498
|
+
/**
|
|
2499
|
+
* 给房间设置 CDN 数据
|
|
2500
|
+
*/
|
|
2501
|
+
private _setRoomCDNInfo;
|
|
2502
|
+
/**
|
|
2503
|
+
* 资源变化时触发
|
|
2504
|
+
* 直播房间需单独处理 cdn_uris
|
|
2505
|
+
*/
|
|
2506
|
+
protected _resourceHandle(content: {
|
|
2507
|
+
/**
|
|
2508
|
+
* 旧版本兼容参数,当收到非 `RTCMessageName.TOTAL_CONTENT_RESOURCE` 时:
|
|
2509
|
+
* * ignore 值为 `true` 表示该消息由 signal server 向旧版本 RTCLib 提供的兼容消息,无需处理
|
|
2510
|
+
* * 否则认为该消息是由旧版本 RTCLib 主动发出的增量变更消息,需要处理
|
|
2511
|
+
*/
|
|
2512
|
+
ignore?: boolean;
|
|
2513
|
+
/**
|
|
2514
|
+
* 发布到房间内的资源列表,`RTCMessageName.TOTAL_CONTENT_RESOURCE` 消息携带全量数据,否则为增量数据
|
|
2515
|
+
*/
|
|
2516
|
+
uris: IPublishedResource[];
|
|
2517
|
+
cdn_uris?: ICDNUris[];
|
|
2518
|
+
}, messageType: string, userId: string): Promise<void>;
|
|
2519
|
+
/**
|
|
2520
|
+
* 重写父类 _exchangeHandle 方法
|
|
2521
|
+
*/
|
|
2522
|
+
protected _exchangeHandle(body: IExchangeReqBody): Promise<{
|
|
2523
|
+
code: RCRTCCode;
|
|
2524
|
+
data?: IExchangeResponse | undefined;
|
|
2525
|
+
}>;
|
|
2526
|
+
/**
|
|
2527
|
+
* 观众切换为主播后直接处理人员变更及资源变更
|
|
2528
|
+
*/
|
|
2529
|
+
protected _afterChangedRole(data: IJoinRTCRoomData): void;
|
|
2530
|
+
/**
|
|
2531
|
+
* 返回 CDN 是否可用
|
|
2532
|
+
* @returns boolean
|
|
2533
|
+
*/
|
|
2534
|
+
__getCDNEnable(): boolean | undefined;
|
|
2535
|
+
/**
|
|
2536
|
+
* 返回 CDN 推送模式: 自动 or 手动
|
|
2537
|
+
* @returns boolean
|
|
2538
|
+
*/
|
|
2539
|
+
__getCDNPushMode(): RCInnerCDNPushMode | undefined;
|
|
2272
2540
|
}
|
|
2273
2541
|
|
|
2274
2542
|
/**
|
|
@@ -2382,6 +2650,7 @@ declare class RCRTCClient {
|
|
|
2382
2650
|
code: RCRTCCode;
|
|
2383
2651
|
userIds?: string[];
|
|
2384
2652
|
tracks?: RCRemoteTrack[];
|
|
2653
|
+
CDNEnable?: boolean;
|
|
2385
2654
|
}>;
|
|
2386
2655
|
private _joinLivingRoom;
|
|
2387
2656
|
private _audience;
|
|
@@ -2571,4 +2840,4 @@ declare const helper: {
|
|
|
2571
2840
|
ifSupportScreenShare: typeof ifSupportScreenShare;
|
|
2572
2841
|
};
|
|
2573
2842
|
|
|
2574
|
-
export { BackgroundPictureFillMode, ICameraVideoProfile, IMCUOutputConfig, IMCUOutputVideoConfig, IMicphoneAudioProfile, IPublishAttrs, IPublishedResource, IRCCandidatePairStat, IRCRTCInitOptions, IRCRTCReportListener, IRCRTCStateReport, IRCTrackStat, IRoomEventListener, ISubscribeAttr, IVideoProfile, MixLayoutMode, MixVideoRenderMode, RCAbstractRoom, RCAudienceClient, RCAudienceLivingRoom, RCCameraVideoTrack, RCFrameRate, RCLivingRoom, RCLivingType, RCLocalAudioTrack, RCLocalFileAudioTrack, RCLocalFileTrack, RCLocalFileVideoTrack, RCLocalTrack, RCLocalVideoTrack, RCMCUConfigBuilder, RCMediaType, RCMicphoneAudioTrack, RCRTCClient, RCRTCCode, RCRTCRoom, RCRemoteAudioTrack, RCRemoteTrack, RCRemoteVideoTrack, RCResolution, RCScreenVideoTrack, RCTag, RCTrack, device, helper, installer };
|
|
2843
|
+
export { BackgroundPictureFillMode, ICameraVideoProfile, IMCUOutputConfig, IMCUOutputVideoConfig, IMicphoneAudioProfile, IPublishAttrs, IPublishedResource, IRCCandidatePairStat, IRCRTCInitOptions, IRCRTCReportListener, IRCRTCStateReport, IRCTrackStat, IRoomEventListener, ISubscribeAttr, IVideoProfile, MixLayoutMode, MixVideoRenderMode, RCAbstractRoom, RCAudienceClient, RCAudienceLivingRoom, RCCameraVideoTrack, RCFrameRate, RCInnerCDNPullIsHttps, RCInnerCDNPullKind, RCLivingRoom, RCLivingType, RCLocalAudioTrack, RCLocalFileAudioTrack, RCLocalFileTrack, RCLocalFileVideoTrack, RCLocalTrack, RCLocalVideoTrack, RCMCUConfigBuilder, RCMediaType, RCMicphoneAudioTrack, RCRTCClient, RCRTCCode, RCRTCRoom, RCRemoteAudioTrack, RCRemoteTrack, RCRemoteVideoTrack, RCResolution, RCScreenVideoTrack, RCTag, RCTrack, device, helper, installer };
|