larksr_websdk 3.2.332 → 3.2.334

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.
@@ -213,5 +213,10 @@ interface ILarkSRConfig {
213
213
  * 默认 20S
214
214
  */
215
215
  playTimeout?: number;
216
+ /**
217
+ * 是否使用新版摄像头/麦克风协议
218
+ * 单独上传流程要求渲染服务器版本大于3290)
219
+ */
220
+ useSeparateMediaSharePeer?: boolean;
216
221
  }
217
222
  ```
@@ -358,6 +358,16 @@ openAudio(deviceId?: string);
358
358
  * @returns
359
359
  */
360
360
  closeAudio(): boolean | undefined;
361
+ /**
362
+ * 暂停发送音频
363
+ * @returns
364
+ */
365
+ pauseAudioSending(): any;
366
+ /**
367
+ * 恢复发送音频
368
+ * @returns
369
+ */
370
+ resumeAudioSending(): any;
361
371
  /**
362
372
  * 返回已连接的音频设备列表,设备列表中的设备的 deviceId 可用来打开某个音频设备
363
373
  * @returns
@@ -369,6 +379,15 @@ getConnectedAudioinputDevices(): Promise<MediaDeviceInfo[] | undefined>;
369
379
  * @returns
370
380
  */
371
381
  setAudioEnable(enable: boolean): void | undefined;
382
+
383
+ /**
384
+ * 请求浏览器打开媒体并且打开上传到服务器通道。
385
+ * 要注意的是在服务器连接成功之后请求打开
386
+ * @param constraints 参考 navigator.mediaDevices.getUserMedia(constraints)
387
+ * @param reset 是否重制媒体通道。true 的情况下重制整个 peerconnection
388
+ * @returns 打开的通道的绑定信息。管理媒体通道如关闭暂停或恢复使用。
389
+ */
390
+ openUserMedia(constraints?: MediaStreamConstraints, reset?: boolean): Promise<any>;
372
391
  ```
373
392
 
374
393
  larksr 配置项自动打开麦克风配置,在`new LarkSR({ ... 此处省略其他配置 ... audioInputAutoStart: true})` 时传入,
@@ -397,9 +416,19 @@ audioInputAutoStart?: boolean;
397
416
  * 打开一个视频设备,要注意浏览器限制在 https 或者 localhost 下才能打开视频
398
417
  * @param audio boolean 是否同时开启音频
399
418
  * @param cameraId 视频设备id,如果不传将打开默认设备。@see getConnectedVideoinputDevices
419
+ * @param width 限制打开设备的宽
420
+ * @param height 限制打开设备的高
400
421
  * @returns Promise
401
422
  */
402
- openVideo(audio?: boolean, cameraId?: string);
423
+ openVideo(audio?: boolean, cameraId?: string, width?: number, height?: number): Promise<any>;
424
+ /**
425
+ * 打开摄像头设备
426
+ * @param cameraId 摄像头设备ID,@see getConnectedVideoinputDevices
427
+ * @param minWidth 限制打开设备的宽
428
+ * @param minHeight 限制打开设备的高
429
+ * @returns @see openUserMedia
430
+ */
431
+ openCamera(cameraId: string, minWidth?: number, minHeight?: number): Promise<any>;
403
432
  /**
404
433
  * 打开默认媒体设备,要注意浏览器限制在 https 或者 localhost 下
405
434
  * 如果需要指定特殊的媒体设备请单独使用 @see openAudio @see openVideo
@@ -419,6 +448,36 @@ getConnectedVideoinputDevices();
419
448
  * @returns void
420
449
  */
421
450
  setVideoEnable(enable: boolean);
451
+
452
+ /**
453
+ * 暂停发送视频
454
+ * @returns
455
+ */
456
+ pauseVideoSending(): any;
457
+ /**
458
+ * 恢复发送视频
459
+ * @returns
460
+ */
461
+ resumeVideoSending(): any;
462
+
463
+ /**
464
+ * 关闭当前已打开的视频设备
465
+ * @returns
466
+ */
467
+ closeVideo(): any;
468
+ /**
469
+ * 关闭当前已打开的共享设备如共享的标签页等
470
+ * @returns
471
+ */
472
+ closeShare(): any;
473
+ /**
474
+ * 请求浏览器打开媒体并且打开上传到服务器通道。
475
+ * 要注意的是在服务器连接成功之后请求打开
476
+ * @param constraints 参考 navigator.mediaDevices.getUserMedia(constraints)
477
+ * @param reset 是否重制媒体通道。true 的情况下重制整个 peerconnection
478
+ * @returns 打开的通道的绑定信息。管理媒体通道如关闭暂停或恢复使用。
479
+ */
480
+ openUserMedia(constraints?: MediaStreamConstraints, reset?: boolean): Promise<any>;
422
481
  ```
423
482
 
424
483
  larksr 配置项自动打开视频输入配置,在`new LarkSR({ ... 此处省略其他配置 ... videoInputAutoStart: true})` 时传入
@@ -431,3 +431,12 @@ larksr.on('resourcenotenough', function(e) {
431
431
  */
432
432
  ERROR = 'error',
433
433
  ```
434
+
435
+ ## V3.2.334
436
+
437
+ 优化打开媒体通道实现流程,优化重复打开媒体设备或切换媒体设备效果。添加单独媒体上传通道(单独上传流程要求渲染服务器版本大于3290)。
438
+
439
+ 1. 添加配置项, useSeparateMediaSharePeer,配置是否使用单独的媒体上传通道(摄像头麦克风上传)。默认开启,如果需要使用旧版本服务端应关闭该项。 `new LarkSR({ ... 此处省略其他配置 ... useSeparateMediaSharePeer: true })`
440
+ 2. 添加 `pauseVideoSending/resumeVideoSending`,`pauseAudioSending/resumeAudioSending` 暂停和恢复摄像头或者麦克风上传。
441
+ 3. 添加 `closeMediaChannel` 关闭单独的媒体上传通道。仅当 useSeparateMediaSharePeer 为 true 时有效。
442
+ 4. `openVideo` 接口添加 `openVideo(audio?: boolean, cameraId?: string, width?: number, height?: number)` 宽高参数,限定打开摄像头设备的宽高