trtc-electron-sdk 12.9.708-beta.0 → 13.0.709-alpha.0
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.
|
@@ -320,7 +320,7 @@ class TRTCMediaMixingManager {
|
|
|
320
320
|
mirrorType: trtc_define_1.TRTCVideoMirrorType.TRTCVideoMirrorType_Auto,
|
|
321
321
|
};
|
|
322
322
|
if (this.autoControlServer) {
|
|
323
|
-
this.startMediaMixingServer()
|
|
323
|
+
this.startMediaMixingServer('', TRTCMediaMixingServerMode.Embedded)
|
|
324
324
|
.then(() => {
|
|
325
325
|
logger_1.default.info(`${this.logPrefix}startMediaMixingServer success.`);
|
|
326
326
|
})
|
|
@@ -512,34 +512,36 @@ class TRTCMediaMixingManager {
|
|
|
512
512
|
* @returns {Promise<void>}
|
|
513
513
|
*/
|
|
514
514
|
addMediaSource(mediaSource) {
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
const newMediaSource = (0, utils_1.safelyParse)(JSON.stringify(mediaSource));
|
|
524
|
-
if (newMediaSource.isSelected) {
|
|
525
|
-
const oldSelectedIndex = this.findSelectedMediaSource();
|
|
526
|
-
if (oldSelectedIndex !== -1) {
|
|
527
|
-
this.unselectMediaSource(oldSelectedIndex);
|
|
515
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
516
|
+
logger_1.default.log(`${this.logPrefix}addMediaSource:`, mediaSource);
|
|
517
|
+
const index = this.findMediaSourceIndex(mediaSource);
|
|
518
|
+
if (index !== -1) {
|
|
519
|
+
return Promise.reject({
|
|
520
|
+
code: types_1.TRTCMediaMixingErrorCode.InvalidParams,
|
|
521
|
+
message: "Media source already existed"
|
|
522
|
+
});
|
|
528
523
|
}
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
524
|
+
const newMediaSource = (0, utils_1.safelyParse)(JSON.stringify(mediaSource));
|
|
525
|
+
if (newMediaSource.isSelected) {
|
|
526
|
+
const oldSelectedIndex = this.findSelectedMediaSource();
|
|
527
|
+
if (oldSelectedIndex !== -1) {
|
|
528
|
+
yield this.unselectMediaSource(oldSelectedIndex);
|
|
529
|
+
}
|
|
530
|
+
}
|
|
531
|
+
return new Promise((resolve, reject) => {
|
|
532
|
+
var _a;
|
|
533
|
+
const key = `${promiseKeys.addMediaSource}-${newMediaSource.sourceType}-${newMediaSource.sourceId}`;
|
|
534
|
+
this.promiseStore.addPromise(key, resolve, reject);
|
|
535
|
+
this.nodeMediaMixingPlugin.addMediaSource(newMediaSource);
|
|
536
|
+
(_a = this.mediaMixingDesigner) === null || _a === void 0 ? void 0 : _a.addMedia({
|
|
537
|
+
id: `${newMediaSource.sourceType}__${newMediaSource.sourceId}`,
|
|
538
|
+
rect: newMediaSource.rect,
|
|
539
|
+
isSelected: newMediaSource.isSelected || false,
|
|
540
|
+
zOrder: newMediaSource.zOrder,
|
|
541
|
+
origin: newMediaSource
|
|
542
|
+
});
|
|
543
|
+
this.sourceList.push(newMediaSource);
|
|
541
544
|
});
|
|
542
|
-
this.sourceList.push(newMediaSource);
|
|
543
545
|
});
|
|
544
546
|
}
|
|
545
547
|
/**
|
|
@@ -612,7 +614,7 @@ class TRTCMediaMixingManager {
|
|
|
612
614
|
if (mediaSource.isSelected) {
|
|
613
615
|
const oldSelectedIndex = this.findSelectedMediaSource();
|
|
614
616
|
if (oldSelectedIndex !== -1 && oldSelectedIndex !== index) {
|
|
615
|
-
this.unselectMediaSource(oldSelectedIndex);
|
|
617
|
+
yield this.unselectMediaSource(oldSelectedIndex);
|
|
616
618
|
}
|
|
617
619
|
}
|
|
618
620
|
yield this.nodeMediaMixingPlugin.updateMediaSource(newMediaSource);
|
|
@@ -1468,7 +1470,6 @@ class TRTCMediaMixingManager {
|
|
|
1468
1470
|
else {
|
|
1469
1471
|
// neither native window nor web element, stop preview
|
|
1470
1472
|
this.previewInNone();
|
|
1471
|
-
this.destroyWebRenderer();
|
|
1472
1473
|
}
|
|
1473
1474
|
});
|
|
1474
1475
|
}
|
|
@@ -1476,6 +1477,7 @@ class TRTCMediaMixingManager {
|
|
|
1476
1477
|
this.destroyResizeObserver();
|
|
1477
1478
|
this.destroyLayoutManager();
|
|
1478
1479
|
this.destroyDesigner();
|
|
1480
|
+
this.destroyWebRenderer();
|
|
1479
1481
|
this.view = null;
|
|
1480
1482
|
this.nodeMediaMixingPlugin.setDisplayParams(this.windowID, { left: 0, right: 0, top: 0, bottom: 0 });
|
|
1481
1483
|
}
|
|
@@ -1531,11 +1533,13 @@ class TRTCMediaMixingManager {
|
|
|
1531
1533
|
this.nodeMediaMixingPlugin.setVideoFrameRenderBuffer(this.videoRenderBuffer.userId, this.videoRenderBuffer.buffer, this.videoRenderBuffer.streamType, this.videoRenderBuffer.width, this.videoRenderBuffer.height, this.videoRenderBuffer.pixelFormat, this.videoRenderBuffer.id);
|
|
1532
1534
|
}
|
|
1533
1535
|
destroyWebRendererBuffer() {
|
|
1534
|
-
this.videoRenderBuffer.
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1536
|
+
if (this.videoRenderBuffer.buffer !== null || this.videoRenderBuffer.id !== 0) {
|
|
1537
|
+
this.videoRenderBuffer.width = 0;
|
|
1538
|
+
this.videoRenderBuffer.height = 0;
|
|
1539
|
+
this.nodeMediaMixingPlugin.setVideoFrameRenderBuffer(this.videoRenderBuffer.userId, this.videoRenderBuffer.buffer, this.videoRenderBuffer.streamType, this.videoRenderBuffer.width, this.videoRenderBuffer.height, this.videoRenderBuffer.pixelFormat, this.videoRenderBuffer.id);
|
|
1540
|
+
this.videoRenderBuffer.buffer = null;
|
|
1541
|
+
this.videoRenderBuffer.id = 0;
|
|
1542
|
+
}
|
|
1539
1543
|
}
|
|
1540
1544
|
webRendererCallback(args) {
|
|
1541
1545
|
const [id, type, width, height, timestamp, rotation, valid, bufferId] = args;
|
package/package.json
CHANGED
package/scripts/copy-sdk.js
CHANGED
|
@@ -2,6 +2,8 @@ const path = require("path");
|
|
|
2
2
|
const fs = require("fs");
|
|
3
3
|
const { removeSync, copySync } = require("fs-extra");
|
|
4
4
|
const signale = require('signale');
|
|
5
|
+
const { arch } = process;
|
|
6
|
+
const { exec } = require('child_process');
|
|
5
7
|
|
|
6
8
|
// npm run copy:sdk
|
|
7
9
|
const SDK_ROOT = path.resolve(__dirname, "../../");
|
|
@@ -56,6 +58,24 @@ if (process.platform === "win32") {
|
|
|
56
58
|
path.resolve(SDK_CPP_PATH, `src/remote-liteav/sdk/mac/Frameworks/${process.arch}/TXSoundTouch.framework`),
|
|
57
59
|
path.resolve(SDK_JS_PATH, `build/mac-framework/${process.arch}/TXSoundTouch.framework`)
|
|
58
60
|
);
|
|
61
|
+
copySync(
|
|
62
|
+
path.resolve(SDK_CPP_PATH, `src/remote-liteav/sdk/mac/Frameworks/${process.arch}/TXLiteAVSDK_TRTC_Mac.framework`),
|
|
63
|
+
path.resolve(SDK_JS_PATH, `build/mac-framework/${process.arch}/TXLiteAVSDK_TRTC_Mac.framework`)
|
|
64
|
+
);
|
|
65
|
+
copySync(
|
|
66
|
+
path.resolve(SDK_CPP_PATH, `src/remote-liteav/out/Release-macos/${process.arch}/liblive_kit_engine.dylib`),
|
|
67
|
+
path.resolve(SDK_JS_PATH, `build/mac-framework/${process.arch}/liblive_kit_engine.dylib`)
|
|
68
|
+
);
|
|
69
|
+
|
|
70
|
+
sourcePath = path.join(__dirname, `../../trtc-electron-sdk/build/mac-framework/${arch}/`);
|
|
71
|
+
targetPath = path.join(__dirname, '../../../samples/trtc-electron-test-demo/node_modules/electron/dist/Electron.app/Contents/Frameworks');
|
|
72
|
+
if (fs.existsSync(sourcePath) && fs.existsSync(targetPath)) {
|
|
73
|
+
const command = `rsync -a ${sourcePath} ${targetPath}`;
|
|
74
|
+
signale.log(command);
|
|
75
|
+
exec(command);
|
|
76
|
+
} else {
|
|
77
|
+
signale.warn('sourcePath or targetPath is not exist');
|
|
78
|
+
}
|
|
59
79
|
} else {
|
|
60
80
|
// linux
|
|
61
81
|
let soPrefix = ""
|
package/scripts/postinstall.js
CHANGED
|
@@ -9,13 +9,21 @@ const maxRetryCount = 60;
|
|
|
9
9
|
|
|
10
10
|
function rsync() {
|
|
11
11
|
if (platform === 'darwin') {
|
|
12
|
-
const sourcePath = path.join(__dirname, `../../trtc-electron-sdk/build/mac-framework/${arch}/`);
|
|
13
|
-
const targetPath = path.join(__dirname, '../../electron/dist/Electron.app/Contents/Frameworks');
|
|
14
12
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
13
|
+
const currentPath = process.cwd();
|
|
14
|
+
const pathFlagValue = `packages${
|
|
15
|
+
process.platform === "win32" ? "\\" : "/"
|
|
16
|
+
}trtc-electron-sdk`;
|
|
17
|
+
const isLocal = currentPath.indexOf(pathFlagValue) !== -1;
|
|
18
|
+
|
|
19
|
+
let sourcePath = '';
|
|
20
|
+
let targetPath = '';
|
|
21
|
+
if(isLocal) {
|
|
22
|
+
sourcePath = path.join(__dirname, `../../trtc-electron-sdk/build/mac-framework/${arch}/`);
|
|
23
|
+
targetPath = path.join(__dirname, '../../../samples/trtc-electron-test-demo/node_modules/electron/dist/Electron.app/Contents/Frameworks');
|
|
24
|
+
} else {
|
|
25
|
+
sourcePath = path.join(__dirname, `../../trtc-electron-sdk/build/mac-framework/${arch}/`);
|
|
26
|
+
targetPath = path.join(__dirname, '../../electron/dist/Electron.app/Contents/Frameworks');
|
|
19
27
|
}
|
|
20
28
|
|
|
21
29
|
retryCount++;
|