trtc-electron-sdk 12.2.115-beta.16 → 12.2.115-beta.18
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.
|
@@ -393,6 +393,8 @@ export declare class TRTCMediaMixingManager implements ITRTCMediaMixingManager {
|
|
|
393
393
|
private setDisplayRect;
|
|
394
394
|
private createDesigner;
|
|
395
395
|
private destroyDesigner;
|
|
396
|
+
private createorUpdateLayoutManager;
|
|
397
|
+
private destroyLayoutManager;
|
|
396
398
|
private updateMixingVideoSize;
|
|
397
399
|
private listenDesignerEvent;
|
|
398
400
|
private unlistenDesignerEvent;
|
|
@@ -444,18 +444,29 @@ class TRTCMediaMixingManager {
|
|
|
444
444
|
this.windowID = realWindowID;
|
|
445
445
|
if (realWindowID !== 0 && viewOrRegion !== null) {
|
|
446
446
|
if (viewOrRegion instanceof HTMLElement) {
|
|
447
|
-
this.
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
447
|
+
if (this.view !== viewOrRegion) {
|
|
448
|
+
this.destroyDesigner();
|
|
449
|
+
this.view = viewOrRegion;
|
|
450
|
+
this.setDisplayRect();
|
|
451
|
+
this.initResizeObserver();
|
|
452
|
+
this.createDesigner();
|
|
453
|
+
}
|
|
454
|
+
else {
|
|
455
|
+
this.setDisplayRect();
|
|
456
|
+
if (!this.mediaMixingDesigner) {
|
|
457
|
+
this.createDesigner();
|
|
458
|
+
}
|
|
459
|
+
}
|
|
452
460
|
}
|
|
453
461
|
else {
|
|
454
462
|
// Rect
|
|
463
|
+
this.destroyLayoutManager();
|
|
464
|
+
this.destroyDesigner();
|
|
455
465
|
this.nodeMediaMixingPlugin.setDisplayParams(realWindowID, viewOrRegion);
|
|
456
466
|
}
|
|
457
467
|
}
|
|
458
468
|
else {
|
|
469
|
+
this.destroyLayoutManager();
|
|
459
470
|
this.destroyDesigner();
|
|
460
471
|
this.nodeMediaMixingPlugin.setDisplayParams(realWindowID, { left: 0, right: 0, top: 0, bottom: 0 });
|
|
461
472
|
}
|
|
@@ -709,7 +720,7 @@ class TRTCMediaMixingManager {
|
|
|
709
720
|
* }
|
|
710
721
|
*/
|
|
711
722
|
setStreamLayout(layout) {
|
|
712
|
-
var _a, _b;
|
|
723
|
+
var _a, _b, _c;
|
|
713
724
|
logger_1.default.log(`${this.logPrefix}setStreamLayout:`, layout);
|
|
714
725
|
if (this.paramsStore) {
|
|
715
726
|
try {
|
|
@@ -719,21 +730,7 @@ class TRTCMediaMixingManager {
|
|
|
719
730
|
this.paramsStore.streamLayout = undefined;
|
|
720
731
|
}
|
|
721
732
|
}
|
|
722
|
-
|
|
723
|
-
container: this.view,
|
|
724
|
-
mixingVideoSize: {
|
|
725
|
-
width: this.mixingVideoWidth,
|
|
726
|
-
height: this.mixingVideoHeight
|
|
727
|
-
},
|
|
728
|
-
mediaMixingDesigner: this.mediaMixingDesigner
|
|
729
|
-
};
|
|
730
|
-
if (!this.streamLayoutManager) {
|
|
731
|
-
this.streamLayoutManager = StreamLayout_1.StreamLayoutFactory.create(layout.layoutMode, this.nodeMediaMixingPlugin, context);
|
|
732
|
-
}
|
|
733
|
-
else if (this.streamLayoutManager.getLayoutMode() !== layout.layoutMode) {
|
|
734
|
-
this.streamLayoutManager.destroy();
|
|
735
|
-
this.streamLayoutManager = StreamLayout_1.StreamLayoutFactory.create(layout.layoutMode, this.nodeMediaMixingPlugin, context);
|
|
736
|
-
}
|
|
733
|
+
this.createorUpdateLayoutManager(layout);
|
|
737
734
|
let transferredUserList = layout.userList;
|
|
738
735
|
if (this.view) {
|
|
739
736
|
const viewRect = this.view.getBoundingClientRect();
|
|
@@ -767,7 +764,7 @@ class TRTCMediaMixingManager {
|
|
|
767
764
|
else {
|
|
768
765
|
logger_1.default.warn(`${this.logPrefix}setStreamLayout: view is null, no container HTML element. User control the layout manually in device pixel unit.`);
|
|
769
766
|
}
|
|
770
|
-
this.streamLayoutManager.setLayout(Object.assign(Object.assign({}, layout), { userList: transferredUserList }));
|
|
767
|
+
(_c = this.streamLayoutManager) === null || _c === void 0 ? void 0 : _c.setLayout(Object.assign(Object.assign({}, layout), { userList: transferredUserList }));
|
|
771
768
|
}
|
|
772
769
|
/**
|
|
773
770
|
* @private
|
|
@@ -896,6 +893,17 @@ class TRTCMediaMixingManager {
|
|
|
896
893
|
canExceedContainer: true,
|
|
897
894
|
});
|
|
898
895
|
this.listenDesignerEvent();
|
|
896
|
+
if (this.sourceList.length >= 1) {
|
|
897
|
+
this.sourceList.forEach((mediaSource => {
|
|
898
|
+
var _a;
|
|
899
|
+
(_a = this.mediaMixingDesigner) === null || _a === void 0 ? void 0 : _a.addMedia({
|
|
900
|
+
id: `${mediaSource.sourceType}__${mediaSource.sourceId}`,
|
|
901
|
+
rect: mediaSource.rect,
|
|
902
|
+
isSelected: mediaSource.isSelected || false,
|
|
903
|
+
origin: mediaSource
|
|
904
|
+
});
|
|
905
|
+
}));
|
|
906
|
+
}
|
|
899
907
|
}
|
|
900
908
|
}
|
|
901
909
|
destroyDesigner() {
|
|
@@ -906,6 +914,29 @@ class TRTCMediaMixingManager {
|
|
|
906
914
|
this.mediaMixingDesigner = null;
|
|
907
915
|
}
|
|
908
916
|
}
|
|
917
|
+
createorUpdateLayoutManager(layout) {
|
|
918
|
+
const context = {
|
|
919
|
+
container: this.view,
|
|
920
|
+
mixingVideoSize: {
|
|
921
|
+
width: this.mixingVideoWidth,
|
|
922
|
+
height: this.mixingVideoHeight
|
|
923
|
+
},
|
|
924
|
+
mediaMixingDesigner: this.mediaMixingDesigner
|
|
925
|
+
};
|
|
926
|
+
if (!this.streamLayoutManager) {
|
|
927
|
+
this.streamLayoutManager = StreamLayout_1.StreamLayoutFactory.create(layout.layoutMode, this.nodeMediaMixingPlugin, context);
|
|
928
|
+
}
|
|
929
|
+
else if (this.streamLayoutManager.getLayoutMode() !== layout.layoutMode) {
|
|
930
|
+
this.streamLayoutManager.destroy();
|
|
931
|
+
this.streamLayoutManager = StreamLayout_1.StreamLayoutFactory.create(layout.layoutMode, this.nodeMediaMixingPlugin, context);
|
|
932
|
+
}
|
|
933
|
+
}
|
|
934
|
+
destroyLayoutManager() {
|
|
935
|
+
if (this.streamLayoutManager) {
|
|
936
|
+
this.streamLayoutManager.destroy();
|
|
937
|
+
this.streamLayoutManager = null;
|
|
938
|
+
}
|
|
939
|
+
}
|
|
909
940
|
updateMixingVideoSize(params) {
|
|
910
941
|
if (resolutionMap.has(params.videoResolution)) {
|
|
911
942
|
const { width, height } = resolutionMap.get(params.videoResolution);
|
|
@@ -17,13 +17,22 @@ class NoneStreamLayoutManager extends BaseStreamLayoutManager_1.default {
|
|
|
17
17
|
this.refreshLayout();
|
|
18
18
|
}
|
|
19
19
|
refreshLayout() {
|
|
20
|
-
var _a;
|
|
20
|
+
var _a, _b;
|
|
21
21
|
if (this.context && this.layout.userList) {
|
|
22
22
|
this.centerLiveOwner();
|
|
23
|
-
(
|
|
23
|
+
if (this.layout.userList.length === 1 && this.layout.userList[0].rect && this.displayArea.width !== 0 && this.displayArea.height !== 0 && window.devicePixelRatio !== 0) {
|
|
24
|
+
const workingArea = this.layout.userList[0].rect;
|
|
25
|
+
(_a = this.context.mediaMixingDesigner) === null || _a === void 0 ? void 0 : _a.setWorkingArea({
|
|
26
|
+
left: workingArea.left / this.displayArea.width / window.devicePixelRatio,
|
|
27
|
+
top: workingArea.top / this.displayArea.height / window.devicePixelRatio,
|
|
28
|
+
right: workingArea.right / this.displayArea.width / window.devicePixelRatio,
|
|
29
|
+
bottom: workingArea.bottom / this.displayArea.height / window.devicePixelRatio,
|
|
30
|
+
}, this.layout.userList[0].fillMode);
|
|
31
|
+
}
|
|
32
|
+
(_b = this.nativeStreamLayoutManager) === null || _b === void 0 ? void 0 : _b.setStreamLayout(this.layout.userList);
|
|
24
33
|
}
|
|
25
34
|
else {
|
|
26
|
-
logger_1.default.error(`${this.logPrefix}
|
|
35
|
+
logger_1.default.error(`${this.logPrefix}refreshLayout context is null or no user`);
|
|
27
36
|
}
|
|
28
37
|
}
|
|
29
38
|
centerLiveOwner() {
|