trtc-electron-sdk 9.8.8-beta.4 → 9.8.8-beta.7

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 (2) hide show
  1. package/liteav/trtc.js +21 -11
  2. package/package.json +1 -1
package/liteav/trtc.js CHANGED
@@ -31,6 +31,8 @@ __exportStar(require("./trtc_define"), exports);
31
31
  __exportStar(require("./trtc_code"), exports);
32
32
  // 监听该事件,返回自定义视频渲染数据 ( bgra 格式)
33
33
  const CUSTOM_VIDEO_DATA = 'onVideoData';
34
+ const CAMERA_DEVICE_TEST_VIEW = 'camera_device_test_view';
35
+ const CAMERA_DEVICE_TEST_ID = 'camera_device_test';
34
36
  const SDK_LOG_LEVEL = 2;
35
37
  let genSecFunc = function (instance, key) {
36
38
  return function () {
@@ -3024,13 +3026,16 @@ class TRTCCloud extends events_1.EventEmitter {
3024
3026
  startCameraDeviceTest(view) {
3025
3027
  if (view !== undefined) {
3026
3028
  if (view !== null) {
3027
- let key = this.getKey('camera_device_test_view', trtc_define_1.TRTCVideoStreamType.TRTCVideoStreamTypeBig);
3029
+ let key = this.getKey(CAMERA_DEVICE_TEST_VIEW, trtc_define_1.TRTCVideoStreamType.TRTCVideoStreamTypeBig);
3028
3030
  this._initRender(key, view);
3029
3031
  const renderer = this.streams.get(key);
3030
3032
  renderer.setContentMode(trtc_define_1.TRTCVideoFillMode.TRTCVideoFillMode_Fill);
3031
3033
  }
3032
- this.addLocalVideoRenderCallback();
3033
- this.rtcCloud.startCameraDeviceTest();
3034
+ this.rtcCloud.startCameraDeviceTest((id, type, width, height, timestamp, rotation, data) => {
3035
+ if (this.enableRenderFrame) {
3036
+ this._onRenderFrame(id, type, width, height, timestamp, rotation, data);
3037
+ }
3038
+ });
3034
3039
  }
3035
3040
  else {
3036
3041
  console.error('startCameraDeviceTest, view is undefined!');
@@ -3040,7 +3045,7 @@ class TRTCCloud extends events_1.EventEmitter {
3040
3045
  * 13.4 停止摄像头测试
3041
3046
  */
3042
3047
  stopCameraDeviceTest() {
3043
- let key = this.getKey('camera_device_test_view', trtc_define_1.TRTCVideoStreamType.TRTCVideoStreamTypeBig);
3048
+ let key = this.getKey(CAMERA_DEVICE_TEST_VIEW, trtc_define_1.TRTCVideoStreamType.TRTCVideoStreamTypeBig);
3044
3049
  this._destroyRender(key, null);
3045
3050
  this.rtcCloud.stopCameraDeviceTest();
3046
3051
  this.firstVideoFrameList = this.firstVideoFrameList.filter(function (item) {
@@ -3323,7 +3328,8 @@ class TRTCCloud extends events_1.EventEmitter {
3323
3328
  }
3324
3329
  });
3325
3330
  }
3326
- if (uid.length == 0) {
3331
+ if (uid.length == 0 || uid === CAMERA_DEVICE_TEST_ID) {
3332
+ // 本地预览或者摄像头测试
3327
3333
  if (this.isExternalRenderEnabled) {
3328
3334
  this.fire(CUSTOM_VIDEO_DATA, {
3329
3335
  uid: '', type, rotation, timestamp,
@@ -3337,15 +3343,19 @@ class TRTCCloud extends events_1.EventEmitter {
3337
3343
  pixelformate: this.pixelformate,
3338
3344
  data: {}
3339
3345
  });
3340
- this._onRealRender('local_video', type, width, height, timestamp, rotation, data); //本地社视频返回的是空
3341
- this._onRealRender('camera_device_test_view', type, width, height, timestamp, rotation, data); //摄像头测试
3342
3346
  }
3343
- //回调local view 给用户数据,本地数据
3344
- if (type == trtc_define_1.TRTCVideoStreamType.TRTCVideoStreamTypeBig) {
3345
- if (this.localVideoCallback !== null && this.localVideoCallback.callback !== null) {
3346
- this._onUserRenderCallback(this.localVideoCallback.callback, this.localVideoCallback.pixelFormat, uid, type, width, height, timestamp, rotation, data);
3347
+ if (uid.length == 0) {
3348
+ this._onRealRender('local_video', type, width, height, timestamp, rotation, data); //本地社视频返回的是空
3349
+ //回调local view 给用户数据,本地数据
3350
+ if (type == trtc_define_1.TRTCVideoStreamType.TRTCVideoStreamTypeBig) {
3351
+ if (this.localVideoCallback !== null && this.localVideoCallback.callback !== null) {
3352
+ this._onUserRenderCallback(this.localVideoCallback.callback, this.localVideoCallback.pixelFormat, uid, type, width, height, timestamp, rotation, data);
3353
+ }
3347
3354
  }
3348
3355
  }
3356
+ if (uid === CAMERA_DEVICE_TEST_ID) {
3357
+ this._onRealRender(CAMERA_DEVICE_TEST_VIEW, type, width, height, timestamp, rotation, data); //摄像头测试
3358
+ }
3349
3359
  }
3350
3360
  else {
3351
3361
  if (this.isExternalRenderEnabled) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "trtc-electron-sdk",
3
- "version": "9.8.8-beta.4",
3
+ "version": "9.8.8-beta.7",
4
4
  "description": "trtc electron sdk",
5
5
  "main": "./liteav/trtc.js",
6
6
  "types": "./liteav/trtc.d.ts",