trtc-electron-sdk 11.0.501-beta.2 → 11.0.501

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/liteav/trtc.d.ts CHANGED
@@ -544,7 +544,7 @@ declare class TRTCCloud extends EventEmitter {
544
544
  * 当屏幕分享暂停时,SDK 会通过此回调通知
545
545
  *
546
546
  * @event TRTCCallback#onScreenCapturePaused
547
- * @param {Number} reason - 停止原因,0:表示用户主动暂停;1:表示设置屏幕分享参数导致的暂停;2:表示屏幕分享窗口被最小化导致的暂停;3:表示屏幕分享窗口被隐藏导致的暂停
547
+ * @param {Number} reason - 停止原因,0:表示用户主动暂停;1:注意此字段的含义在 MAC 和 Windows 平台有稍微差异。屏幕窗口不可见暂停(Mac)。表示设置屏幕分享参数导致的暂停(Windows);2:表示屏幕分享窗口被最小化导致的暂停(仅 Windows);3:表示屏幕分享窗口被隐藏导致的暂停(仅 Windows)
548
548
  */
549
549
  handleOnScreenCapturePaused(reason: number): void;
550
550
  /**
package/liteav/trtc.js CHANGED
@@ -1128,7 +1128,7 @@ class TRTCCloud extends events_1.EventEmitter {
1128
1128
  * 当屏幕分享暂停时,SDK 会通过此回调通知
1129
1129
  *
1130
1130
  * @event TRTCCallback#onScreenCapturePaused
1131
- * @param {Number} reason - 停止原因,0:表示用户主动暂停;1:表示设置屏幕分享参数导致的暂停;2:表示屏幕分享窗口被最小化导致的暂停;3:表示屏幕分享窗口被隐藏导致的暂停
1131
+ * @param {Number} reason - 停止原因,0:表示用户主动暂停;1:注意此字段的含义在 MAC 和 Windows 平台有稍微差异。屏幕窗口不可见暂停(Mac)。表示设置屏幕分享参数导致的暂停(Windows);2:表示屏幕分享窗口被最小化导致的暂停(仅 Windows);3:表示屏幕分享窗口被隐藏导致的暂停(仅 Windows)
1132
1132
  */
1133
1133
  handleOnScreenCapturePaused(reason) {
1134
1134
  this.fire('onScreenCapturePaused', reason);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "trtc-electron-sdk",
3
- "version": "11.0.501-beta.2",
3
+ "version": "11.0.501",
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) {