@hysc/meeting 10.0.3 → 10.0.5

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 CHANGED
@@ -1,9 +1,9 @@
1
1
  import * as lodash_es from 'lodash-es';
2
- import BCClient, { BCUser, BloudStream, ShareMediaOptions, Player, AudioPlayer } from '@hysc/core';
2
+ import BCClient, { BCUser, ShareMediaOptions, Player, AudioPlayer } from '@hysc/core';
3
3
  import { BehaviorSubject, Subject } from 'rxjs';
4
4
  import { BoomError } from '@hysc/utils';
5
5
  export { Logger } from '@hysc/utils';
6
- import { StreamCustomInfo } from '@hysc/bloud/src/core/Room';
6
+ import { StreamCustomInfo, BloudStream } from '@hysc/bloud';
7
7
 
8
8
  interface IMessageInfo {
9
9
  userId?: string;
@@ -40,26 +40,6 @@ declare class BMMessageInfo {
40
40
  * 内置 user id 类型
41
41
  */
42
42
  declare type UserId = number | string;
43
- /**
44
- * 用户角色
45
- */
46
- declare type Role = 'anchor' | 'audience';
47
- /**
48
- * 房间类型
49
- */
50
- declare type RoomType = 'big' | 'normal';
51
- /**
52
- * 视频编码
53
- */
54
- declare type Codec = 'h264' | 'vp8';
55
- /**
56
- * 音频编码
57
- */
58
- declare type AudioCodec = 'opus';
59
- /**
60
- * 直播模式
61
- */
62
- declare type Mode = 'rtc' | 'live';
63
43
  /**
64
44
  * MediaStreamTrack 类型
65
45
  */
@@ -128,418 +108,6 @@ declare interface Device {
128
108
  * 主流还是辅流
129
109
  */
130
110
  declare type StreamType$1 = 'main' | 'assist';
131
- declare module logger {
132
- /**
133
- * debug 级别
134
- */
135
- export const DEBUG = 1;
136
- /**
137
- * info 级别
138
- */
139
- export const INFO = 2;
140
- /**
141
- * info 级别
142
- */
143
- /**
144
- * warn 级别
145
- */
146
- export const WARN = 3;
147
- /**
148
- * error 级别
149
- */
150
- export const ERROR = 4;
151
- /**
152
- * 关闭所有日志
153
- */
154
- export const CLOSE = 5;
155
- /**
156
- * fatal 级别
157
- * @internal
158
- */
159
- export const FATAL = 6;
160
- /**
161
- * 设置日志输出级别
162
- *
163
- * @param level 日志输出级别
164
- */
165
- export function setLevel(level: number): void;
166
- /**
167
- * 打印 debug 日志
168
- *
169
- * @param msg 日志内容
170
- */
171
- export function debug(msg: string, tag?: string, userId?: UserId, args?: any[]): void;
172
- /**
173
- * 打印 info 日志
174
- *
175
- * @param msg 日志内容
176
- */
177
- export function info(msg: string, tag?: string, userId?: UserId, args?: any[]): void;
178
- /**
179
- * 打印 call 日志
180
- *
181
- * @param msg
182
- * @param args
183
- */
184
- /**
185
- * 打印 warn 日志
186
- *
187
- * @param msg 日志内容
188
- */
189
- export function warn(msg: string, tag?: string, userId?: UserId, args?: any[]): void;
190
- /**
191
- * 打印 error 日志
192
- *
193
- * @param msg 日志内容
194
- */
195
- export function error(msg: string, tag?: string, userId?: UserId, args?: any[]): void;
196
- /**
197
- * 致命错误,中断程序
198
- *
199
- * @param msg 日志内容
200
- */
201
- export function fatal(code: number, name?: string, message?: string): void;
202
- /**
203
- * 打开日志上传
204
- *
205
- */
206
- export function enableUploadLog(): void;
207
- /**
208
- * 关闭日志上传
209
- *
210
- */
211
- export function disableUploadLog(): void;
212
- export const LogMap: {
213
- 1: typeof debug;
214
- 2: typeof info;
215
- 3: typeof warn;
216
- 4: typeof error;
217
- };
218
- }
219
- declare module ClientEvents {
220
- /**
221
- * 远端流添加事件,当远端用户发布流后会收到该通知
222
- * ```javascript
223
- * client.on('stream-added', event => {
224
- * const remoteStream = event.stream;
225
- * });
226
- * ```
227
- */
228
- export const STREAM_ADDED = "stream-added";
229
- /**
230
- * 远端流移除事件,当远端用户取消发布流后会收到该通知。
231
- * ```javascript
232
- * client.on('stream-removed', event => {
233
- * const remoteStream = event.stream;
234
- * });
235
- * ```
236
- */
237
- export const STREAM_REMOVED = "stream-removed";
238
- /**
239
- * 远端流更新事件,当远端用户添加、移除或更换音视频轨道后会收到该通知
240
- * ```javascript
241
- * client.on('stream-updated', event => {
242
- * const remoteStream = event.stream;
243
- * });
244
- * ```
245
- */
246
- export const STREAM_UPDATED = "stream-updated";
247
- /**
248
- * 本地流推流成功事件,调用 publish() 成功后会触发该事件
249
- * ```javascript
250
- * client.on('stream-published', event => {
251
- * const localStream = event.stream;
252
- * });
253
- * ```
254
- */
255
- export const STREAM_PUBLISHED = "stream-published";
256
- /**
257
- * 远端流订阅成功事件,调用 subscribe() 成功后会触发该事件
258
- * ```javascript
259
- * client.on('stream-subscribed', event => {
260
- * const remoteStream = event.stream;
261
- * });
262
- * ```
263
- */
264
- export const STREAM_SUBSCRIBED = "stream-subscribed";
265
- /**
266
- * 远端用户禁用视频通知
267
- * ```javascript
268
- * client.on('mute-video', event => {
269
- * const stream = event.stream;
270
- * });
271
- * ```
272
- */
273
- export const MUTE_VIDEO = "mute-video";
274
- /**
275
- * 远端用户取消禁用视频通知
276
- * ```javascript
277
- * client.on('unmute-video', event => {
278
- * const stream = event.stream;
279
- * });
280
- * ```
281
- */
282
- export const UNMUTE_VIDEO = "unmute-video";
283
- /**
284
- * 远端用户禁用音频通知
285
- * ```javascript
286
- * client.on('mute-audio', event => {
287
- * const stream = event.stream;
288
- * });
289
- * ```
290
- */
291
- export const MUTE_AUDIO = "mute-audio";
292
- /**
293
- * 远端用户取消禁用音频通知
294
- * ```javascript
295
- * client.on('mute-audio', event => {
296
- * const stream = event.stream;
297
- * });
298
- * ```
299
- */
300
- export const UNMUTE_AUDIO = "unmute-audio";
301
- /**
302
- * 客户端错误事件,当出现不可恢复错误后 Client 会通过该事件上报
303
- * ```javascript
304
- * client.on('error', error => {
305
- * console.error('client error observed: ' + error);
306
- * const errorCode = error.getCode();
307
- * // 当出现客户端错误后,请调用 client.leave() 退房并尝试通过 client.join() 重新进房恢复通话。
308
- * });
309
- * ```
310
- */
311
- export const ERROR = "error";
312
- /**
313
- * 用户进入房间通知
314
- * ```javascript
315
- * client.on('peer-joined', event => {
316
- * const userId = event.userId;
317
- * });
318
- * ```
319
- */
320
- export const PEER_JOINED = "peer-joined";
321
- /**
322
- * 用户退出房间通知
323
- * ```javascript
324
- * client.on('peer-leaved', event => {
325
- * const userId = event.userId;
326
- * });
327
- * ```
328
- */
329
- export const PEER_LEAVED = "peer-leaved";
330
- /**
331
- * client 被踢出房间通知,其他端以相同的 user_id 进入了房间
332
- * ```javascript
333
- * client.on('client-banned', () => {
334
- * console.log('你已被踢出!');
335
- * });
336
- * ```
337
- */
338
- export const CLIENT_BANNED = "client-banned";
339
- /**
340
- * 用户被踢出房间通知,被管理员踢出
341
- * ```javascript
342
- * client.on('user-kicked', () => {
343
- * console.log('你已被踢出!');
344
- * });
345
- * ```
346
- */
347
- export const USER_KICKED = "user-kicked";
348
- /**
349
- * token 即将过期
350
- * ```javascript
351
- * client.on('token-will-expire', () => {
352
- * console.log('你的 token 即将过期,请更新 token');
353
- * });
354
- * ```
355
- */
356
- export const TOKEN_WILL_EXPIRE = "token-will-expire";
357
- /**
358
- * token 过期
359
- * ```javascript
360
- * client.on('token-expire', () => {
361
- * console.log('你的 token 已经过期,已自动退出房间');
362
- * });
363
- * ```
364
- */
365
- export const TOKEN_EXPIRE = "token-expire";
366
- /**
367
- * 房间关闭
368
- * ```javascript
369
- * client.on('room-closed', () => {
370
- * console.log('房间已关闭,已自动退出');
371
- * });
372
- * ```
373
- */
374
- export const ROOM_CLOSED = "room-closed";
375
- /**
376
- * 房间自动同步完成
377
- * ```javascript
378
- * client.on('sync-room-completed', () => {
379
- * console.log('房间自动同步完成');
380
- * });
381
- * ```
382
- */
383
- export const SYNC_ROOM_COMPLETED = "sync-room-completed";
384
- }
385
- declare module StreamEvents {
386
- /**
387
- * videoTrack end 事件
388
- * ```javascript
389
- * stream.on('video-track-ended', () => {
390
- * console.log(`stream ${stream.getUserId()} video-track-ended`);
391
- * });
392
- * ```
393
- */
394
- export const VIDEO_TRACK_ENDED = "video-track-ended";
395
- /**
396
- * audioTrack end 事件
397
- * ```javascript
398
- * stream.on('audio-track-ended', () => {
399
- * console.log(`stream ${stream.getUserId()} audio-track-ended`);
400
- * });
401
- * ```
402
- */
403
- export const AUDIO_TRACK_ENDED = "audio-track-ended";
404
- /**
405
- * videoTrack mute 事件
406
- * ```javascript
407
- * stream.on('video-track-mute', () => {
408
- * console.log(`stream ${stream.getUserId()} video-track-mute`);
409
- * });
410
- * ```
411
- */
412
- export const VIDEO_TRACK_MUTE = "video-track-mute";
413
- /**
414
- * audioTrack mute 事件
415
- * ```javascript
416
- * stream.on('audio-track-mute', () => {
417
- * console.log(`stream ${stream.getUserId()} audio-track-mute`);
418
- * });
419
- * ```
420
- */
421
- export const AUDIO_TRACK_MUTE = "audio-track-mute";
422
- /**
423
- * videoTrack unmute 事件
424
- * ```javascript
425
- * stream.on('video-track-unmute', () => {
426
- * console.log(`stream ${stream.getUserId()} video-track-unmute`);
427
- * });
428
- * ```
429
- */
430
- export const VIDEO_TRACK_UNMUTE = "video-track-unmute";
431
- /**
432
- * audioTrack unmute 事件
433
- * ```javascript
434
- * stream.on('audio-track-unmute', () => {
435
- * console.log(`stream ${stream.getUserId()} audio-track-unmute`);
436
- * });
437
- * ```
438
- */
439
- export const AUDIO_TRACK_UNMUTE = "audio-track-unmute";
440
- /**
441
- * audioTrack unmute 事件
442
- * ```javascript
443
- * stream.on('audio-track-unmute', () => {
444
- * console.log(`stream ${stream.getUserId()} audio-track-unmute`);
445
- * });
446
- * ```
447
- */
448
- /**
449
- * track update 事件
450
- * ```javascript
451
- * stream.on('track-update', (event, data: {type: 'audio' | 'video', track: MediaStreamTrack}) => {
452
- * console.log(`stream ${stream.getUserId()} track-update`);
453
- * });
454
- * ```
455
- */
456
- export const TRACK_UPDATE = "track-update";
457
- /**
458
- * Audio/Video Player 状态变化事件 App 可根据状态变化来更新 UI,比如,通过监听 video player 状态变化来关闭或打开遮板
459
- * ```javascript
460
- * stream.on('player-state-changed', (event) => {
461
- * console.log(`${event.type} player is ${event.state} because of ${event.reason}`);
462
- * });
463
- * ```
464
- */
465
- export const PLAYER_STATE_CHANGED = "player-state-changed";
466
- /**
467
- * pc 连接错误,需要重新推拉流
468
- * ```javascript
469
- * stream.on('connect-error', event => {
470
- * console.error('stream pc connect error');
471
- * if (stream.isLocalStream()) {
472
- * client.publish(stream)
473
- * }
474
- * else {
475
- * client.subscribe(stream)
476
- * }
477
- * });
478
- * ```
479
- */
480
- export const CONNECT_ERROR = "connect-error";
481
- /**
482
- * pc 连接成功
483
- * ```javascript
484
- * stream.on('connect-success', event => {
485
- * console.info('stream pc connect success');
486
- * });
487
- * ```
488
- */
489
- export const CONNECT_SUCCESS = "connect-success";
490
- /**
491
- * pc 重连
492
- * ```javascript
493
- * stream.on('connect-reconnecting', event => {
494
- * console.info('stream pc connect reconnecting');
495
- * });
496
- * ```
497
- */
498
- export const CONNECT_RECONNECTING = "connect-reconnecting";
499
- /**
500
- * video 首帧渲染
501
- * ```javascript
502
- * stream.on('player-video-rendered', event => {
503
- * // 移除加载动画
504
- * });
505
- * ```
506
- */
507
- export const PLAYER_VIDEO_RENDERED = "player-video-rendered";
508
- /**
509
- * audio 首帧渲染
510
- * ```javascript
511
- * stream.on('player-audio-rendered', event => {
512
- * // 移除加载动画
513
- * });
514
- * ```
515
- */
516
- export const PLAYER_AUDIO_RENDERED = "player-audio-rendered";
517
- /**
518
- * audio 音量
519
- * ```javascript
520
- * stream.on('audio-level', event => {
521
- * // 移除加载动画
522
- * });
523
- * ```
524
- */
525
- export const AUDIO_LEVEL = "audio-level";
526
- /**
527
- * 流销毁关闭
528
- * ```javascript
529
- * stream.on('close', event => {
530
- * });
531
- * ```
532
- */
533
- export const CLOSE = "close";
534
- }
535
- declare class RTCError extends Error {
536
- /**
537
- * 获取错误码
538
- *
539
- * @returns 错误码
540
- */
541
- getCode(): number;
542
- }
543
111
  /**
544
112
  * 创建本地流配置项
545
113
  */
@@ -746,20 +314,6 @@ declare interface StreamCodecOption {
746
314
  * 设置 h264 profile,默认 42e01f
747
315
  */
748
316
  profile?: string;
749
- }
750
- declare interface SmallStreamCodecOption {
751
- /**
752
- * 视频宽度
753
- */
754
- width?: number;
755
- /**
756
- * 视频高度
757
- */
758
- height?: number;
759
- /**
760
- * 视频码率
761
- */
762
- bitrate?: number;
763
317
  }
764
318
  declare abstract class Stream {
765
319
  /**
@@ -1293,69 +847,6 @@ declare function stream_event_player_state_changed(event: {
1293
847
  * @returns void
1294
848
  */
1295
849
  declare function stream_event_connect_error(): void;
1296
- /**
1297
- * client join 参数配置
1298
- */
1299
- declare interface JoinConfig {
1300
- role?: Role;
1301
- }
1302
- /**
1303
- * 创建 Client 参数
1304
- */
1305
- declare interface ClientOptions {
1306
- /**
1307
- * 用户 appId
1308
- */
1309
- appId: string;
1310
- /**
1311
- * 视频编码类型,默认 h264,目前只支持 h264
1312
- */
1313
- codec?: Codec;
1314
- /**
1315
- * 音频编码类型,默认 opus,目前只支持 opus
1316
- */
1317
- audioCodec?: AudioCodec;
1318
- /**
1319
- * 直播模式,默认 rtc 模式,目前只支持 rtc 模式
1320
- */
1321
- mode?: Mode;
1322
- /**
1323
- * 数据上报自定义字段
1324
- * 长度小于 64 个字符,超过的会被截断
1325
- */
1326
- comments?: string;
1327
- /**
1328
- * 用户角色,默认 anchor(主播)
1329
- */
1330
- role?: Role;
1331
- /**
1332
- * 仅推流
1333
- */
1334
- publishOnly?: boolean;
1335
- /**
1336
- * 是否使用 string 作为 userId 类型
1337
- * - 默认 false userId 为 int32 类型
1338
- */
1339
- useStringUserId?: boolean;
1340
- /**
1341
- * 音量获取间隔,默认 1000,最大 10000
1342
- * 若需要更小间隔则设置此属性值
1343
- */
1344
- audioLevelInterval?: number;
1345
- /**
1346
- * 房间类型
1347
- * - 默认正常房间,正常房间有进房人数限制,进房退房会广播给其他人
1348
- * - 设置 'big' 不限制进房人数,但不推流的 user 将不广播进房通知
1349
- */
1350
- roomType?: RoomType;
1351
- /**
1352
- * 大房间广播模式,大房间下生效
1353
- * - true 不广播
1354
- * - false 广播(默认)
1355
- */
1356
- silence?: boolean;
1357
- enableSEI?: boolean;
1358
- }
1359
850
  /**
1360
851
  * 订阅流参数
1361
852
  */
@@ -1377,447 +868,6 @@ declare interface SubscribeOptions {
1377
868
 
1378
869
  audioEnable?: boolean
1379
870
  }
1380
- /**
1381
- * Client 对象
1382
- */
1383
- declare class Client {
1384
- /**
1385
- * 创建 Client 对象
1386
- *
1387
- * @param options 配置项
1388
- *
1389
- * @returns Client 实例
1390
- */
1391
- constructor(options: ClientOptions);
1392
- /**
1393
- * 加入一个音视频通话房间
1394
- *
1395
- * - 进房代表开始一个音视频通话会话,这时候 SDK 会监听远端用户进房退房情况,若有远端用户进房并且发布流,本地会收到 'stream-added' 事件。
1396
- * - 进房后用户可以通过 publish() 发布本地流,本地流发布成功后远端用户就会收到相应 'stream-added' 事件通知从而完成一个双向的音视频通话连接。
1397
- *
1398
- * @param roomId 房间 id
1399
- * @param userId 用户 id
1400
- * @param sig 动态口令
1401
- *
1402
- * @returns any
1403
- */
1404
- join(roomId: string, userId: UserId, sig: string, joinConfig?: JoinConfig): Promise<any>;
1405
- /**
1406
- * 退出当前音视频通话房间,结束一次音视频通话会话。
1407
- *
1408
- * - 退房前请确保已经通过 unpublish() 取消发布本地流,若未取消发布本地流,SDK 内部会自动取消发布本地流。 同时,退房会关闭所有远端流。
1409
- *
1410
- * @param type 离开原因,不传表示主动离开
1411
- *
1412
- * @returns any
1413
- */
1414
- leave(type?: string): Promise<any>;
1415
- /**
1416
- * 发布本地音视频流。
1417
- *
1418
- * - 该方法需要在 join() 进房后调用,一次音视频会话中只能发布一个本地流。若想发布另外一个本地流,可先通过 unpublish() 取消发布当前本地流后再发布新的本地流。
1419
- * - 在发布本地流后,可通过 removeTrack()、addTrack()、 replaceTrack() 来更新本地流中的某个音频或视频流。
1420
- * - 发布本地流后远端会收到 ‘stream-added’ 事件通知。
1421
- *
1422
- * @param stream 创建的本地流对象
1423
- *
1424
- * @returns any
1425
- */
1426
- publish(stream: LocalStream): Promise<any>;
1427
- /**
1428
- * 取消发布本地流。
1429
- *
1430
- * - 取消发布本地流后远端会收到 'stream-removed' 事件通知。
1431
- * - 请在 leave() 退房前取消已经发布的本地流。
1432
- *
1433
- * @param stream 取消发布的本地流对象
1434
- *
1435
- * @returns any
1436
- */
1437
- unpublish(stream: LocalStream): Promise<any>;
1438
- /**
1439
- * 订阅远端流
1440
- *
1441
- * - 可通过该订阅接口指明需要订阅音频、视频或者音视频流。
1442
- *
1443
- * @param stream 需要订阅的远端流对象,由 ‘stream-added’ 事件获得
1444
- * @param options 订阅选项,默认音视频都订阅
1445
- *
1446
- * @returns any
1447
- */
1448
- subscribe(stream: RemoteStream, options?: SubscribeOptions): Promise<any>;
1449
- /**
1450
- * 取消订阅远端流
1451
- *
1452
- * @param stream 需要取消订阅的远端流对象,由 ‘stream-added’ 事件获得
1453
- *
1454
- * @returns any
1455
- */
1456
- unsubscribe(stream: RemoteStream): Promise<any>;
1457
- /**
1458
- * - 开启大小流
1459
- * - 在发送视频端开启大小流传输模式。双流为视频大流和视频小流,其中视频大流指高分辨率、高码率的视频流,视频小流指低分辨率、低码率的视频流
1460
- * - 必须在发布之前进行设置,原因是为了避免在发布后进行设置导致大小流表现不一致
1461
- * - 开启大小流传输模式后建议不要对双流进行 track 操作(包括 addTrack / removeTrack / replaceTrack),否则会导致大流和小流的表现不一致
1462
- */
1463
- enableSmallStream(): Promise<any>;
1464
- /**
1465
- * - 关闭大小流
1466
- * - 必须在发布前或者结束发布之后进行操作,原因是为了避免在发布后进行设置导致大小流表现不一致
1467
- */
1468
- disableSmallStream(): Promise<any>;
1469
- /**
1470
- * - 接收端选择订阅大流还是小流
1471
- * - 只能在订阅之后设置
1472
- *
1473
- * @param stream 远端流
1474
- *
1475
- * @param streamType
1476
- * -
1477
- * - big 大流(默认)
1478
- * - small 小流
1479
- */
1480
- setRemoteVideoStreamType(stream: RemoteStream, streamType: StreamSimulcastType): Promise<any>;
1481
- /**
1482
- * 设置小流推流参数
1483
- *
1484
- * @param profile
1485
- */
1486
- setSmallStreamProfile(profile: SmallStreamCodecOption): void;
1487
- /**
1488
- * 拉取 users
1489
- *
1490
- * hasMoreUser 是否还有更多 user 没有拉取到本地
1491
- *
1492
- * 新拉取的 user 会触发 stream-added 和 peer-joined 事件
1493
- *
1494
- * @param count
1495
- */
1496
- pullUsers(count: number): Promise<{
1497
- hasMoreUser: boolean;
1498
- }>;
1499
- /**
1500
- * 查找指定 users 的流
1501
- *
1502
- * 返回 RemoteStream 数组,如果查询的 user 没有推流则不会出现在数组中
1503
- *
1504
- * @param userIds
1505
- */
1506
- queryUsers(userIds: UserId[]): Promise<RemoteStream[]>;
1507
- /**
1508
- * 提交事件
1509
- *
1510
- * @param type 事件类型
1511
- * @param data 事件数据
1512
- *
1513
- * @returns void
1514
- */
1515
- fire(type: string, data?: any): void;
1516
- /**
1517
- * 设置一次事件监听
1518
- * 支持链式调用
1519
- * 支持命名空间 `type.namespace`,使用 `.` 来分隔 `type` 和 `namespace`
1520
- *
1521
- * @param type 事件类型
1522
- * @param listener 监听函数
1523
- *
1524
- * @returns Client
1525
- */
1526
- on(type: 'stream-added', listener: typeof client_event_stream_added): this;
1527
- on(type: 'stream-removed', listener: typeof client_event_stream_removed): this;
1528
- on(type: 'stream-updated', listener: typeof client_event_stream_updated): this;
1529
- on(type: 'stream-published', listener: typeof client_event_stream_published): this;
1530
- on(type: 'stream-subscribed', listener: typeof client_event_stream_subscribed): this;
1531
- on(type: 'mute-video', listener: typeof client_event_mute_video): this;
1532
- on(type: 'unmute-video', listener: typeof client_event_unmute_video): this;
1533
- on(type: 'mute-audio', listener: typeof client_event_mute_audio): this;
1534
- on(type: 'unmute-audio', listener: typeof client_event_unmute_audio): this;
1535
- on(type: 'error', listener: typeof client_event_error): this;
1536
- on(type: 'peer-joined', listener: typeof client_event_peer_joined): this;
1537
- on(type: 'peer-leaved', listener: typeof client_event_peer_leaved): this;
1538
- on(type: 'client-banned', listener: typeof client_event_client_banned): this;
1539
- on(type: 'user-kicked', listener: typeof client_event_user_kicked): this;
1540
- on(type: 'room-closed', listener: typeof client_event_room_closed): this;
1541
- on(type: string, listener: Function): this;
1542
- /**
1543
- * 设置一次事件监听
1544
- * 支持链式调用
1545
- * 支持命名空间 `type.namespace`,使用 `.` 来分隔 `type` 和 `namespace`
1546
- *
1547
- * @param type 事件类型
1548
- * @param listener 监听函数
1549
- *
1550
- * @returns Client
1551
- */
1552
- one(type: 'stream-added', listener: typeof client_event_stream_added): this;
1553
- one(type: 'stream-removed', listener: typeof client_event_stream_removed): this;
1554
- one(type: 'stream-updated', listener: typeof client_event_stream_updated): this;
1555
- one(type: 'stream-published', listener: typeof client_event_stream_published): this;
1556
- one(type: 'stream-subscribed', listener: typeof client_event_stream_subscribed): this;
1557
- one(type: 'mute-video', listener: typeof client_event_mute_video): this;
1558
- one(type: 'unmute-video', listener: typeof client_event_unmute_video): this;
1559
- one(type: 'mute-audio', listener: typeof client_event_mute_audio): this;
1560
- one(type: 'unmute-audio', listener: typeof client_event_unmute_audio): this;
1561
- one(type: 'error', listener: typeof client_event_error): this;
1562
- one(type: 'peer-joined', listener: typeof client_event_peer_joined): this;
1563
- one(type: 'peer-leaved', listener: typeof client_event_peer_leaved): this;
1564
- one(type: 'client-banned', listener: typeof client_event_client_banned): this;
1565
- one(type: 'user-kicked', listener: typeof client_event_user_kicked): this;
1566
- one(type: 'room-closed', listener: typeof client_event_room_closed): this;
1567
- one(type: string, listener: Function): this;
1568
- /**
1569
- * 取消事件监听
1570
- * 支持链式调用
1571
- *
1572
- * @param type 事件类型或者命名空间
1573
- * - 如果传入命名空间则解绑此命名空间的所有回调
1574
- * - 如果不传则解绑所有设置过的回调
1575
- * @param listener 绑定函数
1576
- * - 如果不传则解绑指定 `type` 的所有回调,否则只解绑指定 `type` 和 `listener` 的回调
1577
- *
1578
- * @returns Client
1579
- */
1580
- off(type?: string, listener?: Function): this;
1581
- /**
1582
- * 设置 client 只用于推流,一般用于推多路流的时候
1583
- * 设置主 client 为 false,辅 client 为 true
1584
- * 这样辅 client 只用于推流,只会触发 ’stream-published‘ 事件,所有的流由主 client 来订阅
1585
- *
1586
- * @param value 是否只推流
1587
- *
1588
- * @returns void
1589
- */
1590
- setPublishOnly(value: boolean): void;
1591
- /**
1592
- * 销毁 client 实例
1593
- *
1594
- * @param force 同步销毁,不等待异步返回
1595
- *
1596
- * @returns any
1597
- */
1598
- destroy(force: boolean): Promise<any>;
1599
- }
1600
- /**
1601
- * @param event Object
1602
- * - stream 远端流实例
1603
- *
1604
- * @returns
1605
- * 返回 false 会停止触发后面监听的事件
1606
- */
1607
- declare function client_event_stream_added(event: {
1608
- stream: RemoteStream;
1609
- }): void | false;
1610
- /**
1611
- * @param event Object
1612
- * - stream 远端流实例
1613
- *
1614
- * @returns
1615
- * 返回 false 会停止触发后面监听的事件
1616
- */
1617
- declare function client_event_stream_removed(event: {
1618
- stream: RemoteStream;
1619
- }): void | false;
1620
- /**
1621
- * @param event Object
1622
- * - stream 远端流实例
1623
- *
1624
- * @returns
1625
- * 返回 false 会停止触发后面监听的事件
1626
- */
1627
- declare function client_event_stream_updated(event: {
1628
- stream: RemoteStream;
1629
- }): void | false;
1630
- /**
1631
- * @param event Object
1632
- * - stream 本地流实例
1633
- *
1634
- * @returns
1635
- * 返回 false 会停止触发后面监听的事件
1636
- */
1637
- declare function client_event_stream_published(event: {
1638
- stream: LocalStream;
1639
- }): void | false;
1640
- /**
1641
- * @param event Object
1642
- * - stream 远端流实例
1643
- *
1644
- * @returns
1645
- * 返回 false 会停止触发后面监听的事件
1646
- */
1647
- declare function client_event_stream_subscribed(event: {
1648
- stream: RemoteStream;
1649
- }): void | false;
1650
- /**
1651
- * @param event Object
1652
- * - stream 远端流实例
1653
- *
1654
- * @returns
1655
- * 返回 false 会停止触发后面监听的事件
1656
- */
1657
- declare function client_event_mute_video(event: {
1658
- stream: RemoteStream;
1659
- }): void | false;
1660
- /**
1661
- * @param event Object
1662
- * - stream 远端流实例
1663
- *
1664
- * @returns
1665
- * 返回 false 会停止触发后面监听的事件
1666
- */
1667
- declare function client_event_unmute_video(event: {
1668
- stream: RemoteStream;
1669
- }): void | false;
1670
- /**
1671
- * @param event Object
1672
- * - stream 远端流实例
1673
- *
1674
- * @returns
1675
- * 返回 false 会停止触发后面监听的事件
1676
- */
1677
- declare function client_event_mute_audio(event: {
1678
- stream: RemoteStream;
1679
- }): void | false;
1680
- /**
1681
- * @param event Object
1682
- * - stream 远端流实例
1683
- *
1684
- * @returns
1685
- * 返回 false 会停止触发后面监听的事件
1686
- */
1687
- declare function client_event_unmute_audio(event: {
1688
- stream: RemoteStream;
1689
- }): void | false;
1690
- /**
1691
- * @param event Object
1692
- * - stream 远端流实例
1693
- *
1694
- * @returns
1695
- * 返回 false 会停止触发后面监听的事件
1696
- */
1697
- declare function client_event_error(error: RTCError): void | false;
1698
- /**
1699
- * @param event Object
1700
- * - userId 用户 id
1701
- *
1702
- * @returns
1703
- * 返回 false 会停止触发后面监听的事件
1704
- */
1705
- declare function client_event_peer_joined(event: {
1706
- userId: UserId;
1707
- }): void | false;
1708
- /**
1709
- * @param event Object
1710
- * - userId 用户 id
1711
- *
1712
- * @returns
1713
- * 返回 false 会停止触发后面监听的事件
1714
- */
1715
- declare function client_event_peer_leaved(event: {
1716
- userId: UserId;
1717
- }): void | false;
1718
- /**
1719
- * @param event Object
1720
- * - userId 用户 id
1721
- *
1722
- * @returns
1723
- * 返回 false 会停止触发后面监听的事件
1724
- */
1725
- declare function client_event_client_banned(error: RTCError): void | false;
1726
- /**
1727
- * @param event Object
1728
- * - userId 用户 id
1729
- *
1730
- * @returns
1731
- * 返回 false 会停止触发后面监听的事件
1732
- */
1733
- declare function client_event_user_kicked(error: RTCError): void | false;
1734
- /**
1735
- * @param event Object
1736
- * - userId 用户 id
1737
- *
1738
- * @returns
1739
- * 返回 false 会停止触发后面监听的事件
1740
- */
1741
- declare function client_event_room_closed(error: RTCError): void | false;
1742
- declare type _Client = Client;
1743
- declare type _LocalStream = LocalStream;
1744
- declare type _RemoteStream = RemoteStream;
1745
- declare type _Device = Device;
1746
- declare type _ClientOptions = ClientOptions;
1747
-
1748
- declare namespace BRTC {
1749
- type Client = _Client;
1750
- type LocalStream = _LocalStream;
1751
- type RemoteStream = _RemoteStream;
1752
- type Device = _Device;
1753
- type ClientOptions = _ClientOptions;
1754
-
1755
- const Logger: typeof logger;
1756
- const Events: {
1757
- Client: typeof ClientEvents;
1758
- Stream: typeof StreamEvents;
1759
- };
1760
- /**
1761
- * 创建本地流实例
1762
- *
1763
- * @param options 配置项
1764
- */
1765
- function createStream(options: StreamDeviceOption): LocalStream;
1766
- /**
1767
- * 创建 Client 实例
1768
- *
1769
- * @param options 配置项
1770
- */
1771
- function createClient(options: ClientOptions): Client;
1772
- /**
1773
- * 判断是否支持 BRTC
1774
- *
1775
- * @returns
1776
- */
1777
- function checkSystemSupport(): Promise<boolean>;
1778
- /**
1779
- * 设置环境
1780
- */
1781
- function setEnv(env: string): void;
1782
- /**
1783
- * 判断是否支持屏幕分享
1784
- *
1785
- * @returns
1786
- */
1787
- function supportScreenSharing(): boolean;
1788
- /**
1789
- * 判断是否支持大小流
1790
- *
1791
- * @returns
1792
- */
1793
- function isSmallStreamSupported(): boolean;
1794
- /**
1795
- * 获取设备权限
1796
- */
1797
- function getPermissions(): Promise<any>;
1798
- /**
1799
- * 枚举音频输入设备
1800
- *
1801
- * @returns 设备列表
1802
- */
1803
- function enumAudioInputDevices(): Promise<Device[]>;
1804
- /**
1805
- * 枚举音频输出设备
1806
- *
1807
- * @returns 设备列表
1808
- */
1809
- function enumAudioOutputDevices(): Promise<Device[]>;
1810
- /**
1811
- * 枚举视频输入设备
1812
- *
1813
- * @returns 设备列表
1814
- */
1815
- function enumVideoDevices(): Promise<Device[]>;
1816
- /**
1817
- * BRTC 版本号
1818
- */
1819
- const version: string;
1820
- }
1821
871
 
1822
872
  /**
1823
873
  * @name: stream
@@ -3717,25 +2767,25 @@ declare class BMRoom {
3717
2767
  *
3718
2768
  * @returns 设备列表
3719
2769
  */
3720
- enumVideoDevices: typeof BRTC.enumVideoDevices;
2770
+ enumVideoDevices: typeof undefined;
3721
2771
  /**
3722
2772
  * 枚举音频输入设备
3723
2773
  *
3724
2774
  * @returns 设备列表
3725
2775
  */
3726
- enumAudioInputDevices: typeof BRTC.enumAudioInputDevices;
2776
+ enumAudioInputDevices: typeof undefined;
3727
2777
  /**
3728
2778
  * 枚举音频输出设备
3729
2779
  *
3730
2780
  * @returns 设备列表
3731
2781
  */
3732
- enumAudioOutputDevices: typeof BRTC.enumAudioOutputDevices;
2782
+ enumAudioOutputDevices: typeof undefined;
3733
2783
  /**
3734
2784
  * 检查音视频权限
3735
2785
  */
3736
- getPermissions: typeof BRTC.getPermissions;
3737
- checkSystemSupport: typeof BRTC.checkSystemSupport;
3738
- createStream: typeof BRTC.createStream;
2786
+ getPermissions: typeof undefined;
2787
+ checkSystemSupport: typeof undefined;
2788
+ createStream: typeof undefined;
3739
2789
  participantNotice: boolean;
3740
2790
  /**
3741
2791
  * 订阅远端流