@rongcloud/plugin-rtc 5.1.10-alpha.3 → 5.2.2-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 +367 -95
- package/dist/index.esm.js +585 -127
- package/dist/index.js +583 -125
- package/dist/index.umd.js +583 -125
- package/package.json +3 -3
package/dist/index.d.ts
CHANGED
|
@@ -1,67 +1,12 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* RCRTC - v5.
|
|
3
|
-
* CommitId -
|
|
4
|
-
*
|
|
2
|
+
* RCRTC - v5.2.2-alpha.1
|
|
3
|
+
* CommitId - de4f9bc28bbee35d2d5f206a68144c89c098573f
|
|
4
|
+
* Mon Nov 22 2021 10:51:42 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,
|
|
7
|
+
import { EventEmitter, LogLevel, RTCMode, IRuntime, RTCPluginContext, IServerRTCRoomEntry, IJoinRTCRoomData, IReceivedMessage, KVString, RTCJoinType, IRTCJoinedInfo, IPluginGenerator } from '@rongcloud/engine';
|
|
8
8
|
export { RTCJoinType } from '@rongcloud/engine';
|
|
9
9
|
|
|
10
|
-
/**
|
|
11
|
-
* 媒体资源类型
|
|
12
|
-
*/
|
|
13
|
-
declare enum RCMediaType {
|
|
14
|
-
/**
|
|
15
|
-
* 音频流
|
|
16
|
-
*/
|
|
17
|
-
AUDIO_ONLY = 0,
|
|
18
|
-
/**
|
|
19
|
-
* 视频流
|
|
20
|
-
*/
|
|
21
|
-
VIDEO_ONLY = 1,
|
|
22
|
-
/**
|
|
23
|
-
* 音视频混合流,只在 web 端存在混合流的情况
|
|
24
|
-
*/
|
|
25
|
-
AUDIO_VIDEO = 2
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
declare enum RCFrameRate {
|
|
29
|
-
FPS_10 = "FPS_10",
|
|
30
|
-
FPS_15 = "FPS_15",
|
|
31
|
-
FPS_24 = "FPS_24",
|
|
32
|
-
FPS_30 = "FPS_30"
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
declare enum RCResolution {
|
|
36
|
-
W176_H132 = "W176_H132",
|
|
37
|
-
W176_H144 = "W176_H144",
|
|
38
|
-
W256_H144 = "W256_H144",
|
|
39
|
-
W320_H180 = "W320_H180",
|
|
40
|
-
W240_H240 = "W240_H240",
|
|
41
|
-
W320_H240 = "W320_H240",
|
|
42
|
-
W480_H360 = "W480_H360",
|
|
43
|
-
W640_H360 = "W640_H360",
|
|
44
|
-
W480_H480 = "W480_H480",
|
|
45
|
-
W640_H480 = "W640_H480",
|
|
46
|
-
W720_H480 = "W720_H480",
|
|
47
|
-
W1280_H720 = "W1280_H720",
|
|
48
|
-
W1920_H1080 = "W1920_H1080"
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
/**
|
|
52
|
-
* 流状态
|
|
53
|
-
*/
|
|
54
|
-
declare enum TrackState {
|
|
55
|
-
/**
|
|
56
|
-
* 不可用
|
|
57
|
-
*/
|
|
58
|
-
DISABLE = 0,
|
|
59
|
-
/**
|
|
60
|
-
* 可用
|
|
61
|
-
*/
|
|
62
|
-
ENABLE = 1
|
|
63
|
-
}
|
|
64
|
-
|
|
65
10
|
/**
|
|
66
11
|
* 错误码,与移动端对齐
|
|
67
12
|
* @description
|
|
@@ -134,8 +79,81 @@ declare enum RCRTCCode {
|
|
|
134
79
|
PACKAGE_ENVIRONMENT_ERROR = 53025,
|
|
135
80
|
/** 单个用户发布资源超过限制 ( MediaServer 限制最多 10 个 track ) */
|
|
136
81
|
PUBLISH_TRACK_LIMIT_EXCEEDED = 53026,
|
|
82
|
+
/** 房间内无主播推 CDN */
|
|
83
|
+
CDN_RESOURCE_IS_EMPTY = 53027,
|
|
137
84
|
/** 加入 RTC 房间 joinTYype 为 1 时,当前有其他端在房间时的应答码 */
|
|
138
|
-
SIGNAL_JOIN_RTC_ROOM_REFUSED =
|
|
85
|
+
SIGNAL_JOIN_RTC_ROOM_REFUSED = 53028,
|
|
86
|
+
/** 设置音频输出设备时,无权限使用请求的设备 */
|
|
87
|
+
NO_PERMISSION_TO_USE_REQUESTED_DEVICE = 53029
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* 媒体资源类型
|
|
92
|
+
*/
|
|
93
|
+
declare enum RCMediaType {
|
|
94
|
+
/**
|
|
95
|
+
* 音频流
|
|
96
|
+
*/
|
|
97
|
+
AUDIO_ONLY = 0,
|
|
98
|
+
/**
|
|
99
|
+
* 视频流
|
|
100
|
+
*/
|
|
101
|
+
VIDEO_ONLY = 1,
|
|
102
|
+
/**
|
|
103
|
+
* 音视频混合流,只在 web 端存在混合流的情况
|
|
104
|
+
*/
|
|
105
|
+
AUDIO_VIDEO = 2
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* 资源大小流标识枚举
|
|
110
|
+
*/
|
|
111
|
+
declare enum RCStreamType {
|
|
112
|
+
/**
|
|
113
|
+
* 普通流(大流)
|
|
114
|
+
*/
|
|
115
|
+
NORMAL = 1,
|
|
116
|
+
/**
|
|
117
|
+
* 小流
|
|
118
|
+
*/
|
|
119
|
+
TINY = 2
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
declare enum RCFrameRate {
|
|
123
|
+
FPS_10 = "FPS_10",
|
|
124
|
+
FPS_15 = "FPS_15",
|
|
125
|
+
FPS_24 = "FPS_24",
|
|
126
|
+
FPS_30 = "FPS_30"
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
declare enum RCResolution {
|
|
130
|
+
W176_H132 = "W176_H132",
|
|
131
|
+
W176_H144 = "W176_H144",
|
|
132
|
+
W256_H144 = "W256_H144",
|
|
133
|
+
W320_H180 = "W320_H180",
|
|
134
|
+
W240_H240 = "W240_H240",
|
|
135
|
+
W320_H240 = "W320_H240",
|
|
136
|
+
W480_H360 = "W480_H360",
|
|
137
|
+
W640_H360 = "W640_H360",
|
|
138
|
+
W480_H480 = "W480_H480",
|
|
139
|
+
W640_H480 = "W640_H480",
|
|
140
|
+
W720_H480 = "W720_H480",
|
|
141
|
+
W1280_H720 = "W1280_H720",
|
|
142
|
+
W1920_H1080 = "W1920_H1080"
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
/**
|
|
146
|
+
* 流状态
|
|
147
|
+
*/
|
|
148
|
+
declare enum TrackState {
|
|
149
|
+
/**
|
|
150
|
+
* 不可用
|
|
151
|
+
*/
|
|
152
|
+
DISABLE = 0,
|
|
153
|
+
/**
|
|
154
|
+
* 可用
|
|
155
|
+
*/
|
|
156
|
+
ENABLE = 1
|
|
139
157
|
}
|
|
140
158
|
|
|
141
159
|
declare abstract class RCTrack extends EventEmitter {
|
|
@@ -205,6 +223,7 @@ declare abstract class RCTrack extends EventEmitter {
|
|
|
205
223
|
*/
|
|
206
224
|
play(element?: HTMLVideoElement, options?: {
|
|
207
225
|
volume?: number;
|
|
226
|
+
audioDeviceId: string;
|
|
208
227
|
}): Promise<{
|
|
209
228
|
code: RCRTCCode;
|
|
210
229
|
}>;
|
|
@@ -342,20 +361,6 @@ declare class RCRemoteVideoTrack extends RCRemoteTrack {
|
|
|
342
361
|
constructor(tag: string, userId: string, roomId?: string);
|
|
343
362
|
}
|
|
344
363
|
|
|
345
|
-
/**
|
|
346
|
-
* 资源大小流标识枚举
|
|
347
|
-
*/
|
|
348
|
-
declare enum RCStreamType {
|
|
349
|
-
/**
|
|
350
|
-
* 普通流(大流)
|
|
351
|
-
*/
|
|
352
|
-
NORMAL = 1,
|
|
353
|
-
/**
|
|
354
|
-
* 小流
|
|
355
|
-
*/
|
|
356
|
-
TINY = 2
|
|
357
|
-
}
|
|
358
|
-
|
|
359
364
|
interface IStatParser {
|
|
360
365
|
/**
|
|
361
366
|
* 取消发布后,需把 _latestPacketsSent 中 key 为 resourceId 存储的数据清除掉
|
|
@@ -391,6 +396,17 @@ declare type OutboundVideoInfo = {
|
|
|
391
396
|
resolution: string;
|
|
392
397
|
};
|
|
393
398
|
|
|
399
|
+
declare enum RCInnerCDNPullKind {
|
|
400
|
+
RTMP = "rtmp",
|
|
401
|
+
FLV = "flv",
|
|
402
|
+
HLS = "hls"
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
declare enum RCInnerCDNPullIsHttps {
|
|
406
|
+
NOT_HTTPS = 0,
|
|
407
|
+
HTTPS = 1
|
|
408
|
+
}
|
|
409
|
+
|
|
394
410
|
declare enum RCKickReason {
|
|
395
411
|
/**
|
|
396
412
|
* Server 主动踢(掉 Server API 踢出)
|
|
@@ -407,6 +423,20 @@ declare enum RCRTCPingResult {
|
|
|
407
423
|
FAIL = "Fail"
|
|
408
424
|
}
|
|
409
425
|
|
|
426
|
+
/**
|
|
427
|
+
* 直播角色
|
|
428
|
+
*/
|
|
429
|
+
declare enum RCRTCLiveRole {
|
|
430
|
+
/**
|
|
431
|
+
* 主播
|
|
432
|
+
*/
|
|
433
|
+
ANCHOR = 1,
|
|
434
|
+
/**
|
|
435
|
+
* 观众
|
|
436
|
+
*/
|
|
437
|
+
AUDIENCE = 2
|
|
438
|
+
}
|
|
439
|
+
|
|
410
440
|
interface IRCTrackBitrate {
|
|
411
441
|
/**
|
|
412
442
|
* 最大码率
|
|
@@ -786,11 +816,19 @@ interface IRoomEventListener extends IRCRTCTrackEventListener {
|
|
|
786
816
|
* @param userIds
|
|
787
817
|
*/
|
|
788
818
|
onUserLeave?(userIds: string[]): void;
|
|
819
|
+
/**
|
|
820
|
+
* 主播开启、停止推 CDN 状态通知
|
|
821
|
+
*/
|
|
822
|
+
onCDNEnableChange?(enable: boolean): void;
|
|
789
823
|
/**
|
|
790
824
|
* RTC 每次 Ping 的结果
|
|
791
825
|
* @since version: 5.1.5
|
|
792
826
|
*/
|
|
793
827
|
onPing?(result: RCRTCPingResult): void;
|
|
828
|
+
/**
|
|
829
|
+
* 主播和观众切换身份通知
|
|
830
|
+
*/
|
|
831
|
+
onSwitchRole?(userId: string, role: RCRTCLiveRole): void;
|
|
794
832
|
}
|
|
795
833
|
/**
|
|
796
834
|
* RTCClient 初始化配置
|
|
@@ -830,6 +868,14 @@ interface IRCRTCInitOptions {
|
|
|
830
868
|
* 优化使用的 SDP 协议版本,仅当运行时浏览器支持相应 SDP 协议版本时生效
|
|
831
869
|
*/
|
|
832
870
|
sdpSemantics?: ISdpSemantics;
|
|
871
|
+
/**
|
|
872
|
+
* 观众拉内置 CDN 资源的直播拉流协议,默认为 RCInnerCDNPullKind.FLV
|
|
873
|
+
*/
|
|
874
|
+
pullInnerCDNProtocol?: RCInnerCDNPullKind;
|
|
875
|
+
/**
|
|
876
|
+
* 观众拉内置 CDN 资源时是否使用 https,默认为 RCInnerCDNPullIsHttps.HTTPS
|
|
877
|
+
*/
|
|
878
|
+
pullInnerCDNUseHttps?: RCInnerCDNPullIsHttps;
|
|
833
879
|
}
|
|
834
880
|
interface ICameraVideoProfile extends IVideoProfile {
|
|
835
881
|
cameraId?: string;
|
|
@@ -849,12 +895,31 @@ interface ICreateLocalTrackOptions {
|
|
|
849
895
|
*/
|
|
850
896
|
withoutVideo?: boolean;
|
|
851
897
|
}
|
|
898
|
+
/**
|
|
899
|
+
* 音量上报事件接口
|
|
900
|
+
*/
|
|
852
901
|
interface IAudioLevelChangeHandler {
|
|
853
902
|
(audioLevelReportList: {
|
|
854
903
|
track: RCLocalAudioTrack | RCRemoteAudioTrack;
|
|
855
904
|
audioLevel: number;
|
|
856
905
|
}[]): void;
|
|
857
906
|
}
|
|
907
|
+
/**
|
|
908
|
+
* 房间资源数据
|
|
909
|
+
*/
|
|
910
|
+
declare type RoomData = {
|
|
911
|
+
[userId: string]: IPublishedResource[];
|
|
912
|
+
};
|
|
913
|
+
|
|
914
|
+
declare enum RCInnerCDNPushMode {
|
|
915
|
+
AUTOMATIC = 0,
|
|
916
|
+
MANUAL = 1
|
|
917
|
+
}
|
|
918
|
+
|
|
919
|
+
declare enum RCInnerCDNBroadcast {
|
|
920
|
+
SPREAD = 0,
|
|
921
|
+
NO_SPREAD = -1
|
|
922
|
+
}
|
|
858
923
|
|
|
859
924
|
/**
|
|
860
925
|
* 与 MediaServer 交互所需的 Request Header 信息
|
|
@@ -954,6 +1019,10 @@ interface ILiveUrls {
|
|
|
954
1019
|
* 观众端订阅地址,由业务层分发
|
|
955
1020
|
*/
|
|
956
1021
|
liveUrl: string;
|
|
1022
|
+
/**
|
|
1023
|
+
* 自动推 CDN 模式下,发布资源后返回的 CDN 信息
|
|
1024
|
+
*/
|
|
1025
|
+
pull_url?: string;
|
|
957
1026
|
}
|
|
958
1027
|
interface IRTCResponse {
|
|
959
1028
|
/**
|
|
@@ -1067,6 +1136,56 @@ interface IBroadcastSubRespBody extends IRTCResponse {
|
|
|
1067
1136
|
sdp: string;
|
|
1068
1137
|
};
|
|
1069
1138
|
}
|
|
1139
|
+
/**
|
|
1140
|
+
* 获取 CDN 资源拉流地址请求 headers
|
|
1141
|
+
*/
|
|
1142
|
+
interface ICDNPlayUrlReqHeaders extends IMCUReqHeaders {
|
|
1143
|
+
}
|
|
1144
|
+
/**
|
|
1145
|
+
* 获取 CDN 资源拉流地址响应
|
|
1146
|
+
*/
|
|
1147
|
+
interface ICDNPlayUrlResponse extends IRTCResponse {
|
|
1148
|
+
data: {
|
|
1149
|
+
fps: number;
|
|
1150
|
+
h: number;
|
|
1151
|
+
'pull_url': string;
|
|
1152
|
+
w: number;
|
|
1153
|
+
};
|
|
1154
|
+
}
|
|
1155
|
+
/**
|
|
1156
|
+
* cdn_uris 里面包含的字段
|
|
1157
|
+
*/
|
|
1158
|
+
interface ICDNUris {
|
|
1159
|
+
/**
|
|
1160
|
+
* 是否扩散
|
|
1161
|
+
*/
|
|
1162
|
+
broadcast: RCInnerCDNBroadcast;
|
|
1163
|
+
/**
|
|
1164
|
+
* 拉流资源的宽度
|
|
1165
|
+
*/
|
|
1166
|
+
w?: number;
|
|
1167
|
+
/**
|
|
1168
|
+
* 拉流资源的高度
|
|
1169
|
+
*/
|
|
1170
|
+
h?: number;
|
|
1171
|
+
/**
|
|
1172
|
+
* 帧率
|
|
1173
|
+
*/
|
|
1174
|
+
fps?: number;
|
|
1175
|
+
/**
|
|
1176
|
+
* 获取拉流地址的 url
|
|
1177
|
+
*/
|
|
1178
|
+
url: string;
|
|
1179
|
+
/**
|
|
1180
|
+
* 开启、停用 CDN
|
|
1181
|
+
*/
|
|
1182
|
+
enableInnerCDN?: boolean;
|
|
1183
|
+
/**
|
|
1184
|
+
* 推送模式,手动 or 自动
|
|
1185
|
+
*/
|
|
1186
|
+
'push_mode': RCInnerCDNPushMode;
|
|
1187
|
+
'pull_safe': boolean;
|
|
1188
|
+
}
|
|
1070
1189
|
|
|
1071
1190
|
/**
|
|
1072
1191
|
* 直播布局模式定义
|
|
@@ -1100,6 +1219,11 @@ declare enum MixVideoRenderMode {
|
|
|
1100
1219
|
WHOLE = 2
|
|
1101
1220
|
}
|
|
1102
1221
|
|
|
1222
|
+
declare enum RCInnerCDNModel {
|
|
1223
|
+
OPEN = 1,
|
|
1224
|
+
STOP = 2
|
|
1225
|
+
}
|
|
1226
|
+
|
|
1103
1227
|
/**
|
|
1104
1228
|
* 合流后的 video 输出编码配置,包含分辨率、帧率、码率配置项
|
|
1105
1229
|
*/
|
|
@@ -1347,6 +1471,18 @@ interface IMCUConfig {
|
|
|
1347
1471
|
*/
|
|
1348
1472
|
waterMark?: IMCUWaterMarkConfig;
|
|
1349
1473
|
}
|
|
1474
|
+
/**
|
|
1475
|
+
* 设置开启、停用内置 CDN 数据
|
|
1476
|
+
*/
|
|
1477
|
+
interface ISetEnableCDN {
|
|
1478
|
+
version: 2;
|
|
1479
|
+
output: {
|
|
1480
|
+
/**
|
|
1481
|
+
* 手动开启/停用内置 CDN
|
|
1482
|
+
*/
|
|
1483
|
+
inCDNModel: RCInnerCDNModel;
|
|
1484
|
+
};
|
|
1485
|
+
}
|
|
1350
1486
|
|
|
1351
1487
|
declare class RCMediaService {
|
|
1352
1488
|
private readonly _runtime;
|
|
@@ -1427,8 +1563,16 @@ declare class RCMediaService {
|
|
|
1427
1563
|
/**
|
|
1428
1564
|
* 直播推流、自定义布局配置
|
|
1429
1565
|
*/
|
|
1430
|
-
setMcuConfig(headers: IMCUReqHeaders, body: IMCUConfig): Promise<{
|
|
1566
|
+
setMcuConfig(headers: IMCUReqHeaders, body: IMCUConfig | ISetEnableCDN): Promise<{
|
|
1567
|
+
code: RCRTCCode;
|
|
1568
|
+
res?: any;
|
|
1569
|
+
}>;
|
|
1570
|
+
/**
|
|
1571
|
+
* 房间内观众获取 CDN 资源信息、拉流地址
|
|
1572
|
+
*/
|
|
1573
|
+
getCDNResourceInfo(headers: ICDNPlayUrlReqHeaders, url: string): Promise<{
|
|
1431
1574
|
code: RCRTCCode;
|
|
1575
|
+
res?: ICDNPlayUrlResponse;
|
|
1432
1576
|
}>;
|
|
1433
1577
|
}
|
|
1434
1578
|
|
|
@@ -1500,6 +1644,24 @@ interface IAudienceRoomEventListener extends IRCRTCTrackEventListener {
|
|
|
1500
1644
|
* @param videoTrack RCRemoteVideoTrack 类实例对象
|
|
1501
1645
|
*/
|
|
1502
1646
|
onVideoMuteChange?(videoTrack: RCRemoteVideoTrack): void;
|
|
1647
|
+
/**
|
|
1648
|
+
* 房间内主播把发布的资源推至 CDN
|
|
1649
|
+
*/
|
|
1650
|
+
onCDNInfoEnable?(CDNInfo: {
|
|
1651
|
+
resolution: RCResolution;
|
|
1652
|
+
fps: RCFrameRate;
|
|
1653
|
+
}): void;
|
|
1654
|
+
/**
|
|
1655
|
+
* 主播停止推 CDN
|
|
1656
|
+
*/
|
|
1657
|
+
onCDNInfoDisable?(): void;
|
|
1658
|
+
/**
|
|
1659
|
+
* 主播改变推 CDN 的分辨率或帧率
|
|
1660
|
+
*/
|
|
1661
|
+
onCDNInfoChange?(CDNInfo: {
|
|
1662
|
+
resolution: RCResolution;
|
|
1663
|
+
fps: RCFrameRate;
|
|
1664
|
+
}): void;
|
|
1503
1665
|
}
|
|
1504
1666
|
/**
|
|
1505
1667
|
* 观众直播房间类
|
|
@@ -1512,7 +1674,7 @@ declare class RCAudienceLivingRoom {
|
|
|
1512
1674
|
private readonly _runtime;
|
|
1513
1675
|
private readonly _initOptions;
|
|
1514
1676
|
readonly _roomId: string;
|
|
1515
|
-
private readonly
|
|
1677
|
+
private readonly _joinResData;
|
|
1516
1678
|
readonly _livingType: RCLivingType;
|
|
1517
1679
|
private readonly _service;
|
|
1518
1680
|
private _roomAnchorList;
|
|
@@ -1532,7 +1694,14 @@ declare class RCAudienceLivingRoom {
|
|
|
1532
1694
|
* 音量上报实例
|
|
1533
1695
|
*/
|
|
1534
1696
|
private _audioLevelReport;
|
|
1535
|
-
|
|
1697
|
+
/**
|
|
1698
|
+
* cdn_uris 资源
|
|
1699
|
+
*/
|
|
1700
|
+
private _CDNUris;
|
|
1701
|
+
constructor(_context: RTCPluginContext, _runtime: IRuntime, _initOptions: IRCRTCInitOptions, _roomId: string, _joinResData: {
|
|
1702
|
+
token: string;
|
|
1703
|
+
kvEntries?: IServerRTCRoomEntry[];
|
|
1704
|
+
}, _livingType: RCLivingType);
|
|
1536
1705
|
protected _assertRoomDestroyed(): RCRTCCode | undefined;
|
|
1537
1706
|
/**
|
|
1538
1707
|
* @description 信令数据处理
|
|
@@ -1541,6 +1710,7 @@ declare class RCAudienceLivingRoom {
|
|
|
1541
1710
|
* * key RC_ANCHOR_LIST value: 为主播 ID 集合
|
|
1542
1711
|
* * key RC_RES_`userId` value: 为主播发布的资源
|
|
1543
1712
|
* * key RC_RTC_SESSIONID value: sessionId
|
|
1713
|
+
* * key RC_CDN value: CDN 资源数据
|
|
1544
1714
|
*/
|
|
1545
1715
|
private singalDataChange;
|
|
1546
1716
|
/**
|
|
@@ -1583,6 +1753,26 @@ declare class RCAudienceLivingRoom {
|
|
|
1583
1753
|
private _getReqHeaders;
|
|
1584
1754
|
private _exchangeHandle;
|
|
1585
1755
|
private _updateSubListHandle;
|
|
1756
|
+
/**
|
|
1757
|
+
* 对比 cdn_uris 资源
|
|
1758
|
+
* @param newCDNUris 新的 cdn_uris 数据
|
|
1759
|
+
*/
|
|
1760
|
+
private _diffCDNUris;
|
|
1761
|
+
/**
|
|
1762
|
+
* 获取 CDN 资源对应的拉流地址
|
|
1763
|
+
* 首次获取 CDNPlayUrl 时,需传入 url,
|
|
1764
|
+
* 业务层调用时使用内存中 _CDNUris 的 url,无 _CDNUris 时说明观众端未赋值过 _CDNUris
|
|
1765
|
+
* @returns CDNPlayUrl
|
|
1766
|
+
*/
|
|
1767
|
+
private _getCDNPlayUrl;
|
|
1768
|
+
/**
|
|
1769
|
+
* 获取 CDN 资源对应的拉流地址
|
|
1770
|
+
* @returns CDNPlayUrl
|
|
1771
|
+
*/
|
|
1772
|
+
getCDNPlayUrl(resolution?: RCResolution, fps?: RCFrameRate): Promise<{
|
|
1773
|
+
code: RCRTCCode;
|
|
1774
|
+
CDNPlayUrl?: string;
|
|
1775
|
+
}>;
|
|
1586
1776
|
/**
|
|
1587
1777
|
* 订阅资源
|
|
1588
1778
|
* @param tracks
|
|
@@ -1783,9 +1973,6 @@ declare class RCRTCPeerConnection extends EventEmitter {
|
|
|
1783
1973
|
clearReTryExchangeTimer(): void;
|
|
1784
1974
|
}
|
|
1785
1975
|
|
|
1786
|
-
declare type RoomData = {
|
|
1787
|
-
[userId: string]: IPublishedResource[];
|
|
1788
|
-
};
|
|
1789
1976
|
/**
|
|
1790
1977
|
* 房间抽象基类
|
|
1791
1978
|
*/
|
|
@@ -1848,7 +2035,7 @@ declare abstract class RCAbstractRoom {
|
|
|
1848
2035
|
*/
|
|
1849
2036
|
setBitrate(max: number, min: number, start?: number): void;
|
|
1850
2037
|
private _onTrackReady;
|
|
1851
|
-
|
|
2038
|
+
protected _callAppListener(eventType: keyof IRoomEventListener, ...attrs: any[]): void;
|
|
1852
2039
|
private _onUserUnpublish;
|
|
1853
2040
|
private _onTrackUnpublish;
|
|
1854
2041
|
private _unpublishPrev;
|
|
@@ -1868,7 +2055,18 @@ declare abstract class RCAbstractRoom {
|
|
|
1868
2055
|
* @param messageType 消息类型
|
|
1869
2056
|
* @param userId 消息发送者
|
|
1870
2057
|
*/
|
|
1871
|
-
|
|
2058
|
+
protected _resourceHandle(content: {
|
|
2059
|
+
/**
|
|
2060
|
+
* 旧版本兼容参数,当收到非 `RTCMessageName.TOTAL_CONTENT_RESOURCE` 时:
|
|
2061
|
+
* * ignore 值为 `true` 表示该消息由 signal server 向旧版本 RTCLib 提供的兼容消息,无需处理
|
|
2062
|
+
* * 否则认为该消息是由旧版本 RTCLib 主动发出的增量变更消息,需要处理
|
|
2063
|
+
*/
|
|
2064
|
+
ignore?: boolean;
|
|
2065
|
+
/**
|
|
2066
|
+
* 发布到房间内的资源列表,`RTCMessageName.TOTAL_CONTENT_RESOURCE` 消息携带全量数据,否则为增量数据
|
|
2067
|
+
*/
|
|
2068
|
+
uris: IPublishedResource[];
|
|
2069
|
+
}, messageType: string, userId: string): Promise<void>;
|
|
1872
2070
|
private _onTrackPublish;
|
|
1873
2071
|
/**
|
|
1874
2072
|
* 处理 `RCRTCMessageType.STATE` 消息
|
|
@@ -2003,8 +2201,11 @@ declare abstract class RCAbstractRoom {
|
|
|
2003
2201
|
* ice 断线后,尝试重新走 exchange
|
|
2004
2202
|
*/
|
|
2005
2203
|
protected _reTryExchange(): Promise<void>;
|
|
2006
|
-
|
|
2007
|
-
|
|
2204
|
+
protected _exchangeHandle(body: IExchangeReqBody): Promise<{
|
|
2205
|
+
code: RCRTCCode;
|
|
2206
|
+
data?: IExchangeResponse | undefined;
|
|
2207
|
+
}>;
|
|
2208
|
+
protected _getRTCReqestHeaders(): IRTCReqHeader;
|
|
2008
2209
|
/**
|
|
2009
2210
|
* 获取 exchange 接口的请求体数据
|
|
2010
2211
|
* @param subscribeList 订阅清单
|
|
@@ -2097,17 +2298,15 @@ declare abstract class RCAbstractRoom {
|
|
|
2097
2298
|
/**
|
|
2098
2299
|
* 断线重连后尝试补发断线过程中的通知信息
|
|
2099
2300
|
*/
|
|
2100
|
-
__onReconnected(livingType?: RCLivingType): Promise<
|
|
2301
|
+
__onReconnected(livingType?: RCLivingType): Promise<{
|
|
2302
|
+
data: IJoinRTCRoomData | undefined;
|
|
2303
|
+
} | void>;
|
|
2101
2304
|
private _onAudioMuteChange;
|
|
2102
2305
|
private _onVideoMuteChange;
|
|
2103
2306
|
/**
|
|
2104
2307
|
* 观众切换为主播后直接处理人员变更及资源变更
|
|
2105
2308
|
*/
|
|
2106
|
-
|
|
2107
|
-
/**
|
|
2108
|
-
* 主播身份降级,取消己端已发布的所有资源
|
|
2109
|
-
*/
|
|
2110
|
-
__unpublishToSingal(): Promise<ErrorCode>;
|
|
2309
|
+
protected _afterChangedRole(data: IJoinRTCRoomData): void;
|
|
2111
2310
|
/**
|
|
2112
2311
|
* 销毁远端资源
|
|
2113
2312
|
*/
|
|
@@ -2137,6 +2336,10 @@ declare class RCMCUConfigBuilder {
|
|
|
2137
2336
|
* trackId 有效性验证方法
|
|
2138
2337
|
*/
|
|
2139
2338
|
private readonly _isValidTrackId;
|
|
2339
|
+
/**
|
|
2340
|
+
* 扩散 cdn_uris
|
|
2341
|
+
*/
|
|
2342
|
+
private readonly _sendCDNInfoSignal;
|
|
2140
2343
|
/**
|
|
2141
2344
|
* mcu 配置数据,每次向服务器提交全量数据
|
|
2142
2345
|
*/
|
|
@@ -2151,7 +2354,11 @@ declare class RCMCUConfigBuilder {
|
|
|
2151
2354
|
/**
|
|
2152
2355
|
* trackId 有效性验证方法
|
|
2153
2356
|
*/
|
|
2154
|
-
_isValidTrackId: (trackId: string) => boolean
|
|
2357
|
+
_isValidTrackId: (trackId: string) => boolean,
|
|
2358
|
+
/**
|
|
2359
|
+
* 扩散 cdn_uris
|
|
2360
|
+
*/
|
|
2361
|
+
_sendCDNInfoSignal: () => void);
|
|
2155
2362
|
/**
|
|
2156
2363
|
* 设置合流后的主位置显示的视频流
|
|
2157
2364
|
* @param videoTrackId 视频流资源 Id
|
|
@@ -2282,6 +2489,11 @@ declare class RCMCUConfigBuilder {
|
|
|
2282
2489
|
declare class RCLivingRoom extends RCAbstractRoom {
|
|
2283
2490
|
private _livingType;
|
|
2284
2491
|
readonly _mcuConfigBuilder: RCMCUConfigBuilder;
|
|
2492
|
+
/**
|
|
2493
|
+
* cdn_uris 信令扩散数据
|
|
2494
|
+
*/
|
|
2495
|
+
private _CDNUris;
|
|
2496
|
+
private _CDNEnable;
|
|
2285
2497
|
constructor(context: RTCPluginContext, runtime: IRuntime, roomId: string, data: IJoinRTCRoomData, service: RCMediaService, initOptions: IRCRTCInitOptions, clientEvent: Function, _livingType: RCLivingType, isUpgrage?: boolean);
|
|
2286
2498
|
getLivingType(): RCLivingType;
|
|
2287
2499
|
/**
|
|
@@ -2293,7 +2505,67 @@ declare class RCLivingRoom extends RCAbstractRoom {
|
|
|
2293
2505
|
* @param data
|
|
2294
2506
|
*/
|
|
2295
2507
|
private _onMCUConfigFlush;
|
|
2508
|
+
/**
|
|
2509
|
+
* 主播端断线重连后,需更新内存中的 CDN 数据
|
|
2510
|
+
* 判断房间内 CDN 状态是否和内存数据一致,不一致时需通知到客户端
|
|
2511
|
+
*/
|
|
2296
2512
|
__onReconnected(): Promise<void>;
|
|
2513
|
+
/**
|
|
2514
|
+
* 开启/停用推 CDN
|
|
2515
|
+
*/
|
|
2516
|
+
enableInnerCDN(enable: boolean): Promise<{
|
|
2517
|
+
code: RCRTCCode;
|
|
2518
|
+
}>;
|
|
2519
|
+
/**
|
|
2520
|
+
* 开启、停用 CDN 推资源后发信令
|
|
2521
|
+
*/
|
|
2522
|
+
private _sendCDNInfoSignal;
|
|
2523
|
+
/**
|
|
2524
|
+
* 扩散 cdn_uris 资源
|
|
2525
|
+
*/
|
|
2526
|
+
private _spreadCDNInfo;
|
|
2527
|
+
/**
|
|
2528
|
+
* 给房间设置 CDN 数据
|
|
2529
|
+
*/
|
|
2530
|
+
private _setRoomCDNInfo;
|
|
2531
|
+
/**
|
|
2532
|
+
* 资源变化时触发
|
|
2533
|
+
* 直播房间需单独处理 cdn_uris
|
|
2534
|
+
*/
|
|
2535
|
+
protected _resourceHandle(content: {
|
|
2536
|
+
/**
|
|
2537
|
+
* 旧版本兼容参数,当收到非 `RTCMessageName.TOTAL_CONTENT_RESOURCE` 时:
|
|
2538
|
+
* * ignore 值为 `true` 表示该消息由 signal server 向旧版本 RTCLib 提供的兼容消息,无需处理
|
|
2539
|
+
* * 否则认为该消息是由旧版本 RTCLib 主动发出的增量变更消息,需要处理
|
|
2540
|
+
*/
|
|
2541
|
+
ignore?: boolean;
|
|
2542
|
+
/**
|
|
2543
|
+
* 发布到房间内的资源列表,`RTCMessageName.TOTAL_CONTENT_RESOURCE` 消息携带全量数据,否则为增量数据
|
|
2544
|
+
*/
|
|
2545
|
+
uris: IPublishedResource[];
|
|
2546
|
+
cdn_uris?: ICDNUris[];
|
|
2547
|
+
}, messageType: string, userId: string): Promise<void>;
|
|
2548
|
+
/**
|
|
2549
|
+
* 重写父类 _exchangeHandle 方法
|
|
2550
|
+
*/
|
|
2551
|
+
protected _exchangeHandle(body: IExchangeReqBody): Promise<{
|
|
2552
|
+
code: RCRTCCode;
|
|
2553
|
+
data?: IExchangeResponse | undefined;
|
|
2554
|
+
}>;
|
|
2555
|
+
/**
|
|
2556
|
+
* 观众切换为主播后直接处理人员变更及资源变更
|
|
2557
|
+
*/
|
|
2558
|
+
protected _afterChangedRole(data: IJoinRTCRoomData): void;
|
|
2559
|
+
/**
|
|
2560
|
+
* 返回 CDN 是否可用
|
|
2561
|
+
* @returns boolean
|
|
2562
|
+
*/
|
|
2563
|
+
__getCDNEnable(): boolean | undefined;
|
|
2564
|
+
/**
|
|
2565
|
+
* 返回 CDN 推送模式: 自动 or 手动
|
|
2566
|
+
* @returns boolean
|
|
2567
|
+
*/
|
|
2568
|
+
__getCDNPushMode(): RCInnerCDNPushMode | undefined;
|
|
2297
2569
|
}
|
|
2298
2570
|
|
|
2299
2571
|
/**
|
|
@@ -2407,6 +2679,7 @@ declare class RCRTCClient {
|
|
|
2407
2679
|
code: RCRTCCode;
|
|
2408
2680
|
userIds?: string[];
|
|
2409
2681
|
tracks?: RCRemoteTrack[];
|
|
2682
|
+
CDNEnable?: boolean;
|
|
2410
2683
|
}>;
|
|
2411
2684
|
private _joinLivingRoom;
|
|
2412
2685
|
private _audience;
|
|
@@ -2549,10 +2822,9 @@ declare class RCRTCClient {
|
|
|
2549
2822
|
}>;
|
|
2550
2823
|
/**
|
|
2551
2824
|
* 获取在房间内用户信息
|
|
2552
|
-
*
|
|
2553
|
-
* @since version 5.1.5
|
|
2825
|
+
* @since version 5.2.1
|
|
2554
2826
|
*/
|
|
2555
|
-
|
|
2827
|
+
getJoinedRoomInfo(): Promise<{
|
|
2556
2828
|
code: RCRTCCode;
|
|
2557
2829
|
data?: IRTCJoinedInfo[];
|
|
2558
2830
|
}>;
|
|
@@ -2605,4 +2877,4 @@ declare const helper: {
|
|
|
2605
2877
|
ifSupportScreenShare: typeof ifSupportScreenShare;
|
|
2606
2878
|
};
|
|
2607
2879
|
|
|
2608
|
-
export { BackgroundPictureFillMode, ICameraVideoProfile, IMCUOutputConfig, IMCUOutputVideoConfig, IMicphoneAudioProfile, IPublishAttrs, IPublishedResource, IRCCandidatePairStat, IRCRTCInitOptions, IRCRTCReportListener, IRCRTCStateReport, IRCTrackStat, IRoomEventListener, ISubscribeAttr, IVideoProfile, MixLayoutMode, MixVideoRenderMode, RCAbstractRoom, RCAudienceClient, RCAudienceLivingRoom, RCCameraVideoTrack, RCFrameRate, RCKickReason, RCLivingRoom, RCLivingType, RCLocalAudioTrack, RCLocalFileAudioTrack, RCLocalFileTrack, RCLocalFileVideoTrack, RCLocalTrack, RCLocalVideoTrack, RCMCUConfigBuilder, RCMediaType, RCMicphoneAudioTrack, RCRTCClient, RCRTCCode, RCRTCPingResult, RCRTCRoom, RCRemoteAudioTrack, RCRemoteTrack, RCRemoteVideoTrack, RCResolution, RCScreenVideoTrack, RCTag, RCTrack, device, helper, installer };
|
|
2880
|
+
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, RCKickReason, RCLivingRoom, RCLivingType, RCLocalAudioTrack, RCLocalFileAudioTrack, RCLocalFileTrack, RCLocalFileVideoTrack, RCLocalTrack, RCLocalVideoTrack, RCMCUConfigBuilder, RCMediaType, RCMicphoneAudioTrack, RCRTCClient, RCRTCCode, RCRTCLiveRole, RCRTCPingResult, RCRTCRoom, RCRemoteAudioTrack, RCRemoteTrack, RCRemoteVideoTrack, RCResolution, RCScreenVideoTrack, RCTag, RCTrack, device, helper, installer };
|