@rongcloud/plugin-rtc 5.3.11 → 5.3.13

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.
Files changed (66) hide show
  1. package/dist/async-task-queue.d.ts +15 -0
  2. package/dist/core/PolarisReporter.d.ts +35 -0
  3. package/dist/core/RCAudienceClient.d.ts +72 -0
  4. package/dist/core/RCRTCClient.d.ts +220 -0
  5. package/dist/core/constants.d.ts +2 -0
  6. package/dist/core/enums/BackgroundPictureFillMode.d.ts +14 -0
  7. package/dist/core/enums/MixLayoutMode.d.ts +18 -0
  8. package/dist/core/enums/MixVideoRenderMode.d.ts +14 -0
  9. package/dist/core/enums/RCFrameRate.d.ts +7 -0
  10. package/dist/core/enums/RCInnerCDNBroadcast.d.ts +5 -0
  11. package/dist/core/enums/RCInnerCDNModel.d.ts +5 -0
  12. package/dist/core/enums/RCInnerCDNPullIsHttps.d.ts +5 -0
  13. package/dist/core/enums/RCInnerCDNPullKind.d.ts +6 -0
  14. package/dist/core/enums/RCInnerCDNPushMode.d.ts +5 -0
  15. package/dist/core/enums/RCKickType.d.ts +11 -0
  16. package/dist/core/enums/RCLivingRoomType.d.ts +11 -0
  17. package/dist/core/enums/RCLivingType.d.ts +14 -0
  18. package/dist/core/enums/RCMediaType.d.ts +18 -0
  19. package/dist/core/enums/RCMixInputFilterMode.d.ts +35 -0
  20. package/dist/core/enums/RCRTCCode.d.ts +91 -0
  21. package/dist/core/enums/RCRTCLiveRole.d.ts +14 -0
  22. package/dist/core/enums/RCRTCPingResult.d.ts +5 -0
  23. package/dist/core/enums/RCRTCResolution.d.ts +102 -0
  24. package/dist/core/enums/RCResolution.d.ts +16 -0
  25. package/dist/core/enums/inner/PolarisRole.d.ts +14 -0
  26. package/dist/core/enums/inner/R2Action.d.ts +14 -0
  27. package/dist/core/enums/inner/R2Status.d.ts +11 -0
  28. package/dist/core/enums/inner/RCRTCMessageType.d.ts +66 -0
  29. package/dist/core/enums/inner/RCStreamType.d.ts +14 -0
  30. package/dist/core/enums/inner/TrackState.d.ts +14 -0
  31. package/dist/core/interfaces.d.ts +893 -0
  32. package/dist/core/room/Pinger.d.ts +34 -0
  33. package/dist/core/room/RCAbstractRoom.d.ts +379 -0
  34. package/dist/core/room/RCAudienceLivingRoom.d.ts +305 -0
  35. package/dist/core/room/RCAudioLevelReport.d.ts +17 -0
  36. package/dist/core/room/RCLivingPKHandler.d.ts +176 -0
  37. package/dist/core/room/RCLivingRoom.d.ts +145 -0
  38. package/dist/core/room/RCLocalMediaStream.d.ts +8 -0
  39. package/dist/core/room/RCMCUConfigBuilder.d.ts +207 -0
  40. package/dist/core/room/RCRTCRoom.d.ts +11 -0
  41. package/dist/core/service/RCMediaService.d.ts +96 -0
  42. package/dist/core/service/helper.d.ts +8 -0
  43. package/dist/core/service/index.d.ts +6 -0
  44. package/dist/core/service/interface.d.ts +311 -0
  45. package/dist/core/service/mcu-interface.d.ts +290 -0
  46. package/dist/core/tracks/RCLocalTrack.d.ts +108 -0
  47. package/dist/core/tracks/RCRemoteTrack.d.ts +23 -0
  48. package/dist/core/tracks/RCTrack.d.ts +80 -0
  49. package/dist/core/webrtc/ASdpStrategy.d.ts +43 -0
  50. package/dist/core/webrtc/PlanBStrategy.d.ts +25 -0
  51. package/dist/core/webrtc/RCRTCPeerConnection.d.ts +80 -0
  52. package/dist/core/webrtc/UnifiedPlanStrategy.d.ts +20 -0
  53. package/dist/core/webrtc/helper.d.ts +26 -0
  54. package/dist/core/webrtc/stat-parser/AbstractStatParser.d.ts +116 -0
  55. package/dist/core/webrtc/stat-parser/ChromeStatParser.d.ts +14 -0
  56. package/dist/core/webrtc/stat-parser/FirefoxStatParser.d.ts +14 -0
  57. package/dist/core/webrtc/stat-parser/IStatParser.d.ts +24 -0
  58. package/dist/core/webrtc/stat-parser/SafariStatParser.d.ts +14 -0
  59. package/dist/device.d.ts +6 -0
  60. package/dist/helper.d.ts +176 -0
  61. package/dist/index.d.ts +26 -7
  62. package/dist/index.esm.js +1 -1
  63. package/dist/index.js +1 -1
  64. package/dist/index.umd.js +1 -1
  65. package/dist/logger.d.ts +4 -0
  66. package/package.json +2 -2
@@ -0,0 +1,305 @@
1
+ import { RTCPluginContext, IRuntime, IServerRTCRoomEntry } from '@rongcloud/engine';
2
+ import { RCRemoteAudioTrack, RCRemoteTrack, RCRemoteVideoTrack } from '../tracks/RCRemoteTrack';
3
+ import { RCRTCCode } from '../enums/RCRTCCode';
4
+ import { IRCRTCInitOptions, IRCRTCReportListener, IRCRTCTrackEventListener, ISubscribeAttr, IAudioLevelChangeHandler } from '../interfaces';
5
+ import PolarisReporter from '../PolarisReporter';
6
+ import { IBroadcastSubReqBody } from '../service';
7
+ import RCLocalMediaStream from './RCLocalMediaStream';
8
+ import { RCResolution } from '../enums/RCResolution';
9
+ import { RCFrameRate } from '../enums/RCFrameRate';
10
+ import { RCLivingType } from '../enums/RCLivingType';
11
+ import RCRTCPeerConnection from '../webrtc/RCRTCPeerConnection';
12
+ export interface IAudienceRoomEventListener extends IRCRTCTrackEventListener {
13
+ /**
14
+ * 主播加入
15
+ * @param userIds 加入主播的 id 列表
16
+ */
17
+ onAnchorJoin?(userId: string[]): void;
18
+ /**
19
+ * 主播退出
20
+ * @param userIds 退出主播的 id 列表
21
+ */
22
+ onAnchorLeave?(userId: string[]): void;
23
+ /**
24
+ * 房间内合流发布资源
25
+ * @param tracks 新发布的合流音轨与视轨数据列表,包含新发布的 RCRemoteAudioTrack 与 RCRemoteVideoTrack 实例
26
+ * @description
27
+ * 当房间内某个主播第一次发布资源时触发
28
+ */
29
+ onTrackPublish?(tracks: RCRemoteTrack[]): void;
30
+ /**
31
+ * 房间内取消合流发布资源
32
+ * @param tracks 被取消发布的合流音轨与视轨数据列表
33
+ * @description
34
+ * 当房间内全部主播退出房间时,SDK 内部会取消对资源的订阅,业务层仅需处理 UI 业务
35
+ */
36
+ onTrackUnpublish?(tracks: RCRemoteTrack[]): void;
37
+ /**
38
+ * 房间内主播发布资源
39
+ * @param tracks 主播新发布的音轨与视轨数据列表,包含新发布的 RCRemoteAudioTrack 与 RCRemoteVideoTrack 实例
40
+ */
41
+ onAnchorTrackPublish?(tracks: RCRemoteTrack[]): void;
42
+ /**
43
+ * 房间内主播取消发布资源
44
+ * @param tracks 被主播取消发布的音轨与视轨数据列表
45
+ * @description 当资源被取消发布时,SDK 内部会取消对相关资源的订阅,业务层仅需处理 UI 业务
46
+ */
47
+ onAnchorTrackUnpublish?(tracks: RCRemoteTrack[]): void;
48
+ /**
49
+ * 房间主播禁用/启用音频
50
+ * @param audioTrack RCRemoteAudioTrack 类实例
51
+ */
52
+ onAudioMuteChange?(audioTrack: RCRemoteAudioTrack): void;
53
+ /**
54
+ * 房间主播禁用/启用视频
55
+ * @param videoTrack RCRemoteVideoTrack 类实例对象
56
+ */
57
+ onVideoMuteChange?(videoTrack: RCRemoteVideoTrack): void;
58
+ /**
59
+ * 房间内主播把发布的资源推至 CDN
60
+ */
61
+ onCDNInfoEnable?(CDNInfo: {
62
+ resolution: RCResolution;
63
+ fps: RCFrameRate;
64
+ }): void;
65
+ /**
66
+ * 主播停止推 CDN
67
+ */
68
+ onCDNInfoDisable?(): void;
69
+ /**
70
+ * 主播改变推 CDN 的分辨率或帧率
71
+ */
72
+ onCDNInfoChange?(CDNInfo: {
73
+ resolution: RCResolution;
74
+ fps: RCFrameRate;
75
+ }): void;
76
+ }
77
+ /**
78
+ * 观众直播房间类
79
+ * 处理:
80
+ * 1、通知观众房间内 人员变更、资源变更
81
+ * 2、观众订阅、取消订阅资源
82
+ */
83
+ export default class RCAudienceLivingRoom {
84
+ private readonly _context;
85
+ private readonly _runtime;
86
+ private readonly _initOptions;
87
+ readonly _roomId: string;
88
+ private readonly _joinResData;
89
+ readonly _livingType: RCLivingType;
90
+ private readonly _service;
91
+ /**
92
+ * 主播列表
93
+ */
94
+ private _roomAnchorList;
95
+ /**
96
+ * 合流、分流资源
97
+ */
98
+ private _roomRes;
99
+ /**
100
+ * 主播分流资源
101
+ */
102
+ private _roomAnchorRes;
103
+ /**
104
+ * 合流、分流 remoteTracks
105
+ */
106
+ private _remoteTracks;
107
+ private _appListener;
108
+ private _pc;
109
+ private _subscribedList;
110
+ private _sessionId;
111
+ private _destroyed;
112
+ /**
113
+ * 北极星上报实例
114
+ */
115
+ protected _polarisReport: PolarisReporter | null;
116
+ /**
117
+ * 音量上报实例
118
+ */
119
+ private _audioLevelReport;
120
+ /**
121
+ * cdn_uris 资源
122
+ */
123
+ private _CDNUris;
124
+ constructor(_context: RTCPluginContext, _runtime: IRuntime, _initOptions: IRCRTCInitOptions, _roomId: string, _joinResData: {
125
+ token: string;
126
+ kvEntries: IServerRTCRoomEntry[];
127
+ }, _livingType: RCLivingType);
128
+ /**
129
+ * 解析服务端返回的 KV 数据,赋值 room 内数据
130
+ */
131
+ private _setInitData;
132
+ protected _assertRoomDestroyed(): RCRTCCode | undefined;
133
+ /**
134
+ * @description 信令数据处理
135
+ * @param roomId 数据对应的房间 Id
136
+ * @param singalData 拉取到的数据
137
+ * * key RC_ANCHOR_LIST value: 为主播 ID 集合
138
+ * * key RC_RES_`userId` value: 为主播发布的资源
139
+ * * key RC_RTC_SESSIONID value: sessionId
140
+ * * key RC_CDN value: CDN 资源数据
141
+ */
142
+ private singalDataChange;
143
+ /**
144
+ * 计算加入离开的主播 ID 列表
145
+ */
146
+ private _diffAnchorList;
147
+ private _handleNewJoinedAnchor;
148
+ private _handleLeftedAnchor;
149
+ /**
150
+ * 计算新发布和取消发布的合流资源
151
+ */
152
+ private _diffRoomResource;
153
+ /**
154
+ * 计算主播发布和取消发布的资源,以及资源的状态变更
155
+ */
156
+ private _diffAnchorResource;
157
+ private _onUserUnpublish;
158
+ private _callAppListener;
159
+ /**
160
+ * ice 断线后,尝试重新走 exchange
161
+ */
162
+ private _reTryExchange;
163
+ /**
164
+ * 获取 subscribe 接口的请求体数据
165
+ * @param subscribeList 订阅清单
166
+ * @param publishedStreams 已发布流
167
+ * @param iceRestart
168
+ */
169
+ protected _createSubscribeParams(subscribeList: ISubscribeAttr[], publishedStreams: {
170
+ [msid: string]: RCLocalMediaStream;
171
+ }, iceRestart: boolean): Promise<{
172
+ reqBody: IBroadcastSubReqBody;
173
+ offer: RTCSessionDescriptionInit;
174
+ dynamicBitrate: {
175
+ min: number;
176
+ max: number;
177
+ };
178
+ }>;
179
+ private _subscribeHandle;
180
+ private _getReqHeaders;
181
+ private _exchangeHandle;
182
+ private _updateSubListHandle;
183
+ /**
184
+ * 对比 cdn_uris 资源
185
+ * @param newCDNUris 新的 cdn_uris 数据
186
+ */
187
+ private _diffCDNUris;
188
+ /**
189
+ * 获取 CDN 资源对应的拉流地址
190
+ * _CDNUris 无 url 时,说明未开启 CDN 推送
191
+ * @returns CDNPlayUrl
192
+ */
193
+ private _getCDNPlayUrl;
194
+ /**
195
+ * 获取 CDN 资源对应的拉流地址
196
+ * @returns CDNPlayUrl
197
+ */
198
+ getCDNPlayUrl(resolution?: RCResolution, fps?: RCFrameRate): Promise<{
199
+ code: RCRTCCode;
200
+ CDNPlayUrl?: string;
201
+ }>;
202
+ /**
203
+ * 订阅资源
204
+ * @param tracks
205
+ */
206
+ subscribe(tracks: (RCRemoteTrack | ISubscribeAttr)[]): Promise<{
207
+ code: RCRTCCode;
208
+ failedList?: ISubscribeAttr[];
209
+ }>;
210
+ private __unsubscribe;
211
+ /**
212
+ * 取消订阅资源
213
+ * @param tracks
214
+ */
215
+ unsubscribe(tracks: RCRemoteTrack[]): Promise<{
216
+ code: RCRTCCode;
217
+ failedList?: ISubscribeAttr[];
218
+ }>;
219
+ /**
220
+ * 退出房间并销毁当前房间实例,退出后该房间的所有方法将不可用
221
+ */
222
+ __destroy(quitRoom: boolean): Promise<void>;
223
+ /**
224
+ * 根据 trackId 获取房间内的远端资源
225
+ * @param trackId
226
+ */
227
+ getRemoteTrack(trackId: string): RCRemoteTrack;
228
+ /**
229
+ * 获取 _pc 实例
230
+ */
231
+ __getPC(): RCRTCPeerConnection;
232
+ /**
233
+ * TODO 待优化
234
+ * @param trackId
235
+ */
236
+ getLocalTrack(trackId: string): RCRemoteTrack;
237
+ /**
238
+ * 断线重连后处理逻辑, SDK 内部处理调用
239
+ */
240
+ __onReconnected(): Promise<void>;
241
+ /**
242
+ * 观众房间事件注册
243
+ * @param tag 参数描述
244
+ */
245
+ registerRoomEventListener(listener: IAudienceRoomEventListener | null): void;
246
+ /**
247
+ * 音量上报
248
+ * @param handler 业务端传入的音量上报事件
249
+ * @param gap 上报时间间隔
250
+ */
251
+ onAudioLevelChange(handler: IAudioLevelChangeHandler | null, gap?: number): void;
252
+ /**
253
+ * 注册房间数据监控
254
+ * @param listener
255
+ */
256
+ registerReportListener(listener: IRCRTCReportListener | null): void;
257
+ /**
258
+ * 获取房间 Id
259
+ */
260
+ getRoomId(): string;
261
+ /**
262
+ * 获取当前 userId
263
+ */
264
+ getCrtUserId(): string;
265
+ /**
266
+ * 获取房间当前会话 Id,当房间内已无成员时房间会回收,重新加入时 sessionId 将更新
267
+ */
268
+ getSessionId(): string;
269
+ /**
270
+ * 获取远程主播用户列表
271
+ */
272
+ getRemoteUserIds(): string[];
273
+ /**
274
+ * 获取远端用户的资源列表
275
+ * @param userId
276
+ * @returns
277
+ */
278
+ getRemoteTracksByUserId(userId: string): RCRemoteTrack[];
279
+ /**
280
+ * 获取房间内所有已发布的远端资源列表, 包含合流资源
281
+ * @returns
282
+ */
283
+ getRemoteTracks(): RCRemoteTrack[];
284
+ /**
285
+ * 获取远端 RTC tracks
286
+ */
287
+ getRemoteRTCTracks(): RCRemoteTrack[];
288
+ /**
289
+ * 获取远端 MCU tracks
290
+ */
291
+ getRemoteMCUTracks(): RCRemoteTrack[];
292
+ /**
293
+ * 获取房间内 CDN 信息
294
+ */
295
+ getCDNInfo(): {
296
+ resolution: RCResolution;
297
+ fps: RCFrameRate;
298
+ CDNEnable: boolean | undefined;
299
+ } | {
300
+ CDNEnable: boolean;
301
+ resolution?: undefined;
302
+ fps?: undefined;
303
+ };
304
+ }
305
+ //# sourceMappingURL=RCAudienceLivingRoom.d.ts.map
@@ -0,0 +1,17 @@
1
+ import { IAudioLevelChangeHandler } from '../interfaces';
2
+ import RCAbstractRoom from './RCAbstractRoom';
3
+ import RCAudienceLivingRoom from './RCAudienceLivingRoom';
4
+ export default class RCAudioLevelReport {
5
+ private readonly _room;
6
+ private _pc;
7
+ private _audioLevelChangeHandler;
8
+ private _timer;
9
+ constructor(_room: RCAbstractRoom | RCAudienceLivingRoom);
10
+ /**
11
+ * 通知业务端音量 > 0 的数据,数组每一项包含 track、audioLevel
12
+ */
13
+ private _audioLevelReport;
14
+ onAudioLevelChange(handler: IAudioLevelChangeHandler | null, gap: number): void;
15
+ clearAudioLevelReportTimer(): void;
16
+ }
17
+ //# sourceMappingURL=RCAudioLevelReport.d.ts.map
@@ -0,0 +1,176 @@
1
+ import { ErrorCode, IReceivedMessage, IRuntime, RTCPluginContext } from '@rongcloud/engine';
2
+ import { RCRTCCode } from '../enums/RCRTCCode';
3
+ import { IPKInfo, IPKEndInfo, IPKInviteAnswerInfo, IPKInviteInfo, IRCRTCInitOptions, IReqResPKOptions } from '../interfaces';
4
+ import RCMediaService from '../service/RCMediaService';
5
+ import { RCRemoteTrack } from '../tracks/RCRemoteTrack';
6
+ import RCLivingRoom from './RCLivingRoom';
7
+ export type IOnRecvPKMsg = (msg: IReceivedMessage) => void;
8
+ export interface IRoomPKEventListener {
9
+ /**
10
+ * 收到连麦邀请
11
+ */
12
+ onRequestJoinOtherRoom: (info: IPKInviteInfo) => {};
13
+ /**
14
+ * 收到取消连麦邀请
15
+ */
16
+ onCancelRequestOtherRoom: (info: IPKInviteInfo) => {};
17
+ /**
18
+ * 收到连麦 PK 请求响应结果
19
+ */
20
+ onResponseJoinOtherRoom: (info: IPKInviteAnswerInfo) => {};
21
+ /**
22
+ * 收到 PK 结束
23
+ */
24
+ onFinishOtherRoom: (info: IPKEndInfo) => {};
25
+ }
26
+ export declare class RCLivingPKHandler {
27
+ private _PKInfo;
28
+ private readonly _context;
29
+ private readonly _runtime;
30
+ private readonly _service;
31
+ private readonly _initOptions;
32
+ /**
33
+ * 主直播房间
34
+ */
35
+ private readonly _mainLivingRoom;
36
+ private readonly _registerPKMsgListener;
37
+ /**
38
+ * 加入 PK 房间回调
39
+ */
40
+ private readonly _onJoinedPKRoom;
41
+ /**
42
+ * 退出 PK 房间回调
43
+ */
44
+ private readonly _onLeavePKRoom;
45
+ /**
46
+ * PK 邀请超时时间,默认 30s
47
+ */
48
+ private readonly _inviteTimeout;
49
+ /**
50
+ * PK 房间信息
51
+ */
52
+ private _appListener;
53
+ private _mainRoomId;
54
+ /**
55
+ * 跨房间连麦加入的 PK 房间
56
+ */
57
+ private _joinedPKRooms;
58
+ constructor(_PKInfo: IPKInfo, _context: RTCPluginContext, _runtime: IRuntime, _service: RCMediaService, _initOptions: IRCRTCInitOptions,
59
+ /**
60
+ * 主直播房间
61
+ */
62
+ _mainLivingRoom: RCLivingRoom, _registerPKMsgListener: (listener: IOnRecvPKMsg) => void,
63
+ /**
64
+ * 加入 PK 房间回调
65
+ */
66
+ _onJoinedPKRoom: (roomId: string, room: RCLivingRoom) => void,
67
+ /**
68
+ * 退出 PK 房间回调
69
+ */
70
+ _onLeavePKRoom: (roomId: string) => void);
71
+ private _callAppListener;
72
+ /**
73
+ * 收到连麦邀请
74
+ */
75
+ private _onInvite;
76
+ /**
77
+ * 收到取消连麦
78
+ */
79
+ private _onCancelInvite;
80
+ private _onInviteTimeout;
81
+ /**
82
+ * 收到响应连麦
83
+ */
84
+ private _onInviteAnswer;
85
+ /**
86
+ * 收到连麦结束
87
+ */
88
+ private _onPKEnd;
89
+ /**
90
+ * 处理跨房间连麦相关消息
91
+ */
92
+ private _onRecvPKMsg;
93
+ /**
94
+ * 注册跨房间连麦监听事件
95
+ */
96
+ registerRoomPKEventListener(listener: IRoomPKEventListener): void;
97
+ /**
98
+ * 发起跨房间连麦请求
99
+ * @param inviteeRoomId 被邀请者所处的房间 roomId
100
+ * @param inviteeUserId 被邀请者 userId
101
+ * @param options.autoMix 是否要把邀请者发布的资源,合并到被邀请者房间内的 MCU 流中
102
+ * @param options.extra 拓展字段,可随邀请连麦消息透传给被邀请者
103
+ */
104
+ requestJoinOtherRoom(inviteeRoomId: string, inviteeUserId: string, options?: IReqResPKOptions): Promise<{
105
+ code: RCRTCCode | ErrorCode;
106
+ }>;
107
+ /**
108
+ * 取消跨房间连麦请求
109
+ * @param inviteeRoomId 被邀请者所处的房间 roomId
110
+ * @param inviteeUserId 被邀请者 userId
111
+ * @param extra 附加信息,可随取消邀请连麦消息透传给被邀请者
112
+ */
113
+ cancelRequestJoinOtherRoom(inviteeRoomId: string, inviteeUserId: string, extra?: string): Promise<{
114
+ code: RCRTCCode | ErrorCode;
115
+ }>;
116
+ /**
117
+ * 响应跨房间连麦请求
118
+ * @param inviterRoomId 邀请者所处的房间 roomId
119
+ * @param inviterUserId 邀请者 userId
120
+ * @param agree 是否同意连麦
121
+ * @param options.autoMix 是否要把被邀请者发布的资源,合并到邀请者房间内的 MCU 流中
122
+ * @param options.extra 附加信息,可随响应连麦消息透传给邀请者
123
+ */
124
+ responseJoinOtherRoom(inviterRoomId: string, inviterUserId: string, agree: boolean, options?: IReqResPKOptions): Promise<{
125
+ code: RCRTCCode | ErrorCode;
126
+ }>;
127
+ /**
128
+ * 结束跨房间连麦
129
+ * @param roomId 需要结束连麦的房间 roomId
130
+ */
131
+ private _quitRoomPK;
132
+ private _relaseCrtRoom;
133
+ /**
134
+ * 加入副直播房间
135
+ * @roomId 副房间的 roomId
136
+ */
137
+ joinOtherRoom(roomId: string): Promise<{
138
+ code: RCRTCCode;
139
+ room?: RCLivingRoom;
140
+ userIds?: string[];
141
+ tracks?: RCRemoteTrack[];
142
+ CDNEnable?: boolean;
143
+ }>;
144
+ /**
145
+ * 退出副房间
146
+ * @param room 要退出的副房间的 room 实例
147
+ * @param isQuitPK 是否要结束连麦
148
+ */
149
+ leaveOtherRoom(room: RCLivingRoom, isQuitPK?: boolean): Promise<{
150
+ code: RCRTCCode;
151
+ }>;
152
+ private _leaveOtherRoom;
153
+ /**
154
+ * 获取连麦信息
155
+ * @param roomId 连麦房间的 roomId
156
+ */
157
+ getPKInfo(roomId: string): {
158
+ inviteSessionId: string;
159
+ inviterRoomId: string;
160
+ inviterUserId: string;
161
+ inviterUserAutoMix?: boolean | undefined;
162
+ inviteeRoomId: string;
163
+ inviteeUserAutoMix?: boolean | undefined;
164
+ };
165
+ /**
166
+ * 获取所有连麦信息
167
+ */
168
+ getAllPKInfo(): IPKInfo;
169
+ /**
170
+ * 获取已加入的副房间
171
+ */
172
+ getJoinedPKRooms(): {
173
+ [roomId: string]: RCLivingRoom;
174
+ };
175
+ }
176
+ //# sourceMappingURL=RCLivingPKHandler.d.ts.map
@@ -0,0 +1,145 @@
1
+ import { IJoinRTCRoomData, RTCPluginContext, IRuntime } from '@rongcloud/engine';
2
+ import { RCRTCCode } from '../enums/RCRTCCode';
3
+ import { IRCRTCInitOptions, IPublishedResource } from '../interfaces';
4
+ import { RCMediaService, ICDNUris, IExchangeReqBody } from '../service';
5
+ import RCAbstractRoom, { IPushOtherRooms } from './RCAbstractRoom';
6
+ import RCMCUConfigBuilder from './RCMCUConfigBuilder';
7
+ import { RCLivingType } from '../enums/RCLivingType';
8
+ import { RCInnerCDNPushMode } from '../enums/RCInnerCDNPushMode';
9
+ import { RCLivingPKHandler } from './RCLivingPKHandler';
10
+ /**
11
+ * 直播房间
12
+ */
13
+ export default class RCLivingRoom extends RCAbstractRoom {
14
+ private _livingType;
15
+ /**
16
+ * 是否是主房间
17
+ */
18
+ protected _isMainRoom: boolean;
19
+ readonly _mcuConfigBuilder: RCMCUConfigBuilder;
20
+ /**
21
+ * cdn_uris 信令扩散数据
22
+ */
23
+ private _CDNUris;
24
+ private _CDNEnable;
25
+ /**
26
+ * 跨房间连麦管理器
27
+ */
28
+ private readonly _roomPKHandler;
29
+ constructor(context: RTCPluginContext, runtime: IRuntime, roomId: string, data: IJoinRTCRoomData, service: RCMediaService, initOptions: IRCRTCInitOptions, clientEvent: Function, _livingType: RCLivingType, isUpgrage: boolean | undefined,
30
+ /**
31
+ * 是否是主房间
32
+ */
33
+ _isMainRoom: boolean);
34
+ /**
35
+ * resourceId 有效性验证
36
+ * @param resourceId
37
+ */
38
+ protected _isValidResourceId(resourceId: string): boolean;
39
+ getLivingType(): RCLivingType;
40
+ /**
41
+ * 获取 MCU 配置构建对象
42
+ */
43
+ getMCUConfigBuilder(): RCMCUConfigBuilder | {
44
+ code: RCRTCCode;
45
+ };
46
+ /**
47
+ * 接收 MCU 配置并向 MediaServer 提交
48
+ * @param data
49
+ */
50
+ private _onMCUConfigFlush;
51
+ /**
52
+ * 主播端断线重连后,需更新内存中的 CDN 数据
53
+ * 判断房间内 CDN 状态是否和内存数据一致,不一致时需通知到客户端
54
+ */
55
+ __onReconnected(): Promise<void>;
56
+ /**
57
+ * 开启/停用推 CDN
58
+ */
59
+ enableInnerCDN(enable: boolean): Promise<{
60
+ code: RCRTCCode;
61
+ }>;
62
+ /**
63
+ * 开启、停用 CDN 推资源后发信令
64
+ */
65
+ private _sendCDNInfoSignal;
66
+ /**
67
+ * 扩散 cdn_uris 资源
68
+ */
69
+ private _spreadCDNInfo;
70
+ /**
71
+ * 给房间设置 CDN 数据
72
+ */
73
+ private _setRoomCDNInfo;
74
+ /**
75
+ * 资源变化时触发
76
+ * 直播房间需单独处理 cdn_uris
77
+ */
78
+ protected _resourceHandle(content: {
79
+ /**
80
+ * 旧版本兼容参数,当收到非 `RTCMessageName.TOTAL_CONTENT_RESOURCE` 时:
81
+ * * ignore 值为 `true` 表示该消息由 signal server 向旧版本 RTCLib 提供的兼容消息,无需处理
82
+ * * 否则认为该消息是由旧版本 RTCLib 主动发出的增量变更消息,需要处理
83
+ */
84
+ ignore?: boolean;
85
+ /**
86
+ * 发布到房间内的资源列表,`RTCMessageName.TOTAL_CONTENT_RESOURCE` 消息携带全量数据,否则为增量数据
87
+ */
88
+ uris: IPublishedResource[];
89
+ cdn_uris?: ICDNUris[];
90
+ }, messageType: string, userId: string): Promise<void>;
91
+ /**
92
+ * 重写父类 _exchangeHandle 方法
93
+ */
94
+ protected _exchangeHandle(body: IExchangeReqBody): Promise<{
95
+ code: RCRTCCode;
96
+ data?: import("../service").IExchangeResponse | undefined;
97
+ }>;
98
+ /**
99
+ * 观众切换为主播后直接处理人员变更及资源变更
100
+ */
101
+ protected _afterChangedRole(data: IJoinRTCRoomData): void;
102
+ /**
103
+ * 返回 CDN 是否可用
104
+ * @returns boolean
105
+ */
106
+ __getCDNEnable(): boolean | undefined;
107
+ /**
108
+ * 返回 CDN 推送模式: 自动 or 手动
109
+ * @returns boolean
110
+ */
111
+ __getCDNPushMode(): RCInnerCDNPushMode | undefined;
112
+ /**
113
+ * 加入 PK 房间回调
114
+ */
115
+ private _onJoinedPKRoom;
116
+ /**
117
+ * 离开 PK 房间后,如果参与过连麦,pushOtherRooms 需去掉退出的连麦房间配置,重新和 mediaServer 交互
118
+ */
119
+ private _onLeavePKRoom;
120
+ /**
121
+ * @override
122
+ */
123
+ protected _getPushOtherRoomsParams(): IPushOtherRooms[];
124
+ /**
125
+ * 携带 pushOtherRooms 与 mediaServer 重新交互
126
+ */
127
+ private _exchangeWithPushOtherRoom;
128
+ /**
129
+ * 获取 PK 业务处理器
130
+ * @since version 5.3.0
131
+ */
132
+ getRoomPKHandler(): {
133
+ code: RCRTCCode;
134
+ roomPKHandler?: RCLivingPKHandler;
135
+ };
136
+ /**
137
+ * 退出所有连麦房间
138
+ */
139
+ protected _quitAllPKRoom(): void;
140
+ /**
141
+ * 是否是主房间
142
+ */
143
+ isMainRoom(): boolean;
144
+ }
145
+ //# sourceMappingURL=RCLivingRoom.d.ts.map
@@ -0,0 +1,8 @@
1
+ export default class RCLocalMediaStream {
2
+ readonly msid: string;
3
+ readonly mediaStream: MediaStream;
4
+ readonly tinyStream: MediaStream;
5
+ readonly tag: string;
6
+ constructor(msid: string);
7
+ }
8
+ //# sourceMappingURL=RCLocalMediaStream.d.ts.map