trtc-electron-sdk 12.2.115-beta.2 → 12.2.115-beta.21

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 (34) hide show
  1. package/liteav/MediaMixingDesigner/index.d.ts +12 -8
  2. package/liteav/MediaMixingDesigner/index.js +135 -79
  3. package/liteav/base/DevicePixelRatioObserver.d.ts +12 -0
  4. package/liteav/base/DevicePixelRatioObserver.js +32 -0
  5. package/liteav/base/PromiseStore.d.ts +10 -0
  6. package/liteav/base/PromiseStore.js +58 -0
  7. package/liteav/constant.d.ts +1 -0
  8. package/liteav/constant.js +4 -0
  9. package/liteav/extensions/MediaMixingManager/MediaMixingManager.d.ts +429 -0
  10. package/liteav/extensions/MediaMixingManager/MediaMixingManager.js +1290 -0
  11. package/liteav/extensions/MediaMixingManager/MediaMixingService.d.ts +60 -0
  12. package/liteav/extensions/MediaMixingManager/MediaMixingService.js +80 -0
  13. package/liteav/extensions/MediaMixingManager/StreamLayout/BaseStreamLayoutManager.d.ts +32 -0
  14. package/liteav/extensions/MediaMixingManager/StreamLayout/BaseStreamLayoutManager.js +114 -0
  15. package/liteav/extensions/MediaMixingManager/StreamLayout/CustomStreamLayoutManager.d.ts +11 -0
  16. package/liteav/extensions/MediaMixingManager/StreamLayout/CustomStreamLayoutManager.js +135 -0
  17. package/liteav/extensions/MediaMixingManager/StreamLayout/NoneStreamLayoutManager.d.ts +11 -0
  18. package/liteav/extensions/MediaMixingManager/StreamLayout/NoneStreamLayoutManager.js +73 -0
  19. package/liteav/extensions/MediaMixingManager/StreamLayout/index.d.ts +7 -0
  20. package/liteav/extensions/MediaMixingManager/StreamLayout/index.js +34 -0
  21. package/liteav/extensions/MediaMixingManager/StreamLayout/types.d.ts +25 -0
  22. package/liteav/extensions/MediaMixingManager/StreamLayout/types.js +2 -0
  23. package/liteav/extensions/MediaMixingManager/index.d.ts +4 -227
  24. package/liteav/extensions/MediaMixingManager/index.js +30 -589
  25. package/liteav/extensions/MediaMixingManager/types.d.ts +107 -0
  26. package/liteav/extensions/MediaMixingManager/types.js +26 -0
  27. package/liteav/trtc.d.ts +67 -13
  28. package/liteav/trtc.js +159 -61
  29. package/liteav/trtc_define.d.ts +29 -3
  30. package/liteav/trtc_define.js +97 -29
  31. package/liteav/utils.d.ts +27 -0
  32. package/liteav/utils.js +85 -1
  33. package/package.json +2 -2
  34. package/scripts/download.js +153 -169
@@ -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());