trtc-electron-sdk 12.2.115-beta.16 → 12.2.115-beta.17

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.
@@ -444,11 +444,16 @@ class TRTCMediaMixingManager {
444
444
  this.windowID = realWindowID;
445
445
  if (realWindowID !== 0 && viewOrRegion !== null) {
446
446
  if (viewOrRegion instanceof HTMLElement) {
447
- this.destroyDesigner();
448
- this.view = viewOrRegion;
449
- this.setDisplayRect();
450
- this.initResizeObserver();
451
- this.createDesigner();
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
+ }
452
457
  }
453
458
  else {
454
459
  // Rect
@@ -896,6 +901,17 @@ class TRTCMediaMixingManager {
896
901
  canExceedContainer: true,
897
902
  });
898
903
  this.listenDesignerEvent();
904
+ if (this.sourceList.length >= 1) {
905
+ this.sourceList.forEach((mediaSource => {
906
+ var _a;
907
+ (_a = this.mediaMixingDesigner) === null || _a === void 0 ? void 0 : _a.addMedia({
908
+ id: `${mediaSource.sourceType}__${mediaSource.sourceId}`,
909
+ rect: mediaSource.rect,
910
+ isSelected: mediaSource.isSelected || false,
911
+ origin: mediaSource
912
+ });
913
+ }));
914
+ }
899
915
  }
900
916
  }
901
917
  destroyDesigner() {
@@ -17,10 +17,19 @@ 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
- (_a = this.nativeStreamLayoutManager) === null || _a === void 0 ? void 0 : _a.setStreamLayout(this.layout.userList);
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
35
  logger_1.default.error(`${this.logPrefix}setLayout context is null or no user`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "trtc-electron-sdk",
3
- "version": "12.2.115-beta.16",
3
+ "version": "12.2.115-beta.17",
4
4
  "description": "trtc electron sdk",
5
5
  "main": "./liteav/index.js",
6
6
  "types": "./liteav/index.d.ts",