trtc-electron-sdk 12.2.115-beta.17 → 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;
@@ -453,14 +453,20 @@ class TRTCMediaMixingManager {
453
453
  }
454
454
  else {
455
455
  this.setDisplayRect();
456
+ if (!this.mediaMixingDesigner) {
457
+ this.createDesigner();
458
+ }
456
459
  }
457
460
  }
458
461
  else {
459
462
  // Rect
463
+ this.destroyLayoutManager();
464
+ this.destroyDesigner();
460
465
  this.nodeMediaMixingPlugin.setDisplayParams(realWindowID, viewOrRegion);
461
466
  }
462
467
  }
463
468
  else {
469
+ this.destroyLayoutManager();
464
470
  this.destroyDesigner();
465
471
  this.nodeMediaMixingPlugin.setDisplayParams(realWindowID, { left: 0, right: 0, top: 0, bottom: 0 });
466
472
  }
@@ -714,7 +720,7 @@ class TRTCMediaMixingManager {
714
720
  * }
715
721
  */
716
722
  setStreamLayout(layout) {
717
- var _a, _b;
723
+ var _a, _b, _c;
718
724
  logger_1.default.log(`${this.logPrefix}setStreamLayout:`, layout);
719
725
  if (this.paramsStore) {
720
726
  try {
@@ -724,21 +730,7 @@ class TRTCMediaMixingManager {
724
730
  this.paramsStore.streamLayout = undefined;
725
731
  }
726
732
  }
727
- const context = {
728
- container: this.view,
729
- mixingVideoSize: {
730
- width: this.mixingVideoWidth,
731
- height: this.mixingVideoHeight
732
- },
733
- mediaMixingDesigner: this.mediaMixingDesigner
734
- };
735
- if (!this.streamLayoutManager) {
736
- this.streamLayoutManager = StreamLayout_1.StreamLayoutFactory.create(layout.layoutMode, this.nodeMediaMixingPlugin, context);
737
- }
738
- else if (this.streamLayoutManager.getLayoutMode() !== layout.layoutMode) {
739
- this.streamLayoutManager.destroy();
740
- this.streamLayoutManager = StreamLayout_1.StreamLayoutFactory.create(layout.layoutMode, this.nodeMediaMixingPlugin, context);
741
- }
733
+ this.createorUpdateLayoutManager(layout);
742
734
  let transferredUserList = layout.userList;
743
735
  if (this.view) {
744
736
  const viewRect = this.view.getBoundingClientRect();
@@ -772,7 +764,7 @@ class TRTCMediaMixingManager {
772
764
  else {
773
765
  logger_1.default.warn(`${this.logPrefix}setStreamLayout: view is null, no container HTML element. User control the layout manually in device pixel unit.`);
774
766
  }
775
- 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 }));
776
768
  }
777
769
  /**
778
770
  * @private
@@ -922,6 +914,29 @@ class TRTCMediaMixingManager {
922
914
  this.mediaMixingDesigner = null;
923
915
  }
924
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
+ }
925
940
  updateMixingVideoSize(params) {
926
941
  if (resolutionMap.has(params.videoResolution)) {
927
942
  const { width, height } = resolutionMap.get(params.videoResolution);
@@ -32,7 +32,7 @@ class NoneStreamLayoutManager extends BaseStreamLayoutManager_1.default {
32
32
  (_b = this.nativeStreamLayoutManager) === null || _b === void 0 ? void 0 : _b.setStreamLayout(this.layout.userList);
33
33
  }
34
34
  else {
35
- logger_1.default.error(`${this.logPrefix}setLayout context is null or no user`);
35
+ logger_1.default.error(`${this.logPrefix}refreshLayout context is null or no user`);
36
36
  }
37
37
  }
38
38
  centerLiveOwner() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "trtc-electron-sdk",
3
- "version": "12.2.115-beta.17",
3
+ "version": "12.2.115-beta.18",
4
4
  "description": "trtc electron sdk",
5
5
  "main": "./liteav/index.js",
6
6
  "types": "./liteav/index.d.ts",