trtc-electron-sdk 12.2.115-beta.4 → 12.2.115-beta.6

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
@@ -2958,6 +2958,24 @@ declare class TRTCCloud extends EventEmitter {
2958
2958
  * @param {String} jsonStr - 接口及参数描述的 JSON 字符串
2959
2959
  */
2960
2960
  callExperimentalAPI(jsonStr: string): void;
2961
+ /**
2962
+ * @private
2963
+ *
2964
+ * 开启/关闭视频渲染帧率控制
2965
+ *
2966
+ * @param {Record<string, unknown>} params - 参数
2967
+ *
2968
+ * @example
2969
+ * import TRTCCloud from "trtc-electron-sdk";
2970
+ *
2971
+ * const trtcCloud = TRTCCloud.getTRTCShareInstance();
2972
+ * trtcCloud.callExperimentalAPI(JSON.stringify({
2973
+ * api: "disableLocalRenderFPSOptimization",
2974
+ * params: {
2975
+ * disable: true
2976
+ * }
2977
+ * }));
2978
+ */
2961
2979
  private disableLocalRenderFPSOptimization;
2962
2980
  }
2963
2981
  export default TRTCCloud;
package/liteav/trtc.js CHANGED
@@ -5350,6 +5350,24 @@ class TRTCCloud extends events_1.EventEmitter {
5350
5350
  this.logger.warn(`callExperimentalAPI invalid JSON parameter`, error);
5351
5351
  }
5352
5352
  }
5353
+ /**
5354
+ * @private
5355
+ *
5356
+ * 开启/关闭视频渲染帧率控制
5357
+ *
5358
+ * @param {Record<string, unknown>} params - 参数
5359
+ *
5360
+ * @example
5361
+ * import TRTCCloud from "trtc-electron-sdk";
5362
+ *
5363
+ * const trtcCloud = TRTCCloud.getTRTCShareInstance();
5364
+ * trtcCloud.callExperimentalAPI(JSON.stringify({
5365
+ * api: "disableLocalRenderFPSOptimization",
5366
+ * params: {
5367
+ * disable: true
5368
+ * }
5369
+ * }));
5370
+ */
5353
5371
  disableLocalRenderFPSOptimization(params) {
5354
5372
  this.videoRenderFPS = 60;
5355
5373
  if (params.disable === true) {
@@ -234,7 +234,7 @@ export declare class TRTCVideoFrame {
234
234
  * 音频帧数据
235
235
  *
236
236
  * @param {TRTCAudioFrameFormat} audioFormat - 音频帧的格式
237
- * @param {ArrayBuffer} data - 音频数据
237
+ * @param {Buffer|ArrayBuffer} data - 音频数据
238
238
  * @param {Number} length - 音频数据的长度
239
239
  * @param {Number} sampleRate - 采样率
240
240
  * @param {Number} channel - 声道数
@@ -244,7 +244,7 @@ export declare class TRTCVideoFrame {
244
244
  */
245
245
  export declare class TRTCAudioFrame {
246
246
  audioFormat: TRTCAudioFrameFormat;
247
- data: ArrayBuffer | null;
247
+ data: Buffer | ArrayBuffer | null;
248
248
  length: number;
249
249
  sampleRate: number;
250
250
  channel: number;
@@ -651,7 +651,7 @@ exports.TRTCVideoFrame = TRTCVideoFrame;
651
651
  * 音频帧数据
652
652
  *
653
653
  * @param {TRTCAudioFrameFormat} audioFormat - 音频帧的格式
654
- * @param {ArrayBuffer} data - 音频数据
654
+ * @param {Buffer|ArrayBuffer} data - 音频数据
655
655
  * @param {Number} length - 音频数据的长度
656
656
  * @param {Number} sampleRate - 采样率
657
657
  * @param {Number} channel - 声道数
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "trtc-electron-sdk",
3
- "version": "12.2.115-beta.4",
3
+ "version": "12.2.115-beta.6",
4
4
  "description": "trtc electron sdk",
5
5
  "main": "./liteav/index.js",
6
6
  "types": "./liteav/index.d.ts",
@@ -28,7 +28,13 @@ const {
28
28
  } = require("./utils");
29
29
  const { Platform } = require("./constant");
30
30
 
31
- const buildDownloadInfo = () => {
31
+ const urlDomains = [
32
+ "web.sdk.qcloud.com",
33
+ "web.sdk.cloud.tencent.cn",
34
+ "web.sdk.tencent.cn",
35
+ ];
36
+
37
+ const buildDownloadInfo = (urlDomain) => {
32
38
  let configArgv = Object.assign(
33
39
  {
34
40
  arch: process.arch,
@@ -52,193 +58,171 @@ const buildDownloadInfo = () => {
52
58
  // generate download url
53
59
  return {
54
60
  platform: osLabel,
55
- downloadUrl: `https://web.sdk.qcloud.com/trtc/electron/download/${name}/${version}/${name}-${osLabel}-${version}.zip`,
61
+ downloadUrl: `https://${urlDomain}/trtc/electron/download/${name}/${version}/${name}-${osLabel}-${version}.zip`,
56
62
  name,
57
63
  version,
58
64
  archType: configArgv.arch,
59
65
  };
60
66
  };
61
67
 
62
- const main = () => {
68
+ async function main(urlDomain) {
63
69
  const {
64
70
  platform,
65
71
  downloadUrl,
66
72
  name,
67
73
  version,
68
74
  archType,
69
- } = buildDownloadInfo();
70
-
75
+ } = buildDownloadInfo(urlDomain);
76
+
71
77
  const outputDir = path.join(__dirname, "../temp");
72
78
  const buildDir = path.join(__dirname, "../build");
73
79
 
74
80
  rimraf.sync(outputDir);
75
- rimraf(buildDir, (err) => {
76
- if (err) {
77
- signale.fatal(err);
78
- process.exit(1);
79
- }
81
+ rimraf.sync(buildDir);
80
82
 
81
- // print download info
82
- signale.info("removeDir =", buildDir);
83
- signale.info("outputDir =", outputDir);
83
+ // print download info
84
+ signale.info("removeDir =", buildDir);
85
+ signale.info("outputDir =", outputDir);
84
86
 
85
- signale.info("Package Version =", version);
86
- signale.info("Platform =", platform);
87
- signale.info("Download Url =", downloadUrl, "\n");
87
+ signale.info("Package Version =", version);
88
+ signale.info("Platform =", platform);
89
+ signale.info("Download Url =", downloadUrl, "\n");
88
90
 
89
- signale.pending("Downloading C++ addon Electron SDK...\n");
90
- const downloadOptions = {
91
- strip: 0,
92
- extract: true,
91
+ signale.pending("Downloading C++ addon Electron SDK...\n");
92
+ const downloadOptions = {
93
+ strip: 0,
94
+ extract: true,
95
+ };
96
+ const proxyUrl = readProxyUrlFromEnv(downloadUrl);
97
+ if (proxyUrl) {
98
+ downloadOptions.agent = {
99
+ https: new HttpsProxyAgent({
100
+ keepAlive: true,
101
+ keepAliveMsecs: 1000,
102
+ maxSockets: 256,
103
+ maxFreeSockets: 256,
104
+ scheduling: "lifo",
105
+ proxy: proxyUrl,
106
+ }),
93
107
  };
94
- const proxyUrl = readProxyUrlFromEnv(downloadUrl);
95
- if (proxyUrl) {
96
- downloadOptions.agent = {
97
- https: new HttpsProxyAgent({
98
- keepAlive: true,
99
- keepAliveMsecs: 1000,
100
- maxSockets: 256,
101
- maxFreeSockets: 256,
102
- scheduling: "lifo",
103
- proxy: proxyUrl,
104
- }),
105
- };
106
- }
107
- download(downloadUrl, outputDir, downloadOptions)
108
- .then(() => {
109
- signale.success(`Download finished - ${platform}`);
110
-
111
- fs.copySync(
112
- path.join(outputDir, "./build/Release"),
113
- path.join(buildDir, "Release")
114
- );
115
- signale.success(`copy success! - ${platform}`);
116
-
117
- if (
118
- platform === Platform.WINDOWS32 ||
119
- platform === Platform.WINDOWS64
120
- ) {
121
- // windows 下
122
- rimraf.sync(outputDir);
123
- } else if (
124
- platform === Platform.MACOS ||
125
- platform === Platform.MACOS_ARM
126
- ) {
127
- // mac
128
- const arch = archType;
129
- fs.copySync(
130
- path.join(outputDir, "./build/Release/trtc_electron_sdk.node"),
131
- path.join(buildDir, "Release", arch, "trtc_electron_sdk.node")
132
- );
133
- fs.copySync(
134
- path.join(outputDir, "./build/mac-framework", arch),
135
- path.join(buildDir, "mac-framework", arch)
136
- );
137
- signale.success(`copy success! - mac ${arch}`, "\n");
138
-
139
- let anotherPlatform, anotherArch;
140
- if (arch === "x64") {
141
- // download arm64
142
- anotherPlatform = Platform.MACOS_ARM;
143
- anotherArch = "arm64";
144
- } else {
145
- // arch = arm64, download x64
146
- anotherPlatform = Platform.MACOS;
147
- anotherArch = "x64";
148
- }
149
- const anotherDownloadUrl = `https://web.sdk.qcloud.com/trtc/electron/download/${name}/${version}/${name}-${anotherPlatform}-${version}.zip`;
150
- signale.info("Download Url =", anotherDownloadUrl, "\n");
151
- signale.pending(
152
- `Downloading C++ addon Electron SDK... ${anotherArch}\n`
153
- );
154
- download(anotherDownloadUrl, path.join(outputDir, anotherPlatform), {
155
- strip: 0,
156
- extract: true,
157
- })
158
- .then(() => {
159
- signale.success(`Download finished - mac ${anotherArch}`);
160
-
161
- fs.copySync(
162
- path.join(
163
- outputDir,
164
- anotherPlatform,
165
- "/build/Release/trtc_electron_sdk.node"
166
- ),
167
- path.join(
168
- buildDir,
169
- "Release",
170
- anotherArch,
171
- "trtc_electron_sdk.node"
172
- )
173
- );
174
- fs.copySync(
175
- path.join(
176
- outputDir,
177
- anotherPlatform,
178
- "/build/mac-framework",
179
- anotherArch
180
- ),
181
- path.join(buildDir, "mac-framework", anotherArch)
182
- );
183
- signale.success(`copy success! - mac ${anotherArch}`);
184
-
185
- rimraf.sync(outputDir);
186
- })
187
- .catch((err) => {
188
- signale.fatal(`download error! - mac ${anotherPlatform}`, err);
189
- });
190
- } else if (
191
- platform === Platform.LINUX_X64 ||
192
- platform === Platform.LINUX_ARM64
193
- ) {
194
- // Linux 下
195
- const arch = process.arch;
196
- fs.copySync(
197
- path.join(outputDir, "./build/Release"),
198
- path.join(buildDir, "Release", arch)
199
- );
200
- signale.success(`copy success! - linux ${arch}`, "\n");
201
-
202
- let anotherPlatform, anotherArch;
203
- if (arch === "x64") {
204
- // download arm64
205
- anotherPlatform = Platform.LINUX_ARM64;
206
- anotherArch = "arm64";
207
- } else {
208
- // arch = arm64, download x64
209
- anotherPlatform = Platform.LINUX_X64;
210
- anotherArch = "x64";
211
- }
212
- const anotherDownloadUrl = `https://web.sdk.qcloud.com/trtc/electron/download/${name}/${version}/${name}-${anotherPlatform}-${version}.zip`;
213
- signale.info("Download Url =", anotherDownloadUrl, "\n");
214
- signale.pending(
215
- `Downloading C++ addon Electron SDK... ${anotherArch}\n`
216
- );
217
- download(anotherDownloadUrl, path.join(outputDir, anotherPlatform), {
218
- strip: 0,
219
- extract: true,
220
- })
221
- .then(() => {
222
- signale.success(`Download finished - linux ${anotherArch}`);
223
- fs.copySync(
224
- path.join(outputDir, anotherPlatform, "/build/Release"),
225
- path.join(buildDir, "Release", anotherArch)
226
- );
227
- signale.success(`copy success! - linux ${anotherArch}`);
228
-
229
- rimraf.sync(outputDir);
230
- })
231
- .catch((err) => {
232
- signale.fatal(`download error! - linux ${anotherPlatform}`, err);
233
- });
234
- } else {
235
- signale.warn(`Not supported platform: ${platform}`);
236
- }
108
+ }
109
+
110
+ try {
111
+ await download(downloadUrl, outputDir, downloadOptions);
112
+ signale.success(`Download finished - ${platform}`);
113
+
114
+ fs.copySync(
115
+ path.join(outputDir, "./build/Release"),
116
+ path.join(buildDir, "Release")
117
+ );
118
+ signale.success(`copy success! - ${platform}`);
119
+
120
+ if (platform === Platform.WINDOWS32 || platform === Platform.WINDOWS64) {
121
+ // windows
122
+ rimraf.sync(outputDir);
123
+ } else if (platform === Platform.MACOS || platform === Platform.MACOS_ARM) {
124
+ // mac 下
125
+ const arch = archType;
126
+ fs.copySync(
127
+ path.join(outputDir, "./build/Release/trtc_electron_sdk.node"),
128
+ path.join(buildDir, "Release", arch, "trtc_electron_sdk.node")
129
+ );
130
+ fs.copySync(
131
+ path.join(outputDir, "./build/mac-framework", arch),
132
+ path.join(buildDir, "mac-framework", arch)
133
+ );
134
+ signale.success(`copy success! - mac ${arch}`, "\n");
135
+
136
+ let anotherPlatform, anotherArch;
137
+ if (arch === "x64") {
138
+ // download arm64
139
+ anotherPlatform = Platform.MACOS_ARM;
140
+ anotherArch = "arm64";
141
+ } else {
142
+ // arch = arm64, download x64
143
+ anotherPlatform = Platform.MACOS;
144
+ anotherArch = "x64";
145
+ }
146
+
147
+ const anotherDownloadUrl = `https://${urlDomain}/trtc/electron/download/${name}/${version}/${name}-${anotherPlatform}-${version}.zip`;
148
+ signale.info("Download Url =", anotherDownloadUrl, "\n");
149
+ signale.pending(`Downloading C++ addon Electron SDK... ${anotherArch}\n`);
150
+ await download(anotherDownloadUrl, path.join(outputDir, anotherPlatform), {
151
+ strip: 0,
152
+ extract: true,
237
153
  })
238
- .catch((err) => {
239
- signale.fatal(`Failed! Download error - ${platform}`, err);
240
- });
241
- });
242
- };
154
+ signale.success(`Download finished - mac ${anotherArch}`);
155
+ fs.copySync(
156
+ path.join(
157
+ outputDir,
158
+ anotherPlatform,
159
+ "/build/Release/trtc_electron_sdk.node"
160
+ ),
161
+ path.join(
162
+ buildDir,
163
+ "Release",
164
+ anotherArch,
165
+ "trtc_electron_sdk.node"
166
+ )
167
+ );
168
+ fs.copySync(
169
+ path.join(
170
+ outputDir,
171
+ anotherPlatform,
172
+ "/build/mac-framework",
173
+ anotherArch
174
+ ),
175
+ path.join(buildDir, "mac-framework", anotherArch)
176
+ );
177
+ signale.success(`copy success! - mac ${anotherArch}`);
178
+
179
+ rimraf.sync(outputDir);
180
+ } else if (platform === Platform.LINUX_X64 || platform === Platform.LINUX_ARM64) {
181
+ // Linux 下
182
+ const arch = process.arch;
183
+ fs.copySync(
184
+ path.join(outputDir, "./build/Release"),
185
+ path.join(buildDir, "Release", arch)
186
+ );
187
+ signale.success(`copy success! - linux ${arch}`, "\n");
188
+
189
+ let anotherPlatform, anotherArch;
190
+ if (arch === "x64") {
191
+ // download arm64
192
+ anotherPlatform = Platform.LINUX_ARM64;
193
+ anotherArch = "arm64";
194
+ } else {
195
+ // arch = arm64, download x64
196
+ anotherPlatform = Platform.LINUX_X64;
197
+ anotherArch = "x64";
198
+ }
199
+ const anotherDownloadUrl = `https://${urlDomain}/trtc/electron/download/${name}/${version}/${name}-${anotherPlatform}-${version}.zip`;
200
+ signale.info("Download Url =", anotherDownloadUrl, "\n");
201
+ signale.pending(`Downloading C++ addon Electron SDK... ${anotherArch}\n`);
202
+ await download(anotherDownloadUrl, path.join(outputDir, anotherPlatform), {
203
+ strip: 0,
204
+ extract: true,
205
+ })
206
+ signale.success(`Download finished - linux ${anotherArch}`);
207
+ fs.copySync(
208
+ path.join(outputDir, anotherPlatform, "/build/Release"),
209
+ path.join(buildDir, "Release", anotherArch)
210
+ );
211
+ signale.success(`copy success! - linux ${anotherArch}`);
212
+
213
+ rimraf.sync(outputDir);
214
+ } else {
215
+ signale.warn(`Not supported platform: ${platform}`);
216
+ }
217
+ } catch(err) {
218
+ const anotherUrlDomain = urlDomains.shift();
219
+ if (anotherUrlDomain) {
220
+ signale.info(`Try to download from another address:${anotherUrlDomain}`);
221
+ main(anotherUrlDomain);
222
+ } else {
223
+ signale.error(`Failed! Download error - ${platform}`, err);
224
+ }
225
+ }
226
+ }
243
227
 
244
- main();
228
+ main(urlDomains.shift());