trtc-electron-sdk 11.2.118-beta.1 → 11.2.118-beta.3

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.
@@ -41,7 +41,9 @@ class Canvas2dRenderer {
41
41
  }
42
42
  }
43
43
  unbind() {
44
- this.viewWrapper && this.viewContainer && this.viewContainer.removeChild(this.viewWrapper);
44
+ if (this.viewWrapper && this.viewContainer && this.viewWrapper.parentElement === this.viewContainer) {
45
+ this.viewContainer.removeChild(this.viewWrapper);
46
+ }
45
47
  this.viewContainer = null;
46
48
  this.yuv = null;
47
49
  }
@@ -128,7 +130,7 @@ class Canvas2dRenderer {
128
130
  const tempCtx = tempCanvas.getContext('2d');
129
131
  if (tempCtx) {
130
132
  tempCtx.putImageData(newImage, 0, 0);
131
- let ctx = this.canvas.getContext("2d");
133
+ const ctx = this.canvas.getContext("2d");
132
134
  if (ctx) {
133
135
  ctx.drawImage(tempCanvas, 0, 0);
134
136
  }
@@ -87,9 +87,13 @@ class Canvas3dRenderer {
87
87
  var _a;
88
88
  (_a = this.canvas3DRenderer) === null || _a === void 0 ? void 0 : _a.destroy();
89
89
  this.canvas3DRenderer = null;
90
- this.canvas && this.viewWrapper && this.viewWrapper.removeChild(this.canvas);
90
+ if (this.canvas && this.viewWrapper && this.canvas.parentElement === this.viewWrapper) {
91
+ this.viewWrapper.removeChild(this.canvas);
92
+ }
91
93
  this.canvas = null;
92
- this.viewWrapper && this.viewContainer && this.viewContainer.removeChild(this.viewWrapper);
94
+ if (this.viewWrapper && this.viewContainer && this.viewWrapper.parentElement === this.viewContainer) {
95
+ this.viewContainer.removeChild(this.viewWrapper);
96
+ }
93
97
  this.viewContainer = null;
94
98
  }
95
99
  drawFrame(frameData) {
@@ -52,7 +52,9 @@ class VideoRenderer {
52
52
  }
53
53
  }
54
54
  unbind() {
55
- this.viewWrapper && this.viewContainer && this.viewContainer.removeChild(this.viewWrapper);
55
+ if (this.viewWrapper && this.viewContainer && this.viewWrapper.parentElement === this.viewContainer) {
56
+ this.viewContainer.removeChild(this.viewWrapper);
57
+ }
56
58
  this.viewContainer = null;
57
59
  }
58
60
  drawFrame(frameData) {
package/liteav/trtc.d.ts CHANGED
@@ -113,7 +113,7 @@ declare class TRTCCloud extends EventEmitter {
113
113
  * @param {Number} warningCode - 警告码
114
114
  * @param {String} warningMsg - 警告信息
115
115
  */
116
- handleOnWarning(warningCode: number, warningMsg: string): void;
116
+ handleOnWarning(warningCode: number, warningMsg: string, extra: number): void;
117
117
  /**
118
118
  * 已加入房间的回调
119
119
  *
@@ -2238,6 +2238,17 @@ declare class TRTCCloud extends EventEmitter {
2238
2238
  * - 2 yuvcanvs
2239
2239
  */
2240
2240
  setRenderMode(mode?: number): void;
2241
+ /**
2242
+ * 插件管理器初始化接口
2243
+ *
2244
+ * 启动美颜插件管理器,并设置视频在美颜处理时的像素格式和数据传递方式。
2245
+ * @param options 视频预处理参数,非必填。
2246
+ * @param {TRTCVideoPixelFormat} options.pixelFormat - 视频像素格式,默认值:`TRTCVideoPixelFormat_I420`。
2247
+ * - 当数据传递方式为纹理 `TRTCVideoBufferType_Texture` 时,取值必须时 `TRTCVideoPixelFormat_RGBA32` 格式。
2248
+ * @param {TRTCVideoBufferType} options.bufferType - 视频数据传递方式,默认值:`TRTCVideoBufferType_Buffer`。
2249
+ *
2250
+ * @ignore
2251
+ */
2241
2252
  initPluginManager(options?: {
2242
2253
  pixelFormat: TRTCVideoPixelFormat;
2243
2254
  bufferType?: TRTCVideoBufferType;
package/liteav/trtc.js CHANGED
@@ -298,7 +298,7 @@ class TRTCCloud extends events_1.EventEmitter {
298
298
  this.handleOnError(int32_1, string_1);
299
299
  break;
300
300
  case 'onWarning':
301
- this.handleOnWarning(int32_1, string_1);
301
+ this.handleOnWarning(int32_1, string_1, int32_2);
302
302
  break;
303
303
  case 'onEnterRoom':
304
304
  this.handleOnEnterRoom(int32_1);
@@ -479,8 +479,8 @@ class TRTCCloud extends events_1.EventEmitter {
479
479
  * @param {Number} warningCode - 警告码
480
480
  * @param {String} warningMsg - 警告信息
481
481
  */
482
- handleOnWarning(warningCode, warningMsg) {
483
- this.fire('onWarning', warningCode, warningMsg);
482
+ handleOnWarning(warningCode, warningMsg, extra) {
483
+ this.fire('onWarning', warningCode, warningMsg, extra);
484
484
  }
485
485
  /////////////////////////////////////////////////////////////////////////////////
486
486
  //
@@ -4029,6 +4029,17 @@ class TRTCCloud extends events_1.EventEmitter {
4029
4029
  //----------------------------------//
4030
4030
  // plugin API -- start
4031
4031
  //----------------------------------//
4032
+ /**
4033
+ * 插件管理器初始化接口
4034
+ *
4035
+ * 启动美颜插件管理器,并设置视频在美颜处理时的像素格式和数据传递方式。
4036
+ * @param options 视频预处理参数,非必填。
4037
+ * @param {TRTCVideoPixelFormat} options.pixelFormat - 视频像素格式,默认值:`TRTCVideoPixelFormat_I420`。
4038
+ * - 当数据传递方式为纹理 `TRTCVideoBufferType_Texture` 时,取值必须时 `TRTCVideoPixelFormat_RGBA32` 格式。
4039
+ * @param {TRTCVideoBufferType} options.bufferType - 视频数据传递方式,默认值:`TRTCVideoBufferType_Buffer`。
4040
+ *
4041
+ * @ignore
4042
+ */
4032
4043
  initPluginManager(options) {
4033
4044
  const defaultPixelFormat = !this._isMacPlatform() ? trtc_define_1.TRTCVideoPixelFormat.TRTCVideoPixelFormat_RGBA32 : trtc_define_1.TRTCVideoPixelFormat.TRTCVideoPixelFormat_BGRA32;
4034
4045
  if (options) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "trtc-electron-sdk",
3
- "version": "11.2.118-beta.1",
3
+ "version": "11.2.118-beta.3",
4
4
  "description": "trtc electron sdk",
5
5
  "main": "./liteav/trtc.js",
6
6
  "types": "./liteav/trtc.d.ts",
@@ -15,7 +15,8 @@
15
15
  "semver": "^6.0.0",
16
16
  "signale": "^1.4.0",
17
17
  "yuv-buffer": "^1.0.0",
18
- "yuv-canvas": "^1.2.6"
18
+ "yuv-canvas": "^1.2.6",
19
+ "hpagent": "^1.2.0"
19
20
  },
20
21
  "devDependencies": {
21
22
  "@babel/cli": "^7.11.6",
@@ -4,6 +4,7 @@ const fs = require('fs-extra');
4
4
  const rimraf = require('rimraf');
5
5
  const signale = require('signale');
6
6
  const { exec } = require('child_process');
7
+ const { HttpsProxyAgent } = require('hpagent');
7
8
 
8
9
  const {
9
10
  readCliArgv,
@@ -11,6 +12,7 @@ const {
11
12
  detectOS,
12
13
  detectOwnVersion,
13
14
  detectOwnName,
15
+ readProxyUrlFromEnv,
14
16
  } = require('./utils');
15
17
  const { Platform } = require('./constant');
16
18
 
@@ -68,10 +70,24 @@ const main = () => {
68
70
  signale.info('Download Url =', downloadUrl, '\n');
69
71
 
70
72
  signale.pending('Downloading C++ addon Electron SDK...\n');
71
- download(downloadUrl, outputDir, {
73
+ const downloadOptions = {
72
74
  strip: 0,
73
75
  extract: true
74
- }).then(() => {
76
+ };
77
+ const proxyUrl = readProxyUrlFromEnv(downloadUrl);
78
+ if (proxyUrl) {
79
+ downloadOptions.agent = {
80
+ https: new HttpsProxyAgent({
81
+ keepAlive: true,
82
+ keepAliveMsecs: 1000,
83
+ maxSockets: 256,
84
+ maxFreeSockets: 256,
85
+ scheduling: 'lifo',
86
+ proxy: proxyUrl
87
+ })
88
+ }
89
+ }
90
+ download(downloadUrl, outputDir, downloadOptions).then(() => {
75
91
  signale.success(`Download finished - ${platform}`);
76
92
 
77
93
  fs.copySync(
package/scripts/utils.js CHANGED
@@ -27,6 +27,13 @@ module.exports.readCliArgv = function() {
27
27
  return newArgv;
28
28
  };
29
29
 
30
+ module.exports.readProxyUrlFromEnv = function(downloadUrl) {
31
+ if (downloadUrl.indexOf('https') === 0) {
32
+ return process.env.https_proxy || ''
33
+ }
34
+ return process.env.http_proxy || '';
35
+ }
36
+
30
37
  module.exports.readArgvFromNpmEnv = function() {
31
38
  const result = {};
32
39
  if (process.env.npm_config_trtc_electron_arch) {