@rongcloud/plugin-call-plus 2.1.10-alpha.1 → 2.1.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/index.d.ts +251 -18
- package/index.esm.js +1 -1
- package/index.js +1 -1
- package/package.json +2 -2
- package/wrapper/index.esm.js +1 -1
- package/wrapper/index.js +1 -1
package/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { RCConnectionStatus, EventEmitter, BasicLogger, PluginContext, IRuntime, EnableLogL, IReceivedMessage, IPluginGenerator } from '@rongcloud/engine';
|
|
2
|
-
import { RCRemoteTrack, RCTrack, ISubscribeAttr, RCRTCCode, RCLocalAudioTrack, RCRemoteAudioTrack, RCRTCClient, RCFrameRate, RCResolution } from '@rongcloud/plugin-rtc';
|
|
2
|
+
import { RCRemoteTrack, RCTrack, ISubscribeAttr, RCRTCCode, RCLocalAudioTrack, RCRemoteAudioTrack, RCRTCClient, RCRTCRoom, RCLocalTrack, IPublishAttrs, IPubSuccessRes, RCFrameRate, RCResolution } from '@rongcloud/plugin-rtc';
|
|
3
3
|
export { RCFrameRate as RCCallPlusFrameRate, RCResolution as RCCallPlusResolution } from '@rongcloud/plugin-rtc';
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -1195,14 +1195,6 @@ interface ISessionUser {
|
|
|
1195
1195
|
* 成员系统状态
|
|
1196
1196
|
*/
|
|
1197
1197
|
systemState: RCCallPlusReason;
|
|
1198
|
-
/**
|
|
1199
|
-
* 摄像头是否可用
|
|
1200
|
-
*/
|
|
1201
|
-
cameraEnable: boolean;
|
|
1202
|
-
/**
|
|
1203
|
-
* 麦克风是否可用
|
|
1204
|
-
*/
|
|
1205
|
-
microphoneEnable: boolean;
|
|
1206
1198
|
/**
|
|
1207
1199
|
* 来源组 ID 类型
|
|
1208
1200
|
*/
|
|
@@ -1634,7 +1626,6 @@ declare class RCCallInnerSession extends EventEmitter {
|
|
|
1634
1626
|
*/
|
|
1635
1627
|
getInviteeTimerId(): number;
|
|
1636
1628
|
getAllTimerIds(): number[];
|
|
1637
|
-
setUserDeviceEnable(userId: string, mediaType: RCCallPlusMediaType, enable: boolean, traceId: string): void;
|
|
1638
1629
|
/**
|
|
1639
1630
|
* 更新人员列表, 并返回更新的人员列表
|
|
1640
1631
|
* 根据人员状态去添加、删除、更新
|
|
@@ -2141,6 +2132,246 @@ declare class AbnormalCall {
|
|
|
2141
2132
|
getAbnormalCallIds(userId: string): Promise<string[] | null>;
|
|
2142
2133
|
}
|
|
2143
2134
|
|
|
2135
|
+
declare class RTCModule extends EventEmitter {
|
|
2136
|
+
private readonly _context;
|
|
2137
|
+
private readonly _runtime;
|
|
2138
|
+
private readonly _initOpts;
|
|
2139
|
+
private readonly _logger;
|
|
2140
|
+
private readonly _callEngine;
|
|
2141
|
+
private readonly _reportAppEventModule;
|
|
2142
|
+
static __INNER_RTC_PROCESS_FAILED__: string;
|
|
2143
|
+
static __INNER_RTC_PEERCONNECTION_ABNORMAL_CLOSE__: string;
|
|
2144
|
+
static __INNER_ON_SELF_JOINED__: string;
|
|
2145
|
+
static __INNER_ON_OTHER_JOINED__: string;
|
|
2146
|
+
static __INNER_RECEIVE_FIRST_FRAME__: string;
|
|
2147
|
+
static __INNER_ON_KICKOFF__: string;
|
|
2148
|
+
/**
|
|
2149
|
+
* RCRTC 实例
|
|
2150
|
+
*/
|
|
2151
|
+
_rtcClient: RCRTCClient;
|
|
2152
|
+
/**
|
|
2153
|
+
* 己方的音视频 tracks
|
|
2154
|
+
*/
|
|
2155
|
+
private _localTracks;
|
|
2156
|
+
/**
|
|
2157
|
+
* RCRTCRoom 实例
|
|
2158
|
+
*/
|
|
2159
|
+
_room: RCRTCRoom | null;
|
|
2160
|
+
private _callId;
|
|
2161
|
+
private _callMediaType;
|
|
2162
|
+
private _videoConfig;
|
|
2163
|
+
private _audioConfig;
|
|
2164
|
+
private _isPubTiny;
|
|
2165
|
+
private _audioOutputDeviceId;
|
|
2166
|
+
/**
|
|
2167
|
+
* 视频配置是否变更
|
|
2168
|
+
*/
|
|
2169
|
+
private _videoConfigIsChange;
|
|
2170
|
+
/**
|
|
2171
|
+
* 音频配置是否变更
|
|
2172
|
+
*/
|
|
2173
|
+
private _audioConfigIsChange;
|
|
2174
|
+
/**
|
|
2175
|
+
* 存储设置的人员和视图
|
|
2176
|
+
*/
|
|
2177
|
+
private _userViewMap;
|
|
2178
|
+
private _callPlusStatusReportListener;
|
|
2179
|
+
private _remoteAudioEnable;
|
|
2180
|
+
constructor(_context: PluginContext, _runtime: IRuntime, _initOpts: ICallPlusInitOpts, _logger: BasicLogger, _callEngine: RCCallEngine, _reportAppEventModule: RCCallPlusReportModule);
|
|
2181
|
+
setCallPlusStatusReportListener(listener: IStatusReportListener): void;
|
|
2182
|
+
/**
|
|
2183
|
+
* 取摄像头资源
|
|
2184
|
+
* 内存中有时,返回内存中的视轨
|
|
2185
|
+
*/
|
|
2186
|
+
getCameraVideoTrack(traceId: string): Promise<{
|
|
2187
|
+
code: number;
|
|
2188
|
+
track?: RCLocalTrack;
|
|
2189
|
+
}>;
|
|
2190
|
+
/**
|
|
2191
|
+
* 取麦克风资源
|
|
2192
|
+
* 内存中有时,返回内存中的音轨
|
|
2193
|
+
*/
|
|
2194
|
+
getMicrophoneAudioTrack(traceId: string): Promise<{
|
|
2195
|
+
code: number;
|
|
2196
|
+
track?: RCLocalTrack;
|
|
2197
|
+
}>;
|
|
2198
|
+
/**
|
|
2199
|
+
* 根据通话类型创建音、视频资源
|
|
2200
|
+
* @param mediaType 音频或音视频
|
|
2201
|
+
*/
|
|
2202
|
+
createCallMediaTracks(mediaType: RCCallPlusMediaType, traceId: string): Promise<{
|
|
2203
|
+
code: number;
|
|
2204
|
+
}>;
|
|
2205
|
+
setVideoConfig(videoConfig: IVideoConfig): void;
|
|
2206
|
+
setAudioConfig(audioConfig: IAudioConfig): void;
|
|
2207
|
+
setAudioOutputDeviceId(deviceId: string): Promise<{
|
|
2208
|
+
code: number;
|
|
2209
|
+
}>;
|
|
2210
|
+
destroyAllTracks(traceId: string): void;
|
|
2211
|
+
setAllRemoteAudioEnable(enable: boolean, traceId: string): {
|
|
2212
|
+
code: 80001;
|
|
2213
|
+
} | {
|
|
2214
|
+
code: 0;
|
|
2215
|
+
};
|
|
2216
|
+
destroyTrack(track: RCLocalTrack): Promise<void>;
|
|
2217
|
+
/**
|
|
2218
|
+
* session 连接
|
|
2219
|
+
*/
|
|
2220
|
+
sessionConnected(callId: string, traceId: string): Promise<void>;
|
|
2221
|
+
sessionClose(callId: string, traceId: string): Promise<void>;
|
|
2222
|
+
/**
|
|
2223
|
+
* 禁用视频 track
|
|
2224
|
+
*/
|
|
2225
|
+
disableVideoTrack(): Promise<{
|
|
2226
|
+
code: number | RCRTCCode;
|
|
2227
|
+
track?: RCLocalTrack;
|
|
2228
|
+
}>;
|
|
2229
|
+
/**
|
|
2230
|
+
* 启用视频track
|
|
2231
|
+
* 1. 启用前应用层需先创建视频 track
|
|
2232
|
+
*/
|
|
2233
|
+
enableVideoTrack(traceId: string): Promise<{
|
|
2234
|
+
code: number | RCRTCCode;
|
|
2235
|
+
}>;
|
|
2236
|
+
/**
|
|
2237
|
+
* 通话中切换视频设备
|
|
2238
|
+
*/
|
|
2239
|
+
changeVideoDevice(traceId: string): Promise<{
|
|
2240
|
+
code: number;
|
|
2241
|
+
track?: RCLocalTrack;
|
|
2242
|
+
}>;
|
|
2243
|
+
/**
|
|
2244
|
+
* 通话中更换音频设备
|
|
2245
|
+
*/
|
|
2246
|
+
changeAudioDevice(traceId: string): Promise<{
|
|
2247
|
+
code: number;
|
|
2248
|
+
}>;
|
|
2249
|
+
/**
|
|
2250
|
+
* 禁用音频 track
|
|
2251
|
+
*/
|
|
2252
|
+
disableAudioTrack(): Promise<{
|
|
2253
|
+
code: number | RCRTCCode;
|
|
2254
|
+
track?: RCLocalTrack;
|
|
2255
|
+
}>;
|
|
2256
|
+
/**
|
|
2257
|
+
* 媒体类型升、降
|
|
2258
|
+
*/
|
|
2259
|
+
changeMediaType(mediaType: RCCallPlusMediaType, traceId: string): Promise<void>;
|
|
2260
|
+
/**
|
|
2261
|
+
* 升级 音频 -> 音视频
|
|
2262
|
+
* 1. 业务层需要先通过 createLocalTracks 创建本地视频 track
|
|
2263
|
+
* 2. SDK 只处理发布视频 track
|
|
2264
|
+
*/
|
|
2265
|
+
private _upgradeMediaType;
|
|
2266
|
+
/**
|
|
2267
|
+
* 降级处理
|
|
2268
|
+
*/
|
|
2269
|
+
private _downgradeMediaType;
|
|
2270
|
+
/**
|
|
2271
|
+
* 加入 RTC 房间
|
|
2272
|
+
*/
|
|
2273
|
+
joinRTCRoom(callId: string, traceId: string): Promise<{
|
|
2274
|
+
code: number;
|
|
2275
|
+
room?: RCRTCRoom;
|
|
2276
|
+
tracks?: RCRemoteTrack[];
|
|
2277
|
+
}>;
|
|
2278
|
+
/**
|
|
2279
|
+
* RTC 订阅
|
|
2280
|
+
*/
|
|
2281
|
+
subscribeTracks(tracks: (ISubscribeAttr)[], traceId: string): Promise<{
|
|
2282
|
+
code: number;
|
|
2283
|
+
}>;
|
|
2284
|
+
/**
|
|
2285
|
+
* RTC 取消订阅
|
|
2286
|
+
*/
|
|
2287
|
+
unsubscribeTracks(tracks: RCRemoteTrack[], traceId: string): Promise<{
|
|
2288
|
+
code: number;
|
|
2289
|
+
}>;
|
|
2290
|
+
private _releaseStoredData;
|
|
2291
|
+
getRemoteTracks(): {
|
|
2292
|
+
[userId: string]: RCRemoteTrack[];
|
|
2293
|
+
};
|
|
2294
|
+
getRemoteTrack(userId: string, mediaType: RCCallPlusMediaType): RCRemoteTrack | undefined;
|
|
2295
|
+
getRTCSessionId(): string | null;
|
|
2296
|
+
/** ======私有方法============================================================================================= */
|
|
2297
|
+
/**
|
|
2298
|
+
* RTC 事件监听注册
|
|
2299
|
+
*/
|
|
2300
|
+
private _regRTCListeners;
|
|
2301
|
+
private _onLocalTrackReady;
|
|
2302
|
+
private _onRemoteTrackReady;
|
|
2303
|
+
private _onKickOff;
|
|
2304
|
+
/**
|
|
2305
|
+
* RTC Peer 异常关闭
|
|
2306
|
+
* 移动端未处理此回调,定义 sysStatus 为 CONNECTION_ERR
|
|
2307
|
+
*/
|
|
2308
|
+
private _onRTCPeerConnectionCloseByException;
|
|
2309
|
+
private _onSelfJoined;
|
|
2310
|
+
private _onRemoteTrackPublish;
|
|
2311
|
+
private _onTrackUnpublish;
|
|
2312
|
+
private _onAudioMuteChange;
|
|
2313
|
+
private _onVideoMuteChagne;
|
|
2314
|
+
private _onRTCStateReport;
|
|
2315
|
+
/**
|
|
2316
|
+
* RTC 接收最终失败后需要调用 hangup 挂断的情况
|
|
2317
|
+
*/
|
|
2318
|
+
private _onRTCMethodFail;
|
|
2319
|
+
private _onOtherMemJoined;
|
|
2320
|
+
/**
|
|
2321
|
+
* 创建本地音频 track, 创建成功后保存本地并回调通知
|
|
2322
|
+
*/
|
|
2323
|
+
private _createAudioTrack;
|
|
2324
|
+
/**
|
|
2325
|
+
* 创建本地视频 track, 创建成功后保存本地并回调通知
|
|
2326
|
+
*/
|
|
2327
|
+
private _createVideoTrack;
|
|
2328
|
+
/**
|
|
2329
|
+
* 获得本地缓存视频 track
|
|
2330
|
+
*/
|
|
2331
|
+
getLocalVideoTrack(): RCLocalTrack | undefined;
|
|
2332
|
+
/**
|
|
2333
|
+
* 获得本地缓存音频 track
|
|
2334
|
+
*/
|
|
2335
|
+
getLocalAudioTrack(): RCLocalTrack | undefined;
|
|
2336
|
+
/**
|
|
2337
|
+
* 发布本地资源的逻辑
|
|
2338
|
+
*/
|
|
2339
|
+
publish(tracks: (RCLocalTrack | IPublishAttrs)[], traceId: string): Promise<{
|
|
2340
|
+
code: number;
|
|
2341
|
+
}>;
|
|
2342
|
+
publishVideoTrack(): Promise<IPubSuccessRes>;
|
|
2343
|
+
setVideoView(list: {
|
|
2344
|
+
userId: string;
|
|
2345
|
+
videoElement: HTMLVideoElement;
|
|
2346
|
+
isTiny?: boolean;
|
|
2347
|
+
}[], traceId: string): void;
|
|
2348
|
+
/**
|
|
2349
|
+
* 删除视图时,取消订阅资源
|
|
2350
|
+
*/
|
|
2351
|
+
removeVideoView(userIds: string[], traceId: string): void;
|
|
2352
|
+
/**
|
|
2353
|
+
* 获取存储的人员和 video 元素数据
|
|
2354
|
+
*/
|
|
2355
|
+
getUserViewMap(): {
|
|
2356
|
+
[userId: string]: {
|
|
2357
|
+
videoView: HTMLVideoElement;
|
|
2358
|
+
isTiny: boolean;
|
|
2359
|
+
};
|
|
2360
|
+
};
|
|
2361
|
+
/**
|
|
2362
|
+
* 播放媒体资源
|
|
2363
|
+
*/
|
|
2364
|
+
playMedia(userId: string, mediaType: RCCallPlusMediaType, videoView: HTMLVideoElement, traceId: string): Promise<{
|
|
2365
|
+
code: 80104;
|
|
2366
|
+
} | {
|
|
2367
|
+
code: 80102;
|
|
2368
|
+
} | {
|
|
2369
|
+
code: RCRTCCode.PB_ERROR | RCRTCCode.SIGNAL_DISCONNECTED | RCRTCCode.PARAMS_ERROR | RCRTCCode.REPERT_JOIN_ROOM | RCRTCCode.NOT_IN_ROOM | RCRTCCode.SERVICE_INVALID | RCRTCCode.RTC_TOKEN_INVALID | RCRTCCode.SIGNAL_ERROR | RCRTCCode.CREATE_OFFER_FAILED | RCRTCCode.REQUEST_FAILED | RCRTCCode.MCU_SERVER_NOT_FOUND | RCRTCCode.BROADCAST_SUB_LIST_NOT_EMPTY | RCRTCCode.ROOM_HAS_BEEN_DESTROYED | RCRTCCode.NOT_OPEN_VIDEO_AUDIO_SERVER | RCRTCCode.GET_USER_MEDIA_FAILED | RCRTCCode.GET_DISPLAY_MEDIA_FAILED | RCRTCCode.BROWSER_PERMISSION_DENIED | RCRTCCode.CREATE_CUSTOM_TRACK_FAILED | RCRTCCode.INVALID_TAGS | RCRTCCode.INVALID_USER_ID | RCRTCCode.CREATE_FILE_TRACK_FAILED | RCRTCCode.INVALID_FILE_INSTANCE | RCRTCCode.SET_REMOTE_DESCRIPTION_FAILED | RCRTCCode.BROWSER_NOT_SUPPORT | RCRTCCode.TRACK_NOT_READY | RCRTCCode.VIDEO_TRACK_MISS_MEDIA_ELEMENT | RCRTCCode.TRACK_PLAY_ERROR | RCRTCCode.SIGNAL_AUDIENCE_JOIN_ROOM_FAILED | RCRTCCode.SIGNAL_ROOM_CHANGE_IDENTITY_FAILED | RCRTCCode.PACKAGE_ENVIRONMENT_ERROR | RCRTCCode.PUBLISH_TRACK_LIMIT_EXCEEDED | RCRTCCode.CDN_RESOURCE_IS_EMPTY | RCRTCCode.SIGNAL_JOIN_RTC_ROOM_REFUSED | RCRTCCode.NO_PERMISSION_TO_USE_REQUESTED_DEVICE | RCRTCCode.THE_FUNCTION_IS_DISABLED_IN_PKROOM | RCRTCCode.SOME_TRACKS_PUBLISH_FAILED | RCRTCCode.MAC_IN_ELECTRON_NOT_SUPPORT_SCREEN_SHARE_WITH_AUDIO | RCRTCCode.JWT_TIME_OUT | RCRTCCode.SYSTEM_PERMISSION_DENIED | RCRTCCode.PUBLISH_TRACKS_IS_INVALID | RCRTCCode.TRACK_READYSTATE_IS_ENDED | RCRTCCode.APPLY_3A_NOISE_WORKLET_BEFORE_PUBLISH | RCRTCCode.LOAD_3A_MODULE_FAILED;
|
|
2370
|
+
} | {
|
|
2371
|
+
code: 0;
|
|
2372
|
+
}>;
|
|
2373
|
+
}
|
|
2374
|
+
|
|
2144
2375
|
declare class RCCallEngine extends EventEmitter {
|
|
2145
2376
|
private readonly _context;
|
|
2146
2377
|
private readonly _runtime;
|
|
@@ -2186,6 +2417,10 @@ declare class RCCallEngine extends EventEmitter {
|
|
|
2186
2417
|
* client callId
|
|
2187
2418
|
*/
|
|
2188
2419
|
private _clientCallId;
|
|
2420
|
+
/**
|
|
2421
|
+
* session 需使用 rtc 模块取设备状态
|
|
2422
|
+
*/
|
|
2423
|
+
private _rtcModule;
|
|
2189
2424
|
/**
|
|
2190
2425
|
* 构造器
|
|
2191
2426
|
*/
|
|
@@ -2311,8 +2546,7 @@ declare class RCCallEngine extends EventEmitter {
|
|
|
2311
2546
|
* 通知人员状态
|
|
2312
2547
|
* CallClient 也需要更新人员状态,定义为公共函数
|
|
2313
2548
|
*/
|
|
2314
|
-
updateUsersState(callId: string, users: ISessionUser[], traceId: string):
|
|
2315
|
-
setUserDeviceEnable(userId: string, mediaType: RCCallPlusMediaType, enable: boolean, traceId: string): void;
|
|
2549
|
+
updateUsersState(callId: string, users: ISessionUser[], traceId: string): ISessionUser[];
|
|
2316
2550
|
/**
|
|
2317
2551
|
* 获取通话开始时间
|
|
2318
2552
|
*/
|
|
@@ -2353,6 +2587,7 @@ declare class RCCallEngine extends EventEmitter {
|
|
|
2353
2587
|
endCurrentUserAbnormalCalls(allDevice: boolean): Promise<{
|
|
2354
2588
|
code: number;
|
|
2355
2589
|
}>;
|
|
2590
|
+
setRTCModule(rtcModule: RTCModule): void;
|
|
2356
2591
|
/** ======私有方法============================================================================================= */
|
|
2357
2592
|
/**
|
|
2358
2593
|
* IM 状态变更处理
|
|
@@ -2438,7 +2673,7 @@ declare class RCCallEngine extends EventEmitter {
|
|
|
2438
2673
|
* A2 多端在接听和直接加入 call 时,上报 onPhoneEnd 状态,消除 B 端展示的 onPhone 状态
|
|
2439
2674
|
*/
|
|
2440
2675
|
private _clearMobileOnPhone;
|
|
2441
|
-
|
|
2676
|
+
reportRemoteUserStateChange(callId: string, users: ISessionUser[], traceId: string): void;
|
|
2442
2677
|
private _onOtherMemberInvite;
|
|
2443
2678
|
private _onRequestChangeMediaType;
|
|
2444
2679
|
private _receiveMediaTypeChangeResult;
|
|
@@ -2452,10 +2687,12 @@ declare class RCCallPlusSession {
|
|
|
2452
2687
|
private readonly _session;
|
|
2453
2688
|
private readonly _callEngine;
|
|
2454
2689
|
private readonly _logger;
|
|
2690
|
+
private readonly _rtcModule;
|
|
2691
|
+
private readonly _context;
|
|
2455
2692
|
private _startTime;
|
|
2456
2693
|
private _duration;
|
|
2457
2694
|
private _callId;
|
|
2458
|
-
constructor(_session: RCCallInnerSession, _callEngine: RCCallEngine, _logger: BasicLogger);
|
|
2695
|
+
constructor(_session: RCCallInnerSession, _callEngine: RCCallEngine, _logger: BasicLogger, _rtcModule: RTCModule, _context: PluginContext);
|
|
2459
2696
|
/**
|
|
2460
2697
|
* 获取 CallId
|
|
2461
2698
|
*/
|
|
@@ -3224,10 +3461,6 @@ declare class RCCallPlusClient {
|
|
|
3224
3461
|
* 被踢出房间时,需结束通话
|
|
3225
3462
|
*/
|
|
3226
3463
|
private _kickoffHandle;
|
|
3227
|
-
/**
|
|
3228
|
-
* 远端资源音视频状态变化,需更新 session 中人员的设备状态
|
|
3229
|
-
*/
|
|
3230
|
-
private _receiveDeviceEnableChangeHandle;
|
|
3231
3464
|
/**
|
|
3232
3465
|
* 通话挂断时,需清空内存,离开房间
|
|
3233
3466
|
*/
|