trtc-electron-sdk 13.4.802-beta.0 → 13.4.802-beta.2

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.
@@ -1,4 +1,5 @@
1
1
  import { TRTCCameraCaptureParams, Rect, TRTCScreenCaptureProperty } from '../../trtc_define';
2
+ import TRTCPluginManager from '../PluginManager';
2
3
  import { TRTCMediaSource, TRTCMediaMixingEncParam, ITRTCMediaMixingManager, TRTCPhoneMirrorParam, TRTCStreamLayout, TRTCOnlineVideoParam, TRTCVideoFileParam } from './types';
3
4
  import { TRTCDeviceManager } from '../DeviceManager';
4
5
  declare const NodeTRTCEngine: any;
@@ -140,6 +141,7 @@ export declare class TRTCMediaMixingManager implements ITRTCMediaMixingManager {
140
141
  private streamLayoutManager;
141
142
  private trtcParamsStore;
142
143
  private paramsStore;
144
+ private pluginManager;
143
145
  private autoControlServer;
144
146
  private serverStatus;
145
147
  private serverMode;
@@ -154,6 +156,7 @@ export declare class TRTCMediaMixingManager implements ITRTCMediaMixingManager {
154
156
  nodeTRTCCloud: typeof NodeTRTCEngine.NodeRemoteTRTCCloud;
155
157
  trtcParamsStore: Record<string, any>;
156
158
  autoControlServer: boolean;
159
+ pluginManager: TRTCPluginManager;
157
160
  });
158
161
  destroy(): Promise<void>;
159
162
  /**
@@ -535,6 +538,54 @@ export declare class TRTCMediaMixingManager implements ITRTCMediaMixingManager {
535
538
  private previewInNativeWindow;
536
539
  private previewInWebElement;
537
540
  private previewInNone;
541
+ /**
542
+ * @private
543
+ * Ensure the media server is running in the mode required by the current
544
+ * preview target, before doing any preview binding.
545
+ *
546
+ * - Native-window preview -> Independent server (out-of-process, comes
547
+ * with onMediaServerState crash monitoring & auto-recovery).
548
+ * - Web-element preview -> Embedded server (in-process) that drives
549
+ * the video-frame render callback.
550
+ *
551
+ * The decision is driven by `serverStatus` (the single source of truth),
552
+ * NOT by `serverMode`. `serverMode` only reflects the mode of a *running*
553
+ * server and becomes meaningless once the server is stopped (Idle), where
554
+ * it keeps its last value. Keying the switch on `serverStatus` avoids that
555
+ * stale-value trap:
556
+ *
557
+ * - running (Started/Starting) in a different mode -> stop then restart in
558
+ * the required mode (mode switch).
559
+ * - running already in the required mode -> no-op.
560
+ * - Idle (e.g. after stopMediaMixingServer on logout) -> (re)start in the
561
+ * required mode. Without this, a logout -> login cycle would leave no
562
+ * monitored server, so a later crash of liteav_media_server.exe emits no
563
+ * state=3 event and neither the SDK's built-in recovery nor the app-layer
564
+ * recovery runs.
565
+ *
566
+ * `Lost` handling depends on autoControlServer, so the two recovery paths
567
+ * never overlap / race:
568
+ *
569
+ * - autoControlServer = true (getMediaMixingManager): the SDK owns crash
570
+ * recovery via onMediaServerState(state=3) -> recoverMediaMixingServer,
571
+ * which restarts the server AND re-binds the preview itself. We must NOT
572
+ * also restart here, otherwise a concurrent app-driven bindPreviewArea
573
+ * would double-start the server and race the built-in recovery. So when
574
+ * autoControlServer is true, `Lost` is intentionally left untouched here.
575
+ *
576
+ * - autoControlServer = false (getMediaMixingService): the SDK does NOT
577
+ * auto-recover (onMediaMixingServerLost only clears local state); the app
578
+ * is expected to drive recovery by calling bindPreviewArea again. In that
579
+ * case a `Lost` server must be (re)started here, exactly like `Idle`,
580
+ * otherwise the app's re-bind would silently do nothing and the preview
581
+ * would never come back.
582
+ *
583
+ * Safe against the first-launch path: startMediaMixingServer sets
584
+ * serverStatus to Starting synchronously, and the constructor's embedded
585
+ * auto-start runs before any bindPreviewArea, so the first bind never
586
+ * observes Idle here.
587
+ */
588
+ private ensureMediaServerMode;
538
589
  private createWebRenderer;
539
590
  private destroyWebRenderer;
540
591
  private createWebRendererBuffer;
@@ -357,6 +357,7 @@ class TRTCMediaMixingManager {
357
357
  this.nodeTRTCCloud = options.nodeTRTCCloud;
358
358
  this.trtcParamsStore = options.trtcParamsStore;
359
359
  this.autoControlServer = options.autoControlServer;
360
+ this.pluginManager = options.pluginManager;
360
361
  this.paramsStore = {};
361
362
  this.previewRenderParams = {
362
363
  fillMode: trtc_define_1.TRTCVideoFillMode.TRTCVideoFillMode_Fit,
@@ -432,6 +433,8 @@ class TRTCMediaMixingManager {
432
433
  this.addMediaSourceTimers.clear();
433
434
  this.paramsStore = null;
434
435
  this.trtcParamsStore = null;
436
+ // 仅解除引用,pluginManager 生命周期由 TRTCCloud 统一管理
437
+ this.pluginManager = null;
435
438
  });
436
439
  }
437
440
  /**
@@ -1487,43 +1490,71 @@ class TRTCMediaMixingManager {
1487
1490
  else {
1488
1491
  this.sourceList = [];
1489
1492
  (_a = this.mediaMixingDesigner) === null || _a === void 0 ? void 0 : _a.removeAllMedia();
1490
- (_b = this.eventEmitter) === null || _b === void 0 ? void 0 : _b.emit(TRTCMediaMixingEvent.onMediaMixingServerLost);
1491
1493
  }
1494
+ // Notify the application layer AFTER the internal recovery/cleanup finishes,
1495
+ // regardless of autoControlServer mode. This lets the app perform extra
1496
+ // recovery on top of the SDK's built-in one (e.g. re-applying beauty /
1497
+ // xmagic effect plugins, which the SDK does not restore). Note
1498
+ // recoverMediaMixingServer swallows its own errors, so this emit is always
1499
+ // reached once server-lost handling completes.
1500
+ (_b = this.eventEmitter) === null || _b === void 0 ? void 0 : _b.emit(TRTCMediaMixingEvent.onMediaMixingServerLost);
1492
1501
  });
1493
1502
  }
1494
1503
  onCallExperimentalAPIFinish(data) {
1495
1504
  logger_1.default.log(`${this.logPrefix}onCallExperimentalAPIFinish:`, data);
1496
1505
  }
1497
1506
  recoverMediaMixingServer() {
1498
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
1507
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
1499
1508
  return __awaiter(this, void 0, void 0, function* () {
1500
1509
  if (!this.view) {
1501
1510
  return;
1502
1511
  }
1503
1512
  try {
1504
- yield this.startMediaMixingServer();
1513
+ // Restart the server in the SAME mode as the pre-crash preview target,
1514
+ // derived from windowID the same way bindPreviewArea dispatches:
1515
+ // - windowID !== 0 -> native-window preview -> Independent
1516
+ // - windowID === 0 -> web-element preview -> Embedded
1517
+ // Using the matching mode here makes the subsequent bindPreviewArea ->
1518
+ // ensureMediaServerMode a no-op (server already running in the right
1519
+ // mode), avoiding an extra stop/start process bounce and a transient
1520
+ // window running in the wrong mode. Previously this hardcoded the default
1521
+ // (Independent), so recovering a web-element (Embedded) preview would
1522
+ // start Independent and then immediately stop+restart as Embedded.
1523
+ const recoverMode = this.windowID !== 0
1524
+ ? TRTCMediaMixingServerMode.Independent
1525
+ : TRTCMediaMixingServerMode.Embedded;
1526
+ yield this.startMediaMixingServer('', recoverMode);
1505
1527
  yield this.bindPreviewArea(this.windowID, this.view);
1506
1528
  yield this.startPublish();
1507
1529
  yield this.nodeMediaMixingPlugin.updatePublishParams(this.publishParams);
1508
- if ((_a = this.paramsStore) === null || _a === void 0 ? void 0 : _a.streamLayout) {
1530
+ // 混流服务崩溃重启后,底层 NodeRemoteVideoPluginManager 为全新初始状态,
1531
+ // 需要重放之前通过 setPluginParams 设置的插件参数。
1532
+ const pluginManager = this.pluginManager;
1533
+ const pluginParams = (_a = this.trtcParamsStore) === null || _a === void 0 ? void 0 : _a.pluginParams;
1534
+ if (pluginManager && pluginParams) {
1535
+ Object.keys(pluginParams).forEach((typeKey) => {
1536
+ pluginManager.setPluginParams(Number(typeKey), pluginParams[typeKey]);
1537
+ });
1538
+ }
1539
+ if ((_b = this.paramsStore) === null || _b === void 0 ? void 0 : _b.streamLayout) {
1509
1540
  this.setStreamLayout(this.paramsStore.streamLayout);
1510
1541
  }
1511
1542
  this.sourceList.forEach((item) => {
1512
1543
  this._applyCameraParamsBeforeAdd(item);
1513
1544
  this.nodeMediaMixingPlugin.addMediaSource(item);
1514
1545
  });
1515
- if (((_b = this.trtcParamsStore) === null || _b === void 0 ? void 0 : _b.enterRoomParams) && ((_c = this.trtcParamsStore) === null || _c === void 0 ? void 0 : _c.enterRoomScene)) {
1546
+ if (((_c = this.trtcParamsStore) === null || _c === void 0 ? void 0 : _c.enterRoomParams) && ((_d = this.trtcParamsStore) === null || _d === void 0 ? void 0 : _d.enterRoomScene)) {
1516
1547
  this.nodeTRTCCloud.enterRoom(this.trtcParamsStore.enterRoomParams, this.trtcParamsStore.enterRoomScene);
1517
1548
  }
1518
- if ((_d = this.trtcParamsStore) === null || _d === void 0 ? void 0 : _d.localAudioParams) {
1519
- if ((_e = this.trtcParamsStore) === null || _e === void 0 ? void 0 : _e.localAudioParams.audioQuality) {
1520
- this.nodeTRTCCloud.startLocalAudio((_f = this.trtcParamsStore) === null || _f === void 0 ? void 0 : _f.localAudioParams.audioQuality);
1549
+ if ((_e = this.trtcParamsStore) === null || _e === void 0 ? void 0 : _e.localAudioParams) {
1550
+ if ((_f = this.trtcParamsStore) === null || _f === void 0 ? void 0 : _f.localAudioParams.audioQuality) {
1551
+ this.nodeTRTCCloud.startLocalAudio((_g = this.trtcParamsStore) === null || _g === void 0 ? void 0 : _g.localAudioParams.audioQuality);
1521
1552
  }
1522
- if (((_g = this.trtcParamsStore) === null || _g === void 0 ? void 0 : _g.localAudioParams.isMute) !== undefined) {
1553
+ if (((_h = this.trtcParamsStore) === null || _h === void 0 ? void 0 : _h.localAudioParams.isMute) !== undefined) {
1523
1554
  this.nodeTRTCCloud.muteLocalAudio(this.trtcParamsStore.localAudioParams.isMute);
1524
1555
  }
1525
1556
  }
1526
- if ((_h = this.trtcParamsStore) === null || _h === void 0 ? void 0 : _h.systemAudioParams) {
1557
+ if ((_j = this.trtcParamsStore) === null || _j === void 0 ? void 0 : _j.systemAudioParams) {
1527
1558
  if (this.trtcParamsStore.systemAudioParams.isOpen) {
1528
1559
  this.nodeTRTCCloud.startSystemAudioLoopback(this.trtcParamsStore.systemAudioParams.path || null);
1529
1560
  }
@@ -1531,9 +1562,9 @@ class TRTCMediaMixingManager {
1531
1562
  this.nodeTRTCCloud.setSystemAudioLoopbackVolume(this.trtcParamsStore.systemAudioParams.volume);
1532
1563
  }
1533
1564
  }
1534
- if (typeof ((_j = this.trtcParamsStore) === null || _j === void 0 ? void 0 : _j.audioVolumeEvaluationInterval) === 'number') {
1535
- const isEnabled = ((_k = this.trtcParamsStore) === null || _k === void 0 ? void 0 : _k.audioVolumeEvaluationInterval) > 0;
1536
- const interval = ((_l = this.trtcParamsStore) === null || _l === void 0 ? void 0 : _l.audioVolumeEvaluationInterval) > 0 ? (_m = this.trtcParamsStore) === null || _m === void 0 ? void 0 : _m.audioVolumeEvaluationInterval : 0;
1565
+ if (typeof ((_k = this.trtcParamsStore) === null || _k === void 0 ? void 0 : _k.audioVolumeEvaluationInterval) === 'number') {
1566
+ const isEnabled = ((_l = this.trtcParamsStore) === null || _l === void 0 ? void 0 : _l.audioVolumeEvaluationInterval) > 0;
1567
+ const interval = ((_m = this.trtcParamsStore) === null || _m === void 0 ? void 0 : _m.audioVolumeEvaluationInterval) > 0 ? (_o = this.trtcParamsStore) === null || _o === void 0 ? void 0 : _o.audioVolumeEvaluationInterval : 0;
1537
1568
  this.nodeTRTCCloud.enableAudioVolumeEvaluation(isEnabled, {
1538
1569
  enableSpectrumCalculation: isEnabled,
1539
1570
  enableVadDetection: true,
@@ -1654,15 +1685,12 @@ class TRTCMediaMixingManager {
1654
1685
  previewInNativeWindow(viewOrRegion) {
1655
1686
  var _a;
1656
1687
  return __awaiter(this, void 0, void 0, function* () {
1657
- if (this.serverMode === TRTCMediaMixingServerMode.Embedded && (this.serverStatus === TRTCMediaMixingServerStatus.Started || this.serverStatus === TRTCMediaMixingServerStatus.Starting)) {
1658
- try {
1659
- yield this.stopMediaMixingServer();
1660
- yield this.startMediaMixingServer('', TRTCMediaMixingServerMode.Independent);
1661
- }
1662
- catch (err) {
1663
- logger_1.default.error(`${this.logPrefix}previewInNativeWindow startMediaMixingServer failed:`, err);
1664
- throw err;
1665
- }
1688
+ try {
1689
+ yield this.ensureMediaServerMode(TRTCMediaMixingServerMode.Independent);
1690
+ }
1691
+ catch (err) {
1692
+ logger_1.default.error(`${this.logPrefix}previewInNativeWindow ensureMediaServerMode failed:`, err);
1693
+ throw err;
1666
1694
  }
1667
1695
  if (viewOrRegion instanceof HTMLElement) {
1668
1696
  if (this.view !== viewOrRegion) {
@@ -1695,15 +1723,12 @@ class TRTCMediaMixingManager {
1695
1723
  previewInWebElement(viewOrRegion) {
1696
1724
  var _a;
1697
1725
  return __awaiter(this, void 0, void 0, function* () {
1698
- if (this.serverMode === TRTCMediaMixingServerMode.Independent && (this.serverStatus === TRTCMediaMixingServerStatus.Started || this.serverStatus === TRTCMediaMixingServerStatus.Starting)) {
1699
- try {
1700
- yield this.stopMediaMixingServer();
1701
- yield this.startMediaMixingServer('', TRTCMediaMixingServerMode.Embedded);
1702
- }
1703
- catch (err) {
1704
- logger_1.default.error(`${this.logPrefix}previewInWebElement startMediaMixingServer failed:`, err);
1705
- throw err;
1706
- }
1726
+ try {
1727
+ yield this.ensureMediaServerMode(TRTCMediaMixingServerMode.Embedded);
1728
+ }
1729
+ catch (err) {
1730
+ logger_1.default.error(`${this.logPrefix}previewInWebElement ensureMediaServerMode failed:`, err);
1731
+ throw err;
1707
1732
  }
1708
1733
  if (viewOrRegion instanceof HTMLElement) {
1709
1734
  if (this.view !== viewOrRegion) {
@@ -1744,6 +1769,73 @@ class TRTCMediaMixingManager {
1744
1769
  this.paramsStore.streamLayout = null;
1745
1770
  }
1746
1771
  }
1772
+ /**
1773
+ * @private
1774
+ * Ensure the media server is running in the mode required by the current
1775
+ * preview target, before doing any preview binding.
1776
+ *
1777
+ * - Native-window preview -> Independent server (out-of-process, comes
1778
+ * with onMediaServerState crash monitoring & auto-recovery).
1779
+ * - Web-element preview -> Embedded server (in-process) that drives
1780
+ * the video-frame render callback.
1781
+ *
1782
+ * The decision is driven by `serverStatus` (the single source of truth),
1783
+ * NOT by `serverMode`. `serverMode` only reflects the mode of a *running*
1784
+ * server and becomes meaningless once the server is stopped (Idle), where
1785
+ * it keeps its last value. Keying the switch on `serverStatus` avoids that
1786
+ * stale-value trap:
1787
+ *
1788
+ * - running (Started/Starting) in a different mode -> stop then restart in
1789
+ * the required mode (mode switch).
1790
+ * - running already in the required mode -> no-op.
1791
+ * - Idle (e.g. after stopMediaMixingServer on logout) -> (re)start in the
1792
+ * required mode. Without this, a logout -> login cycle would leave no
1793
+ * monitored server, so a later crash of liteav_media_server.exe emits no
1794
+ * state=3 event and neither the SDK's built-in recovery nor the app-layer
1795
+ * recovery runs.
1796
+ *
1797
+ * `Lost` handling depends on autoControlServer, so the two recovery paths
1798
+ * never overlap / race:
1799
+ *
1800
+ * - autoControlServer = true (getMediaMixingManager): the SDK owns crash
1801
+ * recovery via onMediaServerState(state=3) -> recoverMediaMixingServer,
1802
+ * which restarts the server AND re-binds the preview itself. We must NOT
1803
+ * also restart here, otherwise a concurrent app-driven bindPreviewArea
1804
+ * would double-start the server and race the built-in recovery. So when
1805
+ * autoControlServer is true, `Lost` is intentionally left untouched here.
1806
+ *
1807
+ * - autoControlServer = false (getMediaMixingService): the SDK does NOT
1808
+ * auto-recover (onMediaMixingServerLost only clears local state); the app
1809
+ * is expected to drive recovery by calling bindPreviewArea again. In that
1810
+ * case a `Lost` server must be (re)started here, exactly like `Idle`,
1811
+ * otherwise the app's re-bind would silently do nothing and the preview
1812
+ * would never come back.
1813
+ *
1814
+ * Safe against the first-launch path: startMediaMixingServer sets
1815
+ * serverStatus to Starting synchronously, and the constructor's embedded
1816
+ * auto-start runs before any bindPreviewArea, so the first bind never
1817
+ * observes Idle here.
1818
+ */
1819
+ ensureMediaServerMode(targetMode) {
1820
+ return __awaiter(this, void 0, void 0, function* () {
1821
+ const isRunning = this.serverStatus === TRTCMediaMixingServerStatus.Started
1822
+ || this.serverStatus === TRTCMediaMixingServerStatus.Starting;
1823
+ // `Lost` is treated as "needs (re)start" ONLY when the SDK's own auto
1824
+ // recovery is disabled (autoControlServer=false); otherwise it is owned by
1825
+ // recoverMediaMixingServer and must not be touched here (see doc above).
1826
+ const needsStart = this.serverStatus === TRTCMediaMixingServerStatus.Idle
1827
+ || (this.serverStatus === TRTCMediaMixingServerStatus.Lost && !this.autoControlServer);
1828
+ if (isRunning) {
1829
+ if (this.serverMode !== targetMode) {
1830
+ yield this.stopMediaMixingServer();
1831
+ yield this.startMediaMixingServer('', targetMode);
1832
+ }
1833
+ }
1834
+ else if (needsStart) {
1835
+ yield this.startMediaMixingServer('', targetMode);
1836
+ }
1837
+ });
1838
+ }
1747
1839
  createWebRenderer(view) {
1748
1840
  if (this.view === view) {
1749
1841
  return;
@@ -1773,7 +1865,7 @@ class TRTCMediaMixingManager {
1773
1865
  });
1774
1866
  this.webRenderer.setContentMode(this.previewRenderParams.fillMode);
1775
1867
  this.createWebRendererBuffer();
1776
- this.nodeMediaMixingPlugin.setVideoFrameRenderCallback(this.webRendererCallback); // this.pixelFormat,
1868
+ this.nodeMediaMixingPlugin.setVideoFrameRenderCallback(this.webRendererCallback); // this.pixelFormat,
1777
1869
  }
1778
1870
  }
1779
1871
  destroyWebRenderer() {
@@ -1781,7 +1873,7 @@ class TRTCMediaMixingManager {
1781
1873
  this.webRenderer.destroy();
1782
1874
  this.webRenderer = null;
1783
1875
  }
1784
- this.nodeMediaMixingPlugin.setVideoFrameRenderCallback(null); // this.pixelFormat,
1876
+ this.nodeMediaMixingPlugin.setVideoFrameRenderCallback(null); // this.pixelFormat,
1785
1877
  this.destroyWebRendererBuffer();
1786
1878
  }
1787
1879
  createWebRendererBuffer() {
package/liteav/trtc.d.ts CHANGED
@@ -2774,7 +2774,7 @@ declare class TRTCCloud extends EventEmitter implements ITRTCCloud {
2774
2774
  * @param {String} params.userSig - 用户签名
2775
2775
  * @param {Number} params.expectedUpBandwidth - 预期的上行带宽(kbps,取值范围: 10 ~ 5000,为 0 时不测试)。
2776
2776
  * @param {Number} params.expectedDownBandwidth - 预期的下行带宽(kbps,取值范围: 10 ~ 5000,为 0 时不测试)。
2777
- * @param {Number} params.scene - 测速场景
2777
+ * @param {TRTCSpeedTestScene} params.scene - 测速场景
2778
2778
  *
2779
2779
  * @return 接口调用结果,< 0:失败
2780
2780
  */
package/liteav/trtc.js CHANGED
@@ -4633,7 +4633,7 @@ class TRTCCloud extends events_1.EventEmitter {
4633
4633
  * @param {String} params.userSig - 用户签名
4634
4634
  * @param {Number} params.expectedUpBandwidth - 预期的上行带宽(kbps,取值范围: 10 ~ 5000,为 0 时不测试)。
4635
4635
  * @param {Number} params.expectedDownBandwidth - 预期的下行带宽(kbps,取值范围: 10 ~ 5000,为 0 时不测试)。
4636
- * @param {Number} params.scene - 测速场景
4636
+ * @param {TRTCSpeedTestScene} params.scene - 测速场景
4637
4637
  *
4638
4638
  * @return 接口调用结果,< 0:失败
4639
4639
  */
@@ -4644,7 +4644,7 @@ class TRTCCloud extends events_1.EventEmitter {
4644
4644
  if (userId !== undefined && userSig !== undefined) {
4645
4645
  const sdkAppId = params;
4646
4646
  const speedTestParams = new trtc_define_1.TRTCSpeedTestParams(sdkAppId, userId, userSig);
4647
- return this.rtcCloud.startSpeedTest(params);
4647
+ return this.rtcCloud.startSpeedTest(speedTestParams);
4648
4648
  }
4649
4649
  this.logger.error('startSpeedTest, param is error');
4650
4650
  return -1;
@@ -4939,6 +4939,9 @@ class TRTCCloud extends events_1.EventEmitter {
4939
4939
  setPluginParams(type, options) {
4940
4940
  this.logger.log(`setPluginParams params:`, type, options);
4941
4941
  this.pluginManager.setPluginParams(type, options);
4942
+ // 记录插件参数,用于本地混流服务崩溃恢复时重放(合并写入,兼容分次只传 pixelFormat 或 enable 的调用)
4943
+ this.paramsStore.pluginParams = this.paramsStore.pluginParams || {};
4944
+ this.paramsStore.pluginParams[type] = Object.assign(Object.assign({}, (this.paramsStore.pluginParams[type] || {})), options);
4942
4945
  }
4943
4946
  /**
4944
4947
  * 添加插件
@@ -5568,6 +5571,7 @@ class TRTCCloud extends events_1.EventEmitter {
5568
5571
  nodeTRTCCloud: this.rtcCloud,
5569
5572
  trtcParamsStore: this.paramsStore,
5570
5573
  autoControlServer: true,
5574
+ pluginManager: this.pluginManager,
5571
5575
  });
5572
5576
  }
5573
5577
  }
@@ -5617,6 +5621,7 @@ class TRTCCloud extends events_1.EventEmitter {
5617
5621
  nodeTRTCCloud: this.rtcCloud,
5618
5622
  trtcParamsStore: this.paramsStore,
5619
5623
  autoControlServer: false,
5624
+ pluginManager: this.pluginManager,
5620
5625
  });
5621
5626
  this.mediaMixingService = new MediaMixingManager_1.TRTCMediaMixingService(this.mediaMixingManager);
5622
5627
  }
@@ -120,6 +120,11 @@ export declare enum TRTCAudioQuality {
120
120
  TRTCAudioQualityDefault = 2,
121
121
  TRTCAudioQualityMusic = 3
122
122
  }
123
+ export declare enum TRTCSpeedTestScene {
124
+ TRTCSpeedTestScene_DelayTesting = 1,
125
+ TRTCSpeedTestScene_DelayAndBandwidthTesting = 2,
126
+ TRTCSpeedTestScene_OnlineChorusTesting = 3
127
+ }
123
128
  /**
124
129
  * 图缓存
125
130
  *
@@ -488,6 +493,7 @@ export declare class TRTCVolumeInfo {
488
493
  * @param {String} userSig - 用户签名
489
494
  * @param {Number} expectedUpBandwidth - 预期的上行带宽(kbps,取值范围: 10 ~ 5000,为 0 时不测试)。
490
495
  * @param {Number} expectedDownBandwidth - 预期的下行带宽(kbps,取值范围: 10 ~ 5000,为 0 时不测试)。
496
+ * @param {TRTCSpeedTestScene} scene - 测速场景。仅当 scene 为 TRTCSpeedTestScene_DelayAndBandwidthTesting 或 TRTCSpeedTestScene_OnlineChorusTesting 时才会测试上下行带宽(availableUpBandwidth / availableDownBandwidth)。默认 TRTCSpeedTestScene_DelayAndBandwidthTesting。
491
497
  */
492
498
  export declare class TRTCSpeedTestParams {
493
499
  sdkAppId: number;
@@ -495,7 +501,8 @@ export declare class TRTCSpeedTestParams {
495
501
  userSig: string;
496
502
  expectedUpBandwidth: number;
497
503
  expectedDownBandwidth: number;
498
- constructor(sdkAppId?: number, userId?: string, userSig?: string, expectedUpBandwidth?: number, expectedDownBandwidth?: number);
504
+ scene: TRTCSpeedTestScene;
505
+ constructor(sdkAppId?: number, userId?: string, userSig?: string, expectedUpBandwidth?: number, expectedDownBandwidth?: number, scene?: TRTCSpeedTestScene);
499
506
  }
500
507
  /**
501
508
  * 网络测速结果
@@ -6,8 +6,8 @@
6
6
  *
7
7
  */
8
8
  Object.defineProperty(exports, "__esModule", { value: true });
9
- exports.TRTCTranscodingConfig = exports.TRTCPluginType = exports.TRTCVoiceChangerType = exports.TRTCVoiceReverbType = exports.TRTCPublishMode = exports.TRTCAudioRecordingContent = exports.TRTCMixInputType = exports.TRTCTranscodingConfigMode = exports.TRTCMixUser = exports.Rect = exports.TRTCSpeedTestResult = exports.TRTCSpeedTestParams = exports.TRTCVolumeInfo = exports.TRTCQualityInfo = exports.TRTCNetworkQosParam = exports.TRTCRenderParams = exports.TRTCVideoEncParam = exports.TRTCParams = exports.TRTCWaterMarkSrcType = exports.TRTCVideoEncodeComplexity = exports.TRTCVideoColorSpace = exports.TRTCVideoColorRange = exports.TRTCCameraCaptureMode = exports.TRTCDeviceType = exports.TRTCDeviceState = exports.TRTCLogLevel = exports.TRTCAudioFrame = exports.TRTCVideoFrame = exports.TRTCDeviceInfo = exports.TRTCScreenCaptureProperty = exports.TRTCScreenCaptureSourceInfo = exports.TRTCImageBuffer = exports.TRTCAudioQuality = exports.TRTCScreenCaptureSourceType = exports.TRTCAudioFrameFormat = exports.TRTCVideoQosPreference = exports.TRTCQosControlMode = exports.TRTCRoleType = exports.TRTCAppScene = exports.TRTCRecordType = exports.TRTCVideoMirrorType = exports.TRTCVideoBufferType = exports.TRTCVideoPixelFormat = exports.TRTCBeautyStyle = exports.TRTCVideoRotation = exports.TRTCVideoFillMode = exports.TRTCQuality = exports.TRTCVideoStreamType = exports.TRTCVideoResolutionMode = exports.TRTCVideoResolution = void 0;
10
- exports.VideoBufferInfo = exports.TRTCSwitchRoomParam = exports.AudioMusicParam = exports.TRTCStatistics = exports.TRTCRemoteStatistics = exports.TRTCLocalStatistics = exports.TRTCAudioEffectParam = exports.TRTCAudioRecordingParams = exports.TRTCPublishCDNParam = void 0;
9
+ exports.TRTCPluginType = exports.TRTCVoiceChangerType = exports.TRTCVoiceReverbType = exports.TRTCPublishMode = exports.TRTCAudioRecordingContent = exports.TRTCMixInputType = exports.TRTCTranscodingConfigMode = exports.TRTCMixUser = exports.Rect = exports.TRTCSpeedTestResult = exports.TRTCSpeedTestParams = exports.TRTCVolumeInfo = exports.TRTCQualityInfo = exports.TRTCNetworkQosParam = exports.TRTCRenderParams = exports.TRTCVideoEncParam = exports.TRTCParams = exports.TRTCWaterMarkSrcType = exports.TRTCVideoEncodeComplexity = exports.TRTCVideoColorSpace = exports.TRTCVideoColorRange = exports.TRTCCameraCaptureMode = exports.TRTCDeviceType = exports.TRTCDeviceState = exports.TRTCLogLevel = exports.TRTCAudioFrame = exports.TRTCVideoFrame = exports.TRTCDeviceInfo = exports.TRTCScreenCaptureProperty = exports.TRTCScreenCaptureSourceInfo = exports.TRTCImageBuffer = exports.TRTCSpeedTestScene = exports.TRTCAudioQuality = exports.TRTCScreenCaptureSourceType = exports.TRTCAudioFrameFormat = exports.TRTCVideoQosPreference = exports.TRTCQosControlMode = exports.TRTCRoleType = exports.TRTCAppScene = exports.TRTCRecordType = exports.TRTCVideoMirrorType = exports.TRTCVideoBufferType = exports.TRTCVideoPixelFormat = exports.TRTCBeautyStyle = exports.TRTCVideoRotation = exports.TRTCVideoFillMode = exports.TRTCQuality = exports.TRTCVideoStreamType = exports.TRTCVideoResolutionMode = exports.TRTCVideoResolution = void 0;
10
+ exports.VideoBufferInfo = exports.TRTCSwitchRoomParam = exports.AudioMusicParam = exports.TRTCStatistics = exports.TRTCRemoteStatistics = exports.TRTCLocalStatistics = exports.TRTCAudioEffectParam = exports.TRTCAudioRecordingParams = exports.TRTCPublishCDNParam = exports.TRTCTranscodingConfig = void 0;
11
11
  const util_1 = require("./Renderer/util");
12
12
  /////////////////////////////////////////////////////////////////////////////////
13
13
  //
@@ -523,6 +523,27 @@ var TRTCAudioQuality;
523
523
  TRTCAudioQuality[TRTCAudioQuality["TRTCAudioQualityDefault"] = 2] = "TRTCAudioQualityDefault";
524
524
  TRTCAudioQuality[TRTCAudioQuality["TRTCAudioQualityMusic"] = 3] = "TRTCAudioQualityMusic";
525
525
  })(TRTCAudioQuality = exports.TRTCAudioQuality || (exports.TRTCAudioQuality = {}));
526
+ /**
527
+ * 测速场景
528
+ *
529
+ * @enum {Number}
530
+ *
531
+ * 该枚举类型用于测速场景选择。
532
+ */
533
+ const TRTCSpeedTestScene_HACK_JSDOC = {
534
+ /** 延迟测试。 */
535
+ TRTCSpeedTestScene_DelayTesting: 1,
536
+ /** 延迟与带宽测试。 */
537
+ TRTCSpeedTestScene_DelayAndBandwidthTesting: 2,
538
+ /** 在线合唱测试。 */
539
+ TRTCSpeedTestScene_OnlineChorusTesting: 3,
540
+ };
541
+ var TRTCSpeedTestScene;
542
+ (function (TRTCSpeedTestScene) {
543
+ TRTCSpeedTestScene[TRTCSpeedTestScene["TRTCSpeedTestScene_DelayTesting"] = 1] = "TRTCSpeedTestScene_DelayTesting";
544
+ TRTCSpeedTestScene[TRTCSpeedTestScene["TRTCSpeedTestScene_DelayAndBandwidthTesting"] = 2] = "TRTCSpeedTestScene_DelayAndBandwidthTesting";
545
+ TRTCSpeedTestScene[TRTCSpeedTestScene["TRTCSpeedTestScene_OnlineChorusTesting"] = 3] = "TRTCSpeedTestScene_OnlineChorusTesting";
546
+ })(TRTCSpeedTestScene = exports.TRTCSpeedTestScene || (exports.TRTCSpeedTestScene = {}));
526
547
  /**
527
548
  * 图缓存
528
549
  *
@@ -1064,14 +1085,16 @@ exports.TRTCVolumeInfo = TRTCVolumeInfo;
1064
1085
  * @param {String} userSig - 用户签名
1065
1086
  * @param {Number} expectedUpBandwidth - 预期的上行带宽(kbps,取值范围: 10 ~ 5000,为 0 时不测试)。
1066
1087
  * @param {Number} expectedDownBandwidth - 预期的下行带宽(kbps,取值范围: 10 ~ 5000,为 0 时不测试)。
1088
+ * @param {TRTCSpeedTestScene} scene - 测速场景。仅当 scene 为 TRTCSpeedTestScene_DelayAndBandwidthTesting 或 TRTCSpeedTestScene_OnlineChorusTesting 时才会测试上下行带宽(availableUpBandwidth / availableDownBandwidth)。默认 TRTCSpeedTestScene_DelayAndBandwidthTesting。
1067
1089
  */
1068
1090
  class TRTCSpeedTestParams {
1069
- constructor(sdkAppId = 0, userId = '', userSig = '', expectedUpBandwidth = 0, expectedDownBandwidth = 0) {
1091
+ constructor(sdkAppId = 0, userId = '', userSig = '', expectedUpBandwidth = 0, expectedDownBandwidth = 0, scene = TRTCSpeedTestScene.TRTCSpeedTestScene_DelayAndBandwidthTesting) {
1070
1092
  this.sdkAppId = sdkAppId;
1071
1093
  this.userId = userId;
1072
1094
  this.userSig = userSig;
1073
1095
  this.expectedUpBandwidth = expectedUpBandwidth;
1074
1096
  this.expectedDownBandwidth = expectedDownBandwidth;
1097
+ this.scene = scene;
1075
1098
  }
1076
1099
  }
1077
1100
  exports.TRTCSpeedTestParams = TRTCSpeedTestParams;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "trtc-electron-sdk",
3
- "version": "13.4.802-beta.0",
3
+ "version": "13.4.802-beta.2",
4
4
  "description": "trtc electron sdk",
5
5
  "main": "./liteav/index.js",
6
6
  "types": "./liteav/index.d.ts",
@@ -111,9 +111,17 @@ async function main(urlDomain) {
111
111
  await download(downloadUrl, outputDir, downloadOptions);
112
112
  signale.success(`Download finished - ${platform}`);
113
113
 
114
+ // Preserve symlinks when copying on macOS so that .framework bundles
115
+ // retain their canonical Versions/Current -> A symlink structure.
116
+ // Without { dereference: false }, fs-extra resolves symlinks to real
117
+ // files/directories, causing `codesign` to report:
118
+ // "bundle format is ambiguous (could be app or framework)"
119
+ const macCopyOptions = { dereference: false };
120
+
114
121
  fs.copySync(
115
122
  path.join(outputDir, "./build/Release"),
116
- path.join(buildDir, "Release")
123
+ path.join(buildDir, "Release"),
124
+ macCopyOptions
117
125
  );
118
126
  signale.success(`copy success! - ${platform}`);
119
127
 
@@ -125,11 +133,13 @@ async function main(urlDomain) {
125
133
  const arch = archType;
126
134
  fs.copySync(
127
135
  path.join(outputDir, "./build/Release/trtc_electron_sdk.node"),
128
- path.join(buildDir, "Release", arch, "trtc_electron_sdk.node")
136
+ path.join(buildDir, "Release", arch, "trtc_electron_sdk.node"),
137
+ macCopyOptions
129
138
  );
130
139
  fs.copySync(
131
140
  path.join(outputDir, "./build/mac-framework", arch),
132
- path.join(buildDir, "mac-framework", arch)
141
+ path.join(buildDir, "mac-framework", arch),
142
+ macCopyOptions
133
143
  );
134
144
  signale.success(`copy success! - mac ${arch}`, "\n");
135
145
 
@@ -163,7 +173,8 @@ async function main(urlDomain) {
163
173
  "Release",
164
174
  anotherArch,
165
175
  "trtc_electron_sdk.node"
166
- )
176
+ ),
177
+ macCopyOptions
167
178
  );
168
179
  fs.copySync(
169
180
  path.join(
@@ -172,7 +183,8 @@ async function main(urlDomain) {
172
183
  "/build/mac-framework",
173
184
  anotherArch
174
185
  ),
175
- path.join(buildDir, "mac-framework", anotherArch)
186
+ path.join(buildDir, "mac-framework", anotherArch),
187
+ macCopyOptions
176
188
  );
177
189
  signale.success(`copy success! - mac ${anotherArch}`);
178
190