trtc-electron-sdk 12.2.701 → 12.2.702

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.
package/liteav/trtc.js CHANGED
@@ -163,10 +163,9 @@ const getComponentNO = function () {
163
163
  */
164
164
  class TRTCCloud extends events_1.EventEmitter {
165
165
  /**
166
- * 构造函数
167
- * @param config {TRTCInitConfig} - 初始化参数,可选
168
- * @param config.networkProxy {Record<string, any>} - 网络代理参数,可选。为空时,默认不开启网络代理。
169
- * @param config.isIPCMode {Boolean} - 是否跨进程模式,跨进程模式支持本地混流且混流视频采用原生窗口渲染。默认:false,不开启。
166
+ * @param {TRTCInitConfig} [config] - 初始化参数,可选
167
+ * @param {Record<string, any>} [config.networkProxy] - 网络代理参数,可选。为空时,默认不开启网络代理。
168
+ * @param {Boolean} [config.isIPCMode] - 是否跨进程模式,跨进程模式支持本地混流且混流视频采用原生窗口渲染。默认:false,不开启。
170
169
  */
171
170
  constructor(config) {
172
171
  var _a;
@@ -240,6 +239,26 @@ class TRTCCloud extends events_1.EventEmitter {
240
239
  this._localVideoRenderCallback = this._localVideoRenderCallback.bind(this);
241
240
  this._remoteVideoRenderCallback = this._remoteVideoRenderCallback.bind(this);
242
241
  this.localVideoRenderController = new LocalVideoRenderController_1.default(this);
242
+ this.deviceManager = new DeviceManager_1.default({
243
+ isIPCMode: TRTCCloud.isIPCMode,
244
+ nodeTRTCCloud: this.rtcCloud,
245
+ });
246
+ this.audioEffectManager = new AudioEffectManager_1.default({
247
+ isIPCMode: TRTCCloud.isIPCMode,
248
+ nodeTRTCCloud: this.rtcCloud,
249
+ });
250
+ this.pluginManager = new PluginManager_1.default({
251
+ isIPCMode: TRTCCloud.isIPCMode,
252
+ nodeTRTCCloud: this.rtcCloud,
253
+ });
254
+ if (TRTCCloud.isIPCMode) {
255
+ this.mediaMixingManager = new MediaMixingManager_1.default({
256
+ deviceManager: this.deviceManager,
257
+ });
258
+ }
259
+ else {
260
+ this.mediaMixingManager = null;
261
+ }
243
262
  if (!TRTCCloud.sharedTRTCCloudInstance) {
244
263
  TRTCCloud.sharedTRTCCloudInstance = this;
245
264
  }
@@ -252,6 +271,11 @@ class TRTCCloud extends events_1.EventEmitter {
252
271
  }
253
272
  /**
254
273
  * 创建 TRTCCloud 主实例对象(单例模式)
274
+ *
275
+ * @param {TRTCInitConfig} [config] - 初始化参数,可选
276
+ * @param {Record<string, any>} [config.networkProxy] - 网络代理参数,可选。为空时,默认不开启网络代理。
277
+ * @param {Boolean} [config.isIPCMode] - 是否跨进程模式,跨进程模式支持本地混流且混流视频采用原生窗口渲染。默认:false,不开启。
278
+ *
255
279
  * @returns {TRTCCloud}
256
280
  */
257
281
  static getTRTCShareInstance(config) {
@@ -297,6 +321,9 @@ class TRTCCloud extends events_1.EventEmitter {
297
321
  if (this !== TRTCCloud.sharedTRTCCloudInstance) {
298
322
  throw new Error("createSubCloud() can only be called on the main instance created by getTRTCShareInstance().");
299
323
  }
324
+ if (TRTCCloud.isIPCMode) {
325
+ throw new Error("createSubCloud() is not supported when `isIPCMode` is true.");
326
+ }
300
327
  return new TRTCCloud(config);
301
328
  }
302
329
  /**
@@ -334,6 +361,7 @@ class TRTCCloud extends events_1.EventEmitter {
334
361
  * 销毁当前实例,释放资源
335
362
  */
336
363
  destroy() {
364
+ var _a;
337
365
  if (this === TRTCCloud.sharedTRTCCloudInstance) {
338
366
  if (TRTCCloud.subInstances) {
339
367
  TRTCCloud.subInstances.forEach(sub => {
@@ -352,6 +380,10 @@ class TRTCCloud extends events_1.EventEmitter {
352
380
  // this.destroyLocalMediaTranscoder();
353
381
  this.rtcCloud.destroy();
354
382
  this.rtcCloud = null;
383
+ this.deviceManager.destroy();
384
+ this.audioEffectManager.destroy();
385
+ this.pluginManager.destroy();
386
+ (_a = this.mediaMixingManager) === null || _a === void 0 ? void 0 : _a.destroy();
355
387
  }
356
388
  /////////////////////////////////////////////////////////////////////////////////
357
389
  //
@@ -479,6 +511,18 @@ class TRTCCloud extends events_1.EventEmitter {
479
511
  case 'onAudioEffectFinished':
480
512
  this.handleOnAudioEffectFinished(data.effectId, data.code);
481
513
  break;
514
+ case 'onStartPublishMediaStream':
515
+ this.handleOnStartPublishMediaStream(data.taskId, data.code, data.message);
516
+ break;
517
+ case 'onUpdatePublishMediaStream':
518
+ this.handleOnUpdatePublishMediaStream(data.taskId, data.code, data.message);
519
+ break;
520
+ case 'onStopPublishMediaStream':
521
+ this.handleOnStopPublishMediaStream(data.taskId, data.code, data.message);
522
+ break;
523
+ case 'onCdnStreamStateChanged':
524
+ this.handleOnCdnStreamStateChanged(data.cdnUrl, data.status, data.code, data.msg);
525
+ break;
482
526
  case 'onScreenCaptureCovered':
483
527
  this.handleOnScreenCaptureCovered();
484
528
  break;
@@ -1114,6 +1158,7 @@ class TRTCCloud extends events_1.EventEmitter {
1114
1158
  * @event TRTCCallback#onStartPublishing
1115
1159
  * @param {Number} errCode - 0 表示成功,其余值表示失败
1116
1160
  * @param {String} errMsg - 具体错误原因
1161
+ * @deprecated
1117
1162
  */
1118
1163
  handleOnStartPublishing(errCode, errMsg) {
1119
1164
  this.fire('onStartPublishing', errCode, errMsg);
@@ -1124,6 +1169,7 @@ class TRTCCloud extends events_1.EventEmitter {
1124
1169
  * @event TRTCCallback#onStopPublishing
1125
1170
  * @param {Number} errCode - 0 表示成功,其余值表示失败
1126
1171
  * @param {String} errMsg - 具体错误原因
1172
+ * @deprecated
1127
1173
  */
1128
1174
  handleOnStopPublishing(errCode, errMsg) {
1129
1175
  this.fire('onStopPublishing', errCode, errMsg);
@@ -1138,6 +1184,7 @@ class TRTCCloud extends events_1.EventEmitter {
1138
1184
  * @event TRTCCallback#onStartPublishCDNStream
1139
1185
  * @param {Number} errCode - 错误码
1140
1186
  * @param {String} errMsg - 错误详细信息
1187
+ * @deprecated
1141
1188
  */
1142
1189
  handleOnStartPublishCDNStream(errCode, errMsg) {
1143
1190
  this.fire('onStartPublishCDNStream', errCode, errMsg);
@@ -1150,6 +1197,7 @@ class TRTCCloud extends events_1.EventEmitter {
1150
1197
  * @event TRTCCallback#onStopPublishCDNStream
1151
1198
  * @param {Number} errCode - 错误码
1152
1199
  * @param {String} errMsg - 错误详细信息
1200
+ * @deprecated
1153
1201
  */
1154
1202
  handleOnStopPublishCDNStream(errCode, errMsg) {
1155
1203
  this.fire('onStopPublishCDNStream', errCode, errMsg);
@@ -1162,10 +1210,69 @@ class TRTCCloud extends events_1.EventEmitter {
1162
1210
  * @event TRTCCallback#onSetMixTranscodingConfig
1163
1211
  * @param {Number} errCode - 错误码
1164
1212
  * @param {String} errMsg - 错误详细信息
1213
+ * @deprecated
1165
1214
  */
1166
1215
  handleOnSetMixTranscodingConfig(errCode, errMsg) {
1167
1216
  this.fire('onSetMixTranscodingConfig', errCode, errMsg);
1168
1217
  }
1218
+ /**
1219
+ * 开始发布媒体流的事件回调
1220
+ *
1221
+ * 当您调用 [startPublishMediaStream]{@link TRTCCloud#startPublishMediaStream} 开始向 TRTC 后台服务发布媒体流时,SDK 会立刻将这一指令同步给云端服务器,随后 SDK 会收到来自云端服务器的处理结果,并将指令的执行结果通过本事件回调通知给您。
1222
+ *
1223
+ * @event TRTCCallback#onStartPublishMediaStream
1224
+ * @param taskId {String} - 当请求成功时,TRTC 后台会在回调中提供给您这项任务的 taskId,后续您可以通过该 taskId 结合 [updatePublishMediaStream]{@link TRTCCloud#updatePublishMediaStream} 和 [stopPublishMediaStream]{@link TRTCCloud#stopPublishMediaStream} 进行更新和停止。
1225
+ * @param code {Number} - 回调结果,0 表示成功,其余值表示失败。
1226
+ * @param message {String} - 具体回调信息。
1227
+ */
1228
+ handleOnStartPublishMediaStream(taskId, code, message) {
1229
+ this.fire('onStartPublishMediaStream', taskId, code, message);
1230
+ }
1231
+ /**
1232
+ * 更新媒体流的事件回调
1233
+ *
1234
+ * 当您调用媒体流发布接口 ([updatePublishMediaStream]{@link TRTCCloud#updatePublishMediaStream}) 开始向 TRTC 后台服务更新媒体流时,SDK 会立刻将这一指令同步给云端服务器,随后 SDK 会收到来自云端服务器的处理结果,并将指令的执行结果通过本事件回调通知给您。
1235
+ * @event TRTCCallback#onUpdatePublishMediaStream
1236
+ * @param taskId {String} - 您调用媒体流发布接口 ([updatePublishMediaStream]{@link TRTCCloud#updatePublishMediaStream}) 时传入的 taskId,会通过此回调再带回给您,用于标识该回调属于哪一次更新请求。
1237
+ * @param code {Number} - 回调结果,0 表示成功,其余值表示失败。
1238
+ * @param message {String} - 具体回调信息。
1239
+ */
1240
+ handleOnUpdatePublishMediaStream(taskId, code, message) {
1241
+ this.fire('onUpdatePublishMediaStream', taskId, code, message);
1242
+ }
1243
+ /**
1244
+ * 停止媒体流的事件回调
1245
+ *
1246
+ * 当您调用停止发布媒体流 ([stopPublishMediaStream]{@link TRTCCloud#stopPublishMediaStream}) 开始向 TRTC 后台服务停止媒体流时,SDK 会立刻将这一指令同步给云端服务器,随后 SDK 会收到来自云端服务器的处理结果,并将指令的执行结果通过本事件回调通知给您。
1247
+ * @event TRTCCallback#onStopPublishMediaStream
1248
+ * @param taskId {String} - 您调用停止发布媒体流 ([stopPublishMediaStream]{@link TRTCCloud#stopPublishMediaStream}) 时传入的 taskId,会通过此回调再带回给您,用于标识该回调属于哪一次停止请求。
1249
+ * @param code {Number} - 回调结果,0 表示成功,其余值表示失败。
1250
+ * @param message {String} - 具体回调信息。
1251
+ */
1252
+ handleOnStopPublishMediaStream(taskId, code, message) {
1253
+ this.fire('onStopPublishMediaStream', taskId, code, message);
1254
+ }
1255
+ /**
1256
+ * RTMP/RTMPS 推流状态发生改变回调
1257
+ *
1258
+ * 当您调用 [startPublishMediaStream]{@link TRTCCloud#startPublishMediaStream} 开始向 TRTC 后台服务发布媒体流时,SDK 会立刻将这一指令同步给云端服务。
1259
+ * 若您在目标推流配置 ([TRTCPublishTarget]{@link TRTCPublishTarget}) 设置了向腾讯或者第三方 CDN 上发布音视频流的 URL 配置,则具体 RTMP 或者 RTMPS 推流状态将通过此回调同步给您。
1260
+ *
1261
+ * @event TRTCCallback#onCdnStreamStateChanged
1262
+ * @param cdnUrl {String} - 您调用 [startPublishMediaStream]{@link TRTCCloud#startPublishMediaStream} 时通过目标推流配置 ([TRTCPublishTarget]{@link TRTCPublishTarget}) 传入的 url,在推流状态变更时,会通过此回调同步给您。
1263
+ * @param status {Number} - 推流状态。
1264
+ * - 0:推流未开始或者已结束。在您调用 [stopPublishMediaStream]{@link TRTCCloud#stopPublishMediaStream} 时会返回该状态。
1265
+ * - 1:正在连接 TRTC 服务器和 CDN 服务器。若无法立刻成功,TRTC 后台服务会多次重试尝试推流,并返回该状态(5s回调一次)。如成功进行推流,则进入状态 2;如服务器出错或 60 秒内未成功推流,则进入状态 4。
1266
+ * - 2:CDN 推流正在进行。在成功推流后,会返回该状态。
1267
+ * - 3:TRTC 服务器和 CDN 服务器推流中断,正在恢复。当 CDN 出现异常,或推流短暂中断时,TRTC 后台服务会自动尝试恢复推流,并返回该状态(5s回调一次)。如成功恢复推流,则进入状态 2;如服务器出错或 60 秒内未成功恢复,则进入状态 4。
1268
+ * - 4:TRTC 服务器和 CDN 服务器推流中断,且恢复或连接超时。即此时推流失败,你可以再次调用 [updatePublishMediaStream]{@link TRTCCloud#updatePublishMediaStream} 尝试推流。
1269
+ * - 5:正在断开 TRTC 服务器和 CDN 服务器。在您调用 [stopPublishMediaStream]{@link TRTCCloud#stopPublishMediaStream} 时,TRTC 后台服务会依次同步状态 5 和状态 0。
1270
+ * @param code {Number} - 回调结果,0 表示成功,其余值表示失败。
1271
+ * @param msg {String} - 具体回调信息。
1272
+ */
1273
+ handleOnCdnStreamStateChanged(cdnUrl, status, code, msg) {
1274
+ this.fire('onCdnStreamStateChanged', cdnUrl, status, code, msg);
1275
+ }
1169
1276
  /////////////////////////////////////////////////////////////////////////////////
1170
1277
  //
1171
1278
  // (九)音效回调
@@ -1638,6 +1745,253 @@ class TRTCCloud extends events_1.EventEmitter {
1638
1745
  // (二)CDN 相关接口函数
1639
1746
  //
1640
1747
  /////////////////////////////////////////////////////////////////////////////////
1748
+ /**
1749
+ * 开始发布媒体流
1750
+ *
1751
+ * 该接口会向 TRTC 服务器发送指令,要求其将当前用户的音视频流转推/转码到直播 CDN 或者回推到 TRTC 房间中,您可以通过 [TRTCPublishTarget]{@link TRTCPublishTarget} 配置中的 [TRTCPublishMode]{@link TRTCPublishMode} 指定具体的发布模式。
1752
+ *
1753
+ * 注意:
1754
+ * 1. SDK 会通过回调 [onStartPublishMediaStream]{@link TRTCCallback#event:onStartPublishMediaStream} 带给您后台启动的任务标识(即 taskId)。
1755
+ * 2. 同一个任务(TRTCPublishMode 与 TRTCPublishCdnUrl 均相同)仅支持启动一次。若您后续需要更新或者停止该项任务,需要记录并使用返回的 taskId,通过 [updatePublishMediaStream]{@link TRTCCloud#updatePublishMediaStream} 或者 [stopPublishMediaStream]{@link TRTCCloud#stopPublishMediaStream} 来操作。
1756
+ * 3. target 支持同时配置多个 CDN URL(最多同时 10 个)。若您的同一个转推/转码任务需要发布至多路 CDN,则仅需要在 target 中配置多个 CDN URL 即可。同一个转码任务即使有多个转推地址,对应的转码计费仍只收取一份。
1757
+ * 4. 使用时需要注意不要多个任务同时往相同的 URL 地址推送,以免引起异常推流状态。一种推荐的方案是 URL 中使用 “sdkappid_roomid_userid_main” 作为区分标识,这种命名方式容易辨认且不会在您的多个应用中发生冲突。
1758
+ *
1759
+ * @example
1760
+ * // Publish big stream(camera video) to CDN
1761
+ * import TRTCCloud, { TRTCPublishMode } from 'trtc-electron-sdk';
1762
+ * const trtcCloud = TRTCCloud.getTRTCShareInstance();
1763
+ *
1764
+ * let cdnTaskId = '';
1765
+ * trtcCloud.on('onStartPublishMediaStream', (taskId: string, code: number, message: string) => {
1766
+ * if (code === 0) {
1767
+ * cdnTaskId = taskId;
1768
+ * } else {
1769
+ * console.log('startPublishMediaStream error:', code, message);
1770
+ * }
1771
+ * });
1772
+ *
1773
+ * trtc.startPublishMediaStream({
1774
+ * mode: TRTCPublishMode.TRTCPublishBigStreamToCdn,
1775
+ * cdnUrlList: [{
1776
+ * rtmpUrl: 'rtmp://<Your RTMP URL>',
1777
+ * isInternalLine: true
1778
+ * }],
1779
+ * mixStreamIdentity: null
1780
+ * }, null, null);
1781
+ *
1782
+ * @example
1783
+ * // Publish sub stream(screen sharing video) to CDN
1784
+ * import TRTCCloud, { TRTCPublishMode } from 'trtc-electron-sdk';
1785
+ * const trtcCloud = TRTCCloud.getTRTCShareInstance();
1786
+ *
1787
+ * let cdnTaskId = '';
1788
+ * trtcCloud.on('onStartPublishMediaStream', (taskId: string, code: number, message: string) => {
1789
+ * if (code === 0) {
1790
+ * cdnTaskId = taskId;
1791
+ * } else {
1792
+ * console.log('startPublishMediaStream error:', code, message);
1793
+ * }
1794
+ * });
1795
+ *
1796
+ * trtc.startPublishMediaStream({
1797
+ * mode: TRTCPublishMode.TRTCPublishSubStreamToCdn,
1798
+ * cdnUrlList: [{
1799
+ * rtmpUrl: 'rtmp://<Your RTMP URL>',
1800
+ * isInternalLine: true
1801
+ * }],
1802
+ * mixStreamIdentity: null
1803
+ * }, null, null);
1804
+ *
1805
+ * @example
1806
+ * // Publish and mixing multi-user video and audio to CDN
1807
+ * import TRTCCloud, { TRTCPublishMode } from 'trtc-electron-sdk';
1808
+ * const trtcCloud = TRTCCloud.getTRTCShareInstance();
1809
+ *
1810
+ * let cdnTaskId = '';
1811
+ * trtcCloud.on('onStartPublishMediaStream', (taskId: string, code: number, message: string) => {
1812
+ * if (code === 0) {
1813
+ * cdnTaskId = taskId;
1814
+ * } else {
1815
+ * console.log('startPublishMediaStream error:', code, message);
1816
+ * }
1817
+ * });
1818
+ *
1819
+ * trtc.startPublishMediaStream(
1820
+ * {
1821
+ * mode: TRTCPublishMode.TRTCPublishMixStreamToCdn,
1822
+ * cdnUrlList: [{
1823
+ * rtmpUrl: 'rtmp://<Your RTMP URL>',
1824
+ * isInternalLine: true
1825
+ * }],
1826
+ * mixStreamIdentity: null
1827
+ * },
1828
+ * {
1829
+ * audioEncodedChannelNum: 2,
1830
+ * audioEncodedCodecType: 0,
1831
+ * audioEncodedKbps: 128,
1832
+ * audioEncodedSampleRate: 48000,
1833
+ * videoEncodedCodecType: 0,
1834
+ * videoEncodedFPS: 30,
1835
+ * videoEncodedGOP: 1,
1836
+ * videoEncodedWidth: 1280,
1837
+ * videoEncodedHeight: 720,
1838
+ * videoEncodedKbps: 2000,
1839
+ * videoSeiParams: "",
1840
+ * },
1841
+ * {
1842
+ * "backgroundColor": 14362921,
1843
+ * "backgroundImage": "",
1844
+ * "videoLayoutList": [
1845
+ * {
1846
+ * "rect": { "top": 0, "left": 0, "right": 960, "bottom": 540 },
1847
+ * "zOrder": 1,
1848
+ * "fillMode": 0,
1849
+ * "backgroundColor": 14483711,
1850
+ * "placeHolderImage": "",
1851
+ * "fixedVideoUser": { "userId": "windev", "intRoomId": 5055005, "strRoomId": "" },
1852
+ * "fixedVideoStreamType": 0
1853
+ * },
1854
+ * {
1855
+ * "rect": { "top": 360, "left": 640, "right": 1280, "bottom": 720 },
1856
+ * "zOrder": 2,
1857
+ * "fillMode": 0,
1858
+ * "backgroundColor": 14480000,
1859
+ * "placeHolderImage": "",
1860
+ * "fixedVideoUser": { "userId": "macdev", "intRoomId": 5055005, "strRoomId": "" },
1861
+ * "fixedVideoStreamType": 0
1862
+ * }
1863
+ * ],
1864
+ * "audioMixUserList": [
1865
+ * { "userId": "windev", "intRoomId": 5055005, "strRoomId": "" },
1866
+ * { "userId": "macdev", "intRoomId": 5055005, "strRoomId": "" }
1867
+ * ],
1868
+ * "watermarkList": [
1869
+ * {
1870
+ * "watermarkUrl": "https://<Your watermark image URL>",
1871
+ * "rect": { "top": 540, "left": 0, "right": 320, "bottom": 640 },
1872
+ * "zOrder": 3
1873
+ * }
1874
+ * ]
1875
+ * }
1876
+ * );
1877
+ *
1878
+ * @param target {TRTCPublishTarget} - 媒体流发布的目标地址,支持转推/转码到腾讯或者第三方 CDN,也支持转码回推到 TRTC 房间中。
1879
+ * @param params {TRTCStreamEncoderParam|null} - 媒体流编码输出参数,转码和回推到 TRTC 房间中时为必填项,您需要指定您预期的转码输出参数。在转推时,为了更好的转推稳定性和 CDN 兼容性,也建议您进行配置。
1880
+ * @param config {TRTCStreamMixingConfig|null} - 媒体流转码配置参数,转码和回推到 TRTC 房间中时为必填项,您需要指定您预期的转码配置参数。转推模式下则无效。
1881
+ */
1882
+ startPublishMediaStream(target, params, config) {
1883
+ this.logger.log(`startPublishMediaStream:`, target, params, config);
1884
+ this.rtcCloud.startPublishMediaStream(target, params, config);
1885
+ }
1886
+ /**
1887
+ * 更新发布媒体流
1888
+ *
1889
+ * 该接口会向 TRTC 服务器发送指令,更新通过 [startPublishMediaStream]{@link TRTCCloud#startPublishMediaStream} 启动的媒体流
1890
+ *
1891
+ * 注意:
1892
+ * 1. 您可以通过本接口来更新发布的 CDN URL(支持增删,最多同时 10 个),但您使用时需要注意不要多个任务同时往相同的 URL 地址推送,以免引起异常推流状态。
1893
+ * 2. 您可以通过 taskId 来更新调整转推/转码任务。例如在 pk 业务中,您可以先通过 [startPublishMediaStream]{@link startPublishMediaStream} 发起转推,接着在主播发起 pk 时,通过 taskId 和本接口将转推更新为转码任务。此时,CDN 播放将连续并且不会发生断流(您需要保持媒体流编码输出参数 `param` 一致)。
1894
+ * 3. 同一个任务不支持纯音频、音视频、纯视频之间的切换。
1895
+ *
1896
+ * @example
1897
+ * // Publish and mixing multi-user video and audio to TRTC Room
1898
+ * import TRTCCloud, { TRTCPublishMode } from 'trtc-electron-sdk';
1899
+ * const trtcCloud = TRTCCloud.getTRTCShareInstance();
1900
+ *
1901
+ * let cdnTaskId = '';
1902
+ * trtcCloud.on('onStartPublishMediaStream', (taskId: string, code: number, message: string) => {
1903
+ * if (code === 0) {
1904
+ * cdnTaskId = taskId;
1905
+ * } else {
1906
+ * console.log('startPublishMediaStream error:', code, message);
1907
+ * }
1908
+ * });
1909
+ *
1910
+ * trtc.updatePublishMediaStream(
1911
+ * cdnTaskId,
1912
+ * {
1913
+ * mode: TRTCPublishMode.TRTCPublishMixStreamToRoom,
1914
+ * cdnUrlList: [],
1915
+ * mixStreamIdentity: { // Publish to TRTC Room
1916
+ * "userId": "__robot__",
1917
+ * "intRoomId": 5055005,
1918
+ * "strRoomId": ""
1919
+ * }
1920
+ * },
1921
+ * {
1922
+ * audioEncodedChannelNum: 2,
1923
+ * audioEncodedCodecType: 0,
1924
+ * audioEncodedKbps: 128,
1925
+ * audioEncodedSampleRate: 48000,
1926
+ * videoEncodedCodecType: 0,
1927
+ * videoEncodedFPS: 30,
1928
+ * videoEncodedGOP: 1,
1929
+ * videoEncodedWidth: 1280,
1930
+ * videoEncodedHeight: 720,
1931
+ * videoEncodedKbps: 2000,
1932
+ * videoSeiParams: "",
1933
+ * },
1934
+ * {
1935
+ * "backgroundColor": 14362921,
1936
+ * "backgroundImage": "",
1937
+ * "videoLayoutList": [
1938
+ * {
1939
+ * "rect": { "top": 0, "left": 0, "right": 960, "bottom": 540 },
1940
+ * "zOrder": 1,
1941
+ * "fillMode": 0,
1942
+ * "backgroundColor": 14483711,
1943
+ * "placeHolderImage": "",
1944
+ * "fixedVideoUser": { "userId": "windev", "intRoomId": 5055005, "strRoomId": "" },
1945
+ * "fixedVideoStreamType": 0
1946
+ * },
1947
+ * {
1948
+ * "rect": { "top": 360, "left": 640, "right": 1280, "bottom": 720 },
1949
+ * "zOrder": 2,
1950
+ * "fillMode": 0,
1951
+ * "backgroundColor": 14480000,
1952
+ * "placeHolderImage": "",
1953
+ * "fixedVideoUser": { "userId": "macdev", "intRoomId": 5055005, "strRoomId": "" },
1954
+ * "fixedVideoStreamType": 0
1955
+ * }
1956
+ * ],
1957
+ * "audioMixUserList": [
1958
+ * { "userId": "windev", "intRoomId": 5055005, "strRoomId": "" },
1959
+ * { "userId": "macdev", "intRoomId": 5055005, "strRoomId": "" }
1960
+ * ],
1961
+ * "watermarkList": [
1962
+ * {
1963
+ * "watermarkUrl": "https://<Your watermark image URL>",
1964
+ * "rect": { "top": 540, "left": 0, "right": 320, "bottom": 640 },
1965
+ * "zOrder": 3
1966
+ * }
1967
+ * ]
1968
+ * }
1969
+ * );
1970
+ *
1971
+ * @param taskId {String} - 通过回调 [onStartPublishMediaStream]{@link TRTCCallback#event:onStartPublishMediaStream} 带给您后台启动的任务标识(即 taskId)
1972
+ * @param target {TRTCPublishTarget|null} - 媒体流发布的目标地址,支持转推/转码到腾讯或者第三方 CDN,也支持转码回推到 TRTC 房间中。
1973
+ * @param params {TRTCStreamEncoderParam|null} - 媒体流编码输出参数,转码和回推到 TRTC 房间中时为必填项,您需要指定您预期的转码输出参数。在转推时,为了更好的转推稳定性和 CDN 兼容性,也建议您进行配置。
1974
+ * @param config {TRTCStreamMixingConfig|null} - 媒体流转码配置参数,转码和回推到 TRTC 房间中时为必填项,您需要指定您预期的转码配置参数。转推模式下则无效。
1975
+ */
1976
+ updatePublishMediaStream(taskId, target, params, config) {
1977
+ this.logger.log(`updatePublishMediaStream:${taskId}`, target, params, config);
1978
+ this.rtcCloud.updatePublishMediaStream(taskId, target, params, config);
1979
+ }
1980
+ /**
1981
+ * 停止发布媒体流
1982
+ *
1983
+ * 该接口会向 TRTC 服务器发送指令,停止通过 [startPublishMediaStream]{@link TRTCCloud#startPublishMediaStream} 启动的媒体流
1984
+ *
1985
+ * 注意:
1986
+ * 1. 若您的业务后台并没有保存该 taskId,在您的主播异常退房重进后,如果您需要重新获取 taskId,您可以再次调用 [startPublishMediaStream]{@link TRTCCloud#startPublishMediaStream} 启动任务。此时 TRTC 后台会返回任务启动失败,同时带给您上一次启动的 taskId
1987
+ * 2. 若 taskId 填空字符串,将会停止该用户所有通过 [startPublishMediaStream]{@link TRTCCloud#startPublishMediaStream} 启动的媒体流,如果您只启动了一个媒体流或者想停止所有通过您启动的媒体流,推荐使用这种方式。
1988
+ *
1989
+ * @param taskId {String} - 通过回调 [onStartPublishMediaStream]{@link TRTCCallback#event:onStartPublishMediaStream} 带给您后台启动的任务标识(即 taskId)
1990
+ */
1991
+ stopPublishMediaStream(taskId) {
1992
+ this.logger.log(`stopPublishMediaStream:${taskId}`);
1993
+ this.rtcCloud.stopPublishMediaStream(taskId);
1994
+ }
1641
1995
  /**
1642
1996
  * 开始向腾讯云的直播 CDN 推流
1643
1997
  *
@@ -1661,12 +2015,14 @@ class TRTCCloud extends events_1.EventEmitter {
1661
2015
  *
1662
2016
  * @param {String} streamId - 自定义流 ID。
1663
2017
  * @param {TRTCVideoStreamType} type - 仅支持 TRTCVideoStreamTypeBig 和 TRTCVideoStreamTypeSub。
2018
+ * @deprecated
1664
2019
  */
1665
2020
  startPublishing(streamId, type) {
1666
2021
  this.rtcCloud.startPublishing(streamId, type);
1667
2022
  }
1668
2023
  /**
1669
2024
  * 停止向腾讯云的直播 CDN 推流
2025
+ * @deprecated
1670
2026
  */
1671
2027
  stopPublishing() {
1672
2028
  this.rtcCloud.stopPublishing();
@@ -1685,6 +2041,7 @@ class TRTCCloud extends events_1.EventEmitter {
1685
2041
  * @param {Number} param.bizId - 腾讯云直播服务的 bizid
1686
2042
  * @param {String} param.url - 指定该路音视频流在第三方直播服务商的推流地址,推流 URL 必须为 RTMP 格式,必须符合您的目标直播服务商的规范要求,否则目标服务商会拒绝来自 TRTC 后台服务的推流请求。
1687
2043
  * @param {String} param.streamId - 需要转推的 streamId,默认值:空值。如果不填写,则默认转推调用者的旁路流。
2044
+ * @deprecated
1688
2045
  */
1689
2046
  startPublishCDNStream(param) {
1690
2047
  const streamId = param.streamId ? param.streamId.trim() : "";
@@ -1697,6 +2054,7 @@ class TRTCCloud extends events_1.EventEmitter {
1697
2054
  }
1698
2055
  /**
1699
2056
  * 停止向非腾讯云的直播 CDN 推流
2057
+ * @deprecated
1700
2058
  */
1701
2059
  stopPublishCDNStream() {
1702
2060
  this.rtcCloud.stopPublishCDNStream();
@@ -1767,6 +2125,7 @@ class TRTCCloud extends events_1.EventEmitter {
1767
2125
  * @param {Number} config.mixUsersArray[].renderMode - 该画面在输出时的显示模式。视频流默认为0。0为裁剪,1为缩放,2为缩放并显示黑底。
1768
2126
  * @param {Number} config.mixUsersArray[].soundLevel - 该路音频参与混音时的音量等级(取值范围:0 - 100),默认值:100。
1769
2127
  * @param {String} config.mixUsersArray[].image - 占位图是指当对应 userId 混流内容为纯音频时,混合后的画面中显示的是占位图片。水印图是指一张贴在混合后画面中的半透明图片,这张图片会一直覆盖于混合后的画面上。当指定 inputType 为 TRTCMixInputTypePureAudio 时,image 为占位图,此时需要您指定 userId。当指定 inputType 为 TRTCMixInputTypeWatermark 时,image 为水印图,此时不需要您指定 userId。
2128
+ * @deprecated
1770
2129
  */
1771
2130
  setMixTranscodingConfig(config) {
1772
2131
  if (config === null) {
@@ -1913,7 +2272,7 @@ class TRTCCloud extends events_1.EventEmitter {
1913
2272
  */
1914
2273
  setCameraCaptureParams(params) {
1915
2274
  if (params && (0, validate_util_1.isNumber)(params.mode) && (0, validate_util_1.isNumber)(params.width) && (0, validate_util_1.isNumber)(params.height)) {
1916
- this.getDeviceManager().setCameraCaptureParam(params);
2275
+ this.deviceManager.setCameraCaptureParam(params);
1917
2276
  }
1918
2277
  else {
1919
2278
  this.logger.error('setCameraCaptureParams invalid params:', params);
@@ -2677,7 +3036,7 @@ class TRTCCloud extends events_1.EventEmitter {
2677
3036
  * @return {Array<TRTCDeviceInfo>} 摄像头管理器列表
2678
3037
  */
2679
3038
  getCameraDevicesList() {
2680
- return this.getDeviceManager().getDevicesList(trtc_define_1.TRTCDeviceType.TRTCDeviceTypeCamera);
3039
+ return this.deviceManager.getDevicesList(trtc_define_1.TRTCDeviceType.TRTCDeviceTypeCamera);
2681
3040
  }
2682
3041
  /**
2683
3042
  * 设置要使用的摄像头
@@ -2685,7 +3044,7 @@ class TRTCCloud extends events_1.EventEmitter {
2685
3044
  * @param {String} deviceId - 从 getCameraDevicesList 中得到的设备 ID
2686
3045
  */
2687
3046
  setCurrentCameraDevice(deviceId) {
2688
- this.getDeviceManager().setCurrentDevice(trtc_define_1.TRTCDeviceType.TRTCDeviceTypeCamera, deviceId);
3047
+ this.deviceManager.setCurrentDevice(trtc_define_1.TRTCDeviceType.TRTCDeviceTypeCamera, deviceId);
2689
3048
  }
2690
3049
  /**
2691
3050
  * 获取当前使用的摄像头
@@ -2694,7 +3053,7 @@ class TRTCCloud extends events_1.EventEmitter {
2694
3053
  */
2695
3054
  getCurrentCameraDevice() {
2696
3055
  if (TRTCCloud.isIPCMode) {
2697
- this.getDeviceManager().getCurrentDevice(trtc_define_1.TRTCDeviceType.TRTCDeviceTypeCamera);
3056
+ this.deviceManager.getCurrentDevice(trtc_define_1.TRTCDeviceType.TRTCDeviceTypeCamera);
2698
3057
  return this.stateStore.get('currentCamera');
2699
3058
  }
2700
3059
  else {
@@ -2718,7 +3077,7 @@ class TRTCCloud extends events_1.EventEmitter {
2718
3077
  * @return {Array<TRTCDeviceInfo>} 麦克风管理器列表
2719
3078
  */
2720
3079
  getMicDevicesList() {
2721
- return this.getDeviceManager().getDevicesList(trtc_define_1.TRTCDeviceType.TRTCDeviceTypeMic);
3080
+ return this.deviceManager.getDevicesList(trtc_define_1.TRTCDeviceType.TRTCDeviceTypeMic);
2722
3081
  }
2723
3082
  /**
2724
3083
  * 获取当前选择的麦克风
@@ -2727,7 +3086,7 @@ class TRTCCloud extends events_1.EventEmitter {
2727
3086
  */
2728
3087
  getCurrentMicDevice() {
2729
3088
  if (TRTCCloud.isIPCMode) {
2730
- this.getDeviceManager().getCurrentDevice(trtc_define_1.TRTCDeviceType.TRTCDeviceTypeMic);
3089
+ this.deviceManager.getCurrentDevice(trtc_define_1.TRTCDeviceType.TRTCDeviceTypeMic);
2731
3090
  return this.stateStore.get('currentMic');
2732
3091
  }
2733
3092
  else {
@@ -2742,7 +3101,7 @@ class TRTCCloud extends events_1.EventEmitter {
2742
3101
  * @param {String} micId - 从 getMicDevicesList 中得到的设备 ID
2743
3102
  */
2744
3103
  setCurrentMicDevice(micId) {
2745
- this.getDeviceManager().setCurrentDevice(trtc_define_1.TRTCDeviceType.TRTCDeviceTypeMic, micId);
3104
+ this.deviceManager.setCurrentDevice(trtc_define_1.TRTCDeviceType.TRTCDeviceTypeMic, micId);
2746
3105
  }
2747
3106
  /**
2748
3107
  * 获取系统当前麦克风设备音量
@@ -2752,11 +3111,11 @@ class TRTCCloud extends events_1.EventEmitter {
2752
3111
  */
2753
3112
  getCurrentMicDeviceVolume() {
2754
3113
  if (TRTCCloud.isIPCMode) {
2755
- this.getDeviceManager().getCurrentDeviceVolume(trtc_define_1.TRTCDeviceType.TRTCDeviceTypeMic);
3114
+ this.deviceManager.getCurrentDeviceVolume(trtc_define_1.TRTCDeviceType.TRTCDeviceTypeMic);
2756
3115
  return this.stateStore.get('currentMicVolume');
2757
3116
  }
2758
3117
  else {
2759
- return this.getDeviceManager().getCurrentDeviceVolume(trtc_define_1.TRTCDeviceType.TRTCDeviceTypeMic);
3118
+ return this.deviceManager.getCurrentDeviceVolume(trtc_define_1.TRTCDeviceType.TRTCDeviceTypeMic);
2760
3119
  }
2761
3120
  }
2762
3121
  /**
@@ -2766,7 +3125,7 @@ class TRTCCloud extends events_1.EventEmitter {
2766
3125
  * @param {Number} volume - 麦克风音量值,范围0 - 100
2767
3126
  */
2768
3127
  setCurrentMicDeviceVolume(volume) {
2769
- this.getDeviceManager().setCurrentDeviceVolume(trtc_define_1.TRTCDeviceType.TRTCDeviceTypeMic, volume);
3128
+ this.deviceManager.setCurrentDeviceVolume(trtc_define_1.TRTCDeviceType.TRTCDeviceTypeMic, volume);
2770
3129
  }
2771
3130
  /**
2772
3131
  * 设置系统当前麦克风设备的静音状态
@@ -2774,7 +3133,7 @@ class TRTCCloud extends events_1.EventEmitter {
2774
3133
  * @param {Boolean} mute 设置为 true 时,麦克风设备静音;设置为 false时,麦克风设备取消静音
2775
3134
  */
2776
3135
  setCurrentMicDeviceMute(mute) {
2777
- this.getDeviceManager().setCurrentDeviceMute(trtc_define_1.TRTCDeviceType.TRTCDeviceTypeMic, mute);
3136
+ this.deviceManager.setCurrentDeviceMute(trtc_define_1.TRTCDeviceType.TRTCDeviceTypeMic, mute);
2778
3137
  }
2779
3138
  /**
2780
3139
  * 获取系统当前麦克风设备是否静音
@@ -2783,7 +3142,7 @@ class TRTCCloud extends events_1.EventEmitter {
2783
3142
  */
2784
3143
  getCurrentMicDeviceMute() {
2785
3144
  if (TRTCCloud.isIPCMode) {
2786
- this.getDeviceManager().getCurrentDeviceMute(trtc_define_1.TRTCDeviceType.TRTCDeviceTypeMic);
3145
+ this.deviceManager.getCurrentDeviceMute(trtc_define_1.TRTCDeviceType.TRTCDeviceTypeMic);
2787
3146
  return this.stateStore.get('isCurrentMicMute');
2788
3147
  }
2789
3148
  else {
@@ -2802,7 +3161,7 @@ class TRTCCloud extends events_1.EventEmitter {
2802
3161
  * @return {Array<TRTCDeviceInfo>} 扬声器管理器列表
2803
3162
  */
2804
3163
  getSpeakerDevicesList() {
2805
- return this.getDeviceManager().getDevicesList(trtc_define_1.TRTCDeviceType.TRTCDeviceTypeSpeaker);
3164
+ return this.deviceManager.getDevicesList(trtc_define_1.TRTCDeviceType.TRTCDeviceTypeSpeaker);
2806
3165
  }
2807
3166
  /**
2808
3167
  * 获取当前的扬声器设备
@@ -2811,7 +3170,7 @@ class TRTCCloud extends events_1.EventEmitter {
2811
3170
  */
2812
3171
  getCurrentSpeakerDevice() {
2813
3172
  if (TRTCCloud.isIPCMode) {
2814
- this.getDeviceManager().getCurrentDevice(trtc_define_1.TRTCDeviceType.TRTCDeviceTypeSpeaker);
3173
+ this.deviceManager.getCurrentDevice(trtc_define_1.TRTCDeviceType.TRTCDeviceTypeSpeaker);
2815
3174
  return this.stateStore.get('currentSpeaker');
2816
3175
  }
2817
3176
  else {
@@ -2824,7 +3183,7 @@ class TRTCCloud extends events_1.EventEmitter {
2824
3183
  * @param {String} speakerId - 从 getSpeakerDevicesList 中得到的设备 ID
2825
3184
  */
2826
3185
  setCurrentSpeakerDevice(speakerId) {
2827
- this.getDeviceManager().setCurrentDevice(trtc_define_1.TRTCDeviceType.TRTCDeviceTypeSpeaker, speakerId);
3186
+ this.deviceManager.setCurrentDevice(trtc_define_1.TRTCDeviceType.TRTCDeviceTypeSpeaker, speakerId);
2828
3187
  }
2829
3188
  /**
2830
3189
  * 获取系统当前扬声器设备音量
@@ -2833,11 +3192,11 @@ class TRTCCloud extends events_1.EventEmitter {
2833
3192
  */
2834
3193
  getCurrentSpeakerVolume() {
2835
3194
  if (TRTCCloud.isIPCMode) {
2836
- this.getDeviceManager().getCurrentDeviceVolume(trtc_define_1.TRTCDeviceType.TRTCDeviceTypeSpeaker);
3195
+ this.deviceManager.getCurrentDeviceVolume(trtc_define_1.TRTCDeviceType.TRTCDeviceTypeSpeaker);
2837
3196
  return this.stateStore.get('currentSpeakerVolume');
2838
3197
  }
2839
3198
  else {
2840
- return this.getDeviceManager().getCurrentDeviceVolume(trtc_define_1.TRTCDeviceType.TRTCDeviceTypeSpeaker);
3199
+ return this.deviceManager.getCurrentDeviceVolume(trtc_define_1.TRTCDeviceType.TRTCDeviceTypeSpeaker);
2841
3200
  }
2842
3201
  }
2843
3202
  /**
@@ -2848,7 +3207,7 @@ class TRTCCloud extends events_1.EventEmitter {
2848
3207
  * @param {Number} volume - 设置的扬声器音量,范围0 - 100
2849
3208
  */
2850
3209
  setCurrentSpeakerVolume(volume) {
2851
- this.getDeviceManager().setCurrentDeviceVolume(trtc_define_1.TRTCDeviceType.TRTCDeviceTypeSpeaker, volume);
3210
+ this.deviceManager.setCurrentDeviceVolume(trtc_define_1.TRTCDeviceType.TRTCDeviceTypeSpeaker, volume);
2852
3211
  }
2853
3212
  /**
2854
3213
  * 设置系统当前扬声器设备的静音状态
@@ -2856,7 +3215,7 @@ class TRTCCloud extends events_1.EventEmitter {
2856
3215
  * @param {Boolean} mute 设置为 true 时,扬声器设备静音;设置为 false时,扬声器设备取消静音
2857
3216
  */
2858
3217
  setCurrentSpeakerDeviceMute(mute) {
2859
- this.getDeviceManager().setCurrentDeviceMute(trtc_define_1.TRTCDeviceType.TRTCDeviceTypeSpeaker, mute);
3218
+ this.deviceManager.setCurrentDeviceMute(trtc_define_1.TRTCDeviceType.TRTCDeviceTypeSpeaker, mute);
2860
3219
  }
2861
3220
  /**
2862
3221
  * 获取系统当前扬声器设备是否静音
@@ -2865,7 +3224,7 @@ class TRTCCloud extends events_1.EventEmitter {
2865
3224
  */
2866
3225
  getCurrentSpeakerDeviceMute() {
2867
3226
  if (TRTCCloud.isIPCMode) {
2868
- this.getDeviceManager().getCurrentDeviceMute(trtc_define_1.TRTCDeviceType.TRTCDeviceTypeSpeaker);
3227
+ this.deviceManager.getCurrentDeviceMute(trtc_define_1.TRTCDeviceType.TRTCDeviceTypeSpeaker);
2869
3228
  return this.stateStore.get('isCurrentSpeakerMute');
2870
3229
  }
2871
3230
  else {
@@ -2883,7 +3242,7 @@ class TRTCCloud extends events_1.EventEmitter {
2883
3242
  * - false: 不跟随。只有当 SDK 使用的音频设备被移除后或插入新的音频设备为系统默认设备时,SDK 才切换至系统默认的音频设备。
2884
3243
  */
2885
3244
  enableFollowingDefaultAudioDevice(deviceType, enable) {
2886
- this.getDeviceManager().enableFollowingDefaultAudioDevice(deviceType, enable);
3245
+ this.deviceManager.enableFollowingDefaultAudioDevice(deviceType, enable);
2887
3246
  }
2888
3247
  /////////////////////////////////////////////////////////////////////////////////
2889
3248
  //
@@ -3746,7 +4105,7 @@ class TRTCCloud extends events_1.EventEmitter {
3746
4105
  *
3747
4106
  */
3748
4107
  setMusicObserver(observer) {
3749
- this.getAudioEffectManager().setMusicObserver(observer);
4108
+ this.audioEffectManager.setMusicObserver(observer);
3750
4109
  }
3751
4110
  /**
3752
4111
  * 开始播放背景音乐
@@ -3780,9 +4139,9 @@ class TRTCCloud extends events_1.EventEmitter {
3780
4139
  */
3781
4140
  startPlayMusic(musicParam, callbackMap) {
3782
4141
  if ((callbackMap === null || callbackMap === void 0 ? void 0 : callbackMap.onStart) || (callbackMap === null || callbackMap === void 0 ? void 0 : callbackMap.onPlayProgress) || (callbackMap === null || callbackMap === void 0 ? void 0 : callbackMap.onComplete)) {
3783
- this.getAudioEffectManager().setMusicObserver(callbackMap);
4142
+ this.audioEffectManager.setMusicObserver(callbackMap);
3784
4143
  }
3785
- this.getAudioEffectManager().startPlayMusic(musicParam);
4144
+ this.audioEffectManager.startPlayMusic(musicParam);
3786
4145
  }
3787
4146
  /**
3788
4147
  * 停止播放背景音乐
@@ -3790,7 +4149,7 @@ class TRTCCloud extends events_1.EventEmitter {
3790
4149
  * @param {Number} id - 音乐 ID
3791
4150
  */
3792
4151
  stopPlayMusic(id) {
3793
- this.getAudioEffectManager().stopPlayMusic(id);
4152
+ this.audioEffectManager.stopPlayMusic(id);
3794
4153
  }
3795
4154
  /**
3796
4155
  * 暂停播放背景音乐
@@ -3798,7 +4157,7 @@ class TRTCCloud extends events_1.EventEmitter {
3798
4157
  * @param {Number} id 音乐 ID
3799
4158
  */
3800
4159
  pausePlayMusic(id) {
3801
- this.getAudioEffectManager().pausePlayMusic(id);
4160
+ this.audioEffectManager.pausePlayMusic(id);
3802
4161
  }
3803
4162
  /**
3804
4163
  * 恢复播放背景音乐
@@ -3806,7 +4165,7 @@ class TRTCCloud extends events_1.EventEmitter {
3806
4165
  * @param {Number} id 音乐 ID
3807
4166
  */
3808
4167
  resumePlayMusic(id) {
3809
- this.getAudioEffectManager().resumePlayMusic(id);
4168
+ this.audioEffectManager.resumePlayMusic(id);
3810
4169
  }
3811
4170
  /**
3812
4171
  * 获取背景音乐的播放进度(单位:毫秒)
@@ -3815,7 +4174,7 @@ class TRTCCloud extends events_1.EventEmitter {
3815
4174
  * @return {Promise<number>|Number} 成功返回当前播放时间,单位:毫秒,失败返回 -1。
3816
4175
  */
3817
4176
  getMusicCurrentPosInMS(id) {
3818
- return this.getAudioEffectManager().getMusicCurrentPosInMS(id);
4177
+ return this.audioEffectManager.getMusicCurrentPosInMS(id);
3819
4178
  }
3820
4179
  /**
3821
4180
  * 获取背景音乐文件总时长,单位毫秒
@@ -3826,11 +4185,11 @@ class TRTCCloud extends events_1.EventEmitter {
3826
4185
  getMusicDurationInMS(path) {
3827
4186
  path = path.replace('file:///', '');
3828
4187
  if (TRTCCloud.isIPCMode) {
3829
- this.getAudioEffectManager().getMusicDurationInMS(path);
4188
+ this.audioEffectManager.getMusicDurationInMS(path);
3830
4189
  return this.stateStore.get(`musicDuration-{path}`);
3831
4190
  }
3832
4191
  else {
3833
- return this.getAudioEffectManager().getMusicDurationInMS(path);
4192
+ return this.audioEffectManager.getMusicDurationInMS(path);
3834
4193
  }
3835
4194
  }
3836
4195
  /**
@@ -3840,7 +4199,7 @@ class TRTCCloud extends events_1.EventEmitter {
3840
4199
  * @param {Number} pts - 单位: 毫秒
3841
4200
  */
3842
4201
  seekMusicToPosInTime(id, pts) {
3843
- this.getAudioEffectManager().seekMusicToPosInTime(id, pts);
4202
+ this.audioEffectManager.seekMusicToPosInTime(id, pts);
3844
4203
  }
3845
4204
  /**
3846
4205
  * 设置所有背景音乐的本地音量和远端音量的大小
@@ -3854,7 +4213,7 @@ class TRTCCloud extends events_1.EventEmitter {
3854
4213
  * @param {Number} volume - 音量大小,100为正常音量,取值范围为0 - 200。
3855
4214
  */
3856
4215
  setAllMusicVolume(volume) {
3857
- this.getAudioEffectManager().setAllMusicVolume(volume);
4216
+ this.audioEffectManager.setAllMusicVolume(volume);
3858
4217
  }
3859
4218
  /**
3860
4219
  * 设置背景音乐本地播放音量的大小
@@ -3865,7 +4224,7 @@ class TRTCCloud extends events_1.EventEmitter {
3865
4224
  * @param {Number} volume - 音量大小,100为正常音量,取值范围为0 - 100;默认值:100
3866
4225
  */
3867
4226
  setMusicPlayoutVolume(id, volume) {
3868
- this.getAudioEffectManager().setMusicPlayoutVolume(id, volume);
4227
+ this.audioEffectManager.setMusicPlayoutVolume(id, volume);
3869
4228
  }
3870
4229
  /**
3871
4230
  * 设置背景音乐远端播放音量的大小
@@ -3876,7 +4235,7 @@ class TRTCCloud extends events_1.EventEmitter {
3876
4235
  * @param {Number} volume - 音量大小,100为正常音量,取值范围为0 - 100;默认值:100
3877
4236
  */
3878
4237
  setMusicPublishVolume(id, volume) {
3879
- this.getAudioEffectManager().setMusicPublishVolume(id, volume);
4238
+ this.audioEffectManager.setMusicPublishVolume(id, volume);
3880
4239
  }
3881
4240
  /**
3882
4241
  * 开启耳返
@@ -3887,7 +4246,7 @@ class TRTCCloud extends events_1.EventEmitter {
3887
4246
  * @param {Boolean} enable - 是否开启耳返。
3888
4247
  */
3889
4248
  enableVoiceEarMonitor(enable) {
3890
- this.getAudioEffectManager().enableVoiceEarMonitor(enable);
4249
+ this.audioEffectManager.enableVoiceEarMonitor(enable);
3891
4250
  }
3892
4251
  /**
3893
4252
  * 设置耳返音量
@@ -3898,7 +4257,7 @@ class TRTCCloud extends events_1.EventEmitter {
3898
4257
  * @param {Number} volumn - 音量大小,取值范围为0 - 100,默认值:100。
3899
4258
  */
3900
4259
  setVoiceEarMonitorVolume(volumn) {
3901
- this.getAudioEffectManager().setVoiceEarMonitorVolume(volumn);
4260
+ this.audioEffectManager.setVoiceEarMonitorVolume(volumn);
3902
4261
  }
3903
4262
  /**
3904
4263
  * 设置语音音量
@@ -3909,7 +4268,7 @@ class TRTCCloud extends events_1.EventEmitter {
3909
4268
  * @param {Number} volume - 音量大小,取值范围为0 - 100,默认值:100。
3910
4269
  */
3911
4270
  setVoiceCaptureVolume(volume) {
3912
- this.getAudioEffectManager().setVoiceCaptureVolume(volume);
4271
+ this.audioEffectManager.setVoiceCaptureVolume(volume);
3913
4272
  }
3914
4273
  /**
3915
4274
  * 设置语音音调
@@ -3921,7 +4280,7 @@ class TRTCCloud extends events_1.EventEmitter {
3921
4280
  if (pitch < -1.0 || pitch > 1.0) {
3922
4281
  throw new Error('pitch is out of range [-1.0, 1.0]');
3923
4282
  }
3924
- this.getAudioEffectManager().setVoicePitch(pitch);
4283
+ this.audioEffectManager.setVoicePitch(pitch);
3925
4284
  }
3926
4285
  /**
3927
4286
  * 设置人声的混响效果
@@ -3933,7 +4292,7 @@ class TRTCCloud extends events_1.EventEmitter {
3933
4292
  * @param {TRTCVoiceReverbType} type - 人声的混响效果类型。
3934
4293
  */
3935
4294
  setVoiceReverbType(type) {
3936
- this.getAudioEffectManager().setVoiceReverbType(type);
4295
+ this.audioEffectManager.setVoiceReverbType(type);
3937
4296
  }
3938
4297
  /**
3939
4298
  * 设置人声的变声效果
@@ -3944,7 +4303,7 @@ class TRTCCloud extends events_1.EventEmitter {
3944
4303
  * @param {TRTCVoiceChangerType} type - 人声的变声效果类型 。
3945
4304
  */
3946
4305
  setVoiceChangerType(type) {
3947
- this.getAudioEffectManager().setVoiceChangerType(type);
4306
+ this.audioEffectManager.setVoiceChangerType(type);
3948
4307
  }
3949
4308
  /////////////////////////////////////////////////////////////////////////////////
3950
4309
  //
@@ -4166,13 +4525,13 @@ class TRTCCloud extends events_1.EventEmitter {
4166
4525
  if (playback === undefined || playback === null) {
4167
4526
  playback = false;
4168
4527
  }
4169
- this.getDeviceManager().startMicDeviceTest(interval, playback);
4528
+ this.deviceManager.startMicDeviceTest(interval, playback);
4170
4529
  }
4171
4530
  /**
4172
4531
  * 停止麦克风测试
4173
4532
  */
4174
4533
  stopMicDeviceTest() {
4175
- this.getDeviceManager().stopMicDeviceTest();
4534
+ this.deviceManager.stopMicDeviceTest();
4176
4535
  }
4177
4536
  /**
4178
4537
  * 开始进行扬声器测试
@@ -4185,13 +4544,13 @@ class TRTCCloud extends events_1.EventEmitter {
4185
4544
  */
4186
4545
  startSpeakerDeviceTest(testAudioFilePath) {
4187
4546
  testAudioFilePath = testAudioFilePath.replace('file:///', '');
4188
- this.getDeviceManager().startSpeakerDeviceTest(testAudioFilePath);
4547
+ this.deviceManager.startSpeakerDeviceTest(testAudioFilePath);
4189
4548
  }
4190
4549
  /**
4191
4550
  * 停止扬声器测试
4192
4551
  */
4193
4552
  stopSpeakerDeviceTest() {
4194
- this.getDeviceManager().stopSpeakerDeviceTest();
4553
+ this.deviceManager.stopSpeakerDeviceTest();
4195
4554
  }
4196
4555
  /////////////////////////////////////////////////////////////////////////////////
4197
4556
  //
@@ -4373,7 +4732,7 @@ class TRTCCloud extends events_1.EventEmitter {
4373
4732
  */
4374
4733
  setPluginParams(type, options) {
4375
4734
  this.logger.log(`setPluginParams params:`, type, options);
4376
- this.getPluginManager().setPluginParams(type, options);
4735
+ this.pluginManager.setPluginParams(type, options);
4377
4736
  }
4378
4737
  /**
4379
4738
  * 添加插件
@@ -4388,7 +4747,7 @@ class TRTCCloud extends events_1.EventEmitter {
4388
4747
  *
4389
4748
  */
4390
4749
  addPlugin(options) {
4391
- return this.getPluginManager().addPlugin(options);
4750
+ return this.pluginManager.addPlugin(options);
4392
4751
  }
4393
4752
  /**
4394
4753
  * 删除插件
@@ -4398,7 +4757,7 @@ class TRTCCloud extends events_1.EventEmitter {
4398
4757
  * @param [deviceId] {String} - 摄像头设备 ID,开启多个摄像头美颜时必填。
4399
4758
  */
4400
4759
  removePlugin(id, deviceId) {
4401
- this.getPluginManager().removePlugin(id, deviceId || "");
4760
+ this.pluginManager.removePlugin(id, deviceId || "");
4402
4761
  }
4403
4762
  /**
4404
4763
  * 注册插件事件监听,全局只需要调用一次
@@ -4416,7 +4775,7 @@ class TRTCCloud extends events_1.EventEmitter {
4416
4775
  * 注意:错误码:-1000 到 1000 是 SDK 预留错误码,用户自定义插件中,请使用这个范围以外的错误码。
4417
4776
  */
4418
4777
  setPluginCallback(pluginCallback) {
4419
- this.getPluginManager().setCallback(pluginCallback);
4778
+ this.pluginManager.setCallback(pluginCallback);
4420
4779
  }
4421
4780
  /**
4422
4781
  * 初始化插件管理器
@@ -4460,7 +4819,7 @@ class TRTCCloud extends events_1.EventEmitter {
4460
4819
  * @deprecated
4461
4820
  */
4462
4821
  getPluginList() {
4463
- return this.getPluginManager().getPluginList();
4822
+ return this.pluginManager.getPluginList();
4464
4823
  }
4465
4824
  //----------------------------------//
4466
4825
  // plugin API -- end
@@ -4941,51 +5300,39 @@ class TRTCCloud extends events_1.EventEmitter {
4941
5300
  // //-------------------------------------------------//
4942
5301
  /**
4943
5302
  * 获取设备管理器
4944
- *
5303
+ * @private
4945
5304
  * @returns {TRTCDeviceManager}
4946
5305
  */
4947
5306
  getDeviceManager() {
4948
- return DeviceManager_1.default.getInstance({
4949
- isIPCMode: TRTCCloud.isIPCMode,
4950
- nodeTRTCCloud: this.rtcCloud,
4951
- });
5307
+ return this.deviceManager;
4952
5308
  }
4953
5309
  /**
4954
5310
  * 获取音效管理器
4955
- *
5311
+ * @private
4956
5312
  * @returns {TRTCAudioEffectManager}
4957
5313
  */
4958
5314
  getAudioEffectManager() {
4959
- return AudioEffectManager_1.default.getInstance({
4960
- isIPCMode: TRTCCloud.isIPCMode,
4961
- nodeTRTCCloud: this.rtcCloud,
4962
- });
5315
+ return this.audioEffectManager;
4963
5316
  }
4964
5317
  /**
4965
5318
  * 获取本地混流管理器
4966
5319
  *
5320
+ * 注意:<br/>
5321
+ * 1.目前仅支持 ``Windows`` 操作系统。<br/>
5322
+ * 2.本地混流管理器必须在 [getTRTCShareInstance]{@link TRTCCloud#getTRTCShareInstance} 创建 TRTCCloud 实例时传入 `isIPCMode` 为 `true` 才支持,否则返回 null。
5323
+ *
4967
5324
  * @returns {TRTCMediaMixingManager | null}
4968
5325
  */
4969
5326
  getMediaMixingManager() {
4970
- if (TRTCCloud.isIPCMode) {
4971
- return MediaMixingManager_1.default.getInstance({
4972
- deviceManager: this.getDeviceManager()
4973
- });
4974
- }
4975
- else {
4976
- return null;
4977
- }
5327
+ return this.mediaMixingManager;
4978
5328
  }
4979
5329
  /**
4980
5330
  * 获取插件管理器
4981
- *
5331
+ * @private
4982
5332
  * @returns {TRTCPluginManager}
4983
5333
  */
4984
5334
  getPluginManager() {
4985
- return PluginManager_1.default.getInstance({
4986
- isIPCMode: TRTCCloud.isIPCMode,
4987
- nodeTRTCCloud: this.rtcCloud,
4988
- });
5335
+ return this.pluginManager;
4989
5336
  }
4990
5337
  }
4991
5338
  class VideoRenderCallback {