agora-rte-sdk 3.6.1 → 3.6.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.
@@ -174,4 +174,5 @@ export declare abstract class AgoraRtcSourceManager {
174
174
  */
175
175
  abstract adjustMicrophoneVolume(deviceId: string, volume: number): number;
176
176
  abstract release(): void;
177
+ abstract setMicrophoneKeepRecording(keepRecording: boolean): void;
177
178
  }
@@ -1116,9 +1116,14 @@ var AgoraRteScene = exports.AgoraRteScene = /*#__PURE__*/function () {
1116
1116
  onShareStreamTokenUpdated: function onShareStreamTokenUpdated(streamId, token) {
1117
1117
  _this7.logger.info("republish stream after token updated streamId: ".concat(streamId));
1118
1118
  if (streamId === stream.streamId) {
1119
- var _this7$_rtcMainChanne3, _this7$_rtcMainChanne4;
1120
- (_this7$_rtcMainChanne3 = _this7._rtcMainChannelClient) === null || _this7$_rtcMainChanne3 === void 0 || _this7$_rtcMainChanne3.publisher.publishLocalAudioStream(token, stream.streamId, stream.audioSourceId, stream.audioSourceType);
1121
- (_this7$_rtcMainChanne4 = _this7._rtcMainChannelClient) === null || _this7$_rtcMainChanne4 === void 0 || _this7$_rtcMainChanne4.publisher.publishLocalVideoStream(token, stream.streamId, stream.videoSourceId, stream.videoSourceType);
1119
+ if (shouldPublishAudio) {
1120
+ var _this7$_rtcMainChanne3;
1121
+ (_this7$_rtcMainChanne3 = _this7._rtcMainChannelClient) === null || _this7$_rtcMainChanne3 === void 0 || _this7$_rtcMainChanne3.publisher.publishLocalAudioStream(token, stream.streamId, stream.audioSourceId, stream.audioSourceType);
1122
+ }
1123
+ if (shouldPublishVideo) {
1124
+ var _this7$_rtcMainChanne4;
1125
+ (_this7$_rtcMainChanne4 = _this7._rtcMainChannelClient) === null || _this7$_rtcMainChanne4 === void 0 || _this7$_rtcMainChanne4.publisher.publishLocalVideoStream(token, stream.streamId, stream.videoSourceId, stream.videoSourceType);
1126
+ }
1122
1127
  _this7.localUser.removeObserver(observer);
1123
1128
  }
1124
1129
  },
@@ -15,4 +15,5 @@ export declare const getRtcWebExternaApConfig: (parameters?: AgoraRteEngineParam
15
15
  export declare const getRtcWebInternaApConfig: (parameters?: AgoraRteEngineParameters) => {} | undefined;
16
16
  export declare const getApDetectTimeout: (parameters?: AgoraRteEngineParameters) => number | undefined;
17
17
  export declare const getApDetectIsRedetect: (parameters?: AgoraRteEngineParameters) => boolean | undefined;
18
+ export declare const getRtcMicrophoneKeepRecording: (parameters?: Record<string, unknown>) => boolean | undefined;
18
19
  export {};
@@ -4,7 +4,7 @@ require("core-js/modules/es.object.define-property.js");
4
4
  Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
- exports.isEndpointRegionDisabled = exports.getRtmOriginDomains = exports.getRtmLogUploadHosts = exports.getRtmIpList = exports.getRtmEventUploadHosts = exports.getRteIpList = exports.getRtcWebInternaApConfig = exports.getRtcWebExternaApConfig = exports.getRtcInternaApConfig = exports.getRtcExternaApConfig = exports.getApDetectTimeout = exports.getApDetectIsRedetect = void 0;
7
+ exports.isEndpointRegionDisabled = exports.getRtmOriginDomains = exports.getRtmLogUploadHosts = exports.getRtmIpList = exports.getRtmEventUploadHosts = exports.getRteIpList = exports.getRtcWebInternaApConfig = exports.getRtcWebExternaApConfig = exports.getRtcMicrophoneKeepRecording = exports.getRtcInternaApConfig = exports.getRtcExternaApConfig = exports.getApDetectTimeout = exports.getApDetectIsRedetect = void 0;
8
8
  var _imports = require("../../imports");
9
9
  var getRteIpList = exports.getRteIpList = function getRteIpList(parameters) {
10
10
  var _parameters$rte;
@@ -79,4 +79,9 @@ var getApDetectIsRedetect = exports.getApDetectIsRedetect = function getApDetect
79
79
  if (parameters !== null && parameters !== void 0 && (_parameters$rte16 = parameters.rte) !== null && _parameters$rte16 !== void 0 && _parameters$rte16.apDetectIsRedetect) {
80
80
  return parameters.rte.apDetectIsRedetect;
81
81
  }
82
+ };
83
+ var getRtcMicrophoneKeepRecording = exports.getRtcMicrophoneKeepRecording = function getRtcMicrophoneKeepRecording(parameters) {
84
+ if (typeof (parameters === null || parameters === void 0 ? void 0 : parameters['rtc.microphone.keep.recording']) === 'boolean') {
85
+ return parameters['rtc.microphone.keep.recording'];
86
+ }
82
87
  };
@@ -16,5 +16,5 @@ export declare class AgoraRtcCanvasHelperImpl extends AgoraRtcCanvasHelper {
16
16
  addTagWithCanvasId(canvasAddress: HTMLElement, sourceId: string, canvas: AgoraRtcVideoCanvas, isLocal: boolean, connection?: AgoraRtcConnection): void;
17
17
  ifNeedStopRenderCanvas(canvasAddress: HTMLElement): void;
18
18
  stopRenderOnAllCanvasWithSourceId(sourceId: string): void;
19
- getLocalCanvasCount(): number;
19
+ isLastLocalCanvas(sourceId: string): boolean;
20
20
  }
@@ -175,12 +175,13 @@ var AgoraRtcCanvasHelperImpl = exports.AgoraRtcCanvasHelperImpl = /*#__PURE__*/f
175
175
  // @ts-ignore
176
176
  AgoraEnv.AgoraRendererManager._rendererCaches);
177
177
  this._rtcEngine.destroyRendererByView(canvasTag.canvas.view);
178
+ var isLast = this.isLastLocalCanvas(canvasTag.sourceId);
179
+ if (isLast) {
180
+ this._rtcEngine.stopPreview();
181
+ }
178
182
  }
179
183
  canvasAddress.innerHTML = '';
180
184
  this.canvasTagPool["delete"](canvasAddress);
181
- if (this.getLocalCanvasCount() === 0) {
182
- // this._rtcEngine.stopPreview();
183
- }
184
185
  }
185
186
  }
186
187
  }, {
@@ -220,26 +221,30 @@ var AgoraRtcCanvasHelperImpl = exports.AgoraRtcCanvasHelperImpl = /*#__PURE__*/f
220
221
  // @ts-ignore
221
222
  AgoraEnv.AgoraRendererManager._rendererCaches);
222
223
  _this3._rtcEngine.destroyRendererByView(canvasTag.canvas.view);
224
+ var isLast = _this3.isLastLocalCanvas(canvasTag.sourceId);
225
+ if (isLast) {
226
+ _this3._rtcEngine.stopPreview();
227
+ }
223
228
  }
224
229
  canvasAddress.innerHTML = '';
225
230
  _this3.canvasTagPool["delete"](canvasAddress);
226
- if (_this3.getLocalCanvasCount() === 0) {
227
- // this._rtcEngine.stopPreview();
228
- }
229
231
  }
230
232
  });
231
233
  }
232
234
  }, {
233
- key: "getLocalCanvasCount",
234
- value: function getLocalCanvasCount() {
235
- return Array.from(this.canvasTagPool.values()).filter(function (tag) {
235
+ key: "isLastLocalCanvas",
236
+ value: function isLastLocalCanvas(sourceId) {
237
+ var localCanvas = Array.from(this.canvasTagPool.values()).filter(function (tag) {
236
238
  return tag.isLocal;
237
- }).length;
239
+ });
240
+ var result = localCanvas.length === 1 && localCanvas[0].sourceId === sourceId;
241
+ logger.info('start/stop preview render isLastLocalCanvas', result, localCanvas.length, sourceId);
242
+ return result;
238
243
  }
239
244
  }]);
240
245
  }(_canvas3.AgoraRtcCanvasHelper);
241
246
  _AgoraRtcCanvasHelperImpl = AgoraRtcCanvasHelperImpl;
242
- var _applyDecs$e = _applyDecs(_AgoraRtcCanvasHelperImpl, [[_imports.trace, 2, "bind"], [_imports.trace, 2, "unbind"], [_imports.trace, 2, "unbindAll"], [_imports.trace, 2, "getTagWithCanvasId"], [_imports.trace, 2, "addTagWithCanvasId"], [_imports.trace, 2, "ifNeedStopRenderCanvas"], [_imports.trace, 2, "stopRenderOnAllCanvasWithSourceId"], [_imports.trace, 2, "getLocalCanvasCount"]], [], 0, void 0, _canvas3.AgoraRtcCanvasHelper).e;
247
+ var _applyDecs$e = _applyDecs(_AgoraRtcCanvasHelperImpl, [[_imports.trace, 2, "bind"], [_imports.trace, 2, "unbind"], [_imports.trace, 2, "unbindAll"], [_imports.trace, 2, "getTagWithCanvasId"], [_imports.trace, 2, "addTagWithCanvasId"], [_imports.trace, 2, "ifNeedStopRenderCanvas"], [_imports.trace, 2, "stopRenderOnAllCanvasWithSourceId"], [_imports.trace, 2, "isLastLocalCanvas"]], [], 0, void 0, _canvas3.AgoraRtcCanvasHelper).e;
243
248
  var _applyDecs$e2 = (0, _slicedToArray2["default"])(_applyDecs$e, 1);
244
249
  _initProto = _applyDecs$e2[0];
245
250
  _applyDecs$e;
@@ -203,7 +203,11 @@ var AgoraRtcCaptureEnhancementImpl = exports.AgoraRtcCaptureEnhancementImpl = /*
203
203
  key: "enableEchoCancellation",
204
204
  value: function enableEchoCancellation(deviceId) {
205
205
  return this._rtcEngine.setParameters(JSON.stringify({
206
- 'che.audio.aec.enable': true
206
+ 'che.audio.aec.enable': true,
207
+ 'che.audio.aec': {
208
+ aggressiveness: 2,
209
+ applySource: 1
210
+ }
207
211
  }));
208
212
  }
209
213
  }, {
@@ -27,6 +27,7 @@ export declare class AgoraRtcChannelClientImpl extends AgoraRtcChannelClient {
27
27
  private _rtcStatsTask;
28
28
  private _rtcConnection;
29
29
  private _rtcClientChannelObserver;
30
+ private _renderedRemoteVideoStreamIds;
30
31
  constructor(_channelId: string, _latencyLevel: AgoraRtcLatencyLevelType, _rtcEngine: IRtcEngineEx, _sourceManager: AgoraRtcSourceManager, _rtcConfigs: AgoraElectronRtcClientInitConfig, _rtcClientObservable: AgoraObservable<AgoraRtcClientObserver>, _parameters?: string | undefined);
31
32
  get rtcConnection(): AgoraRtcConnection;
32
33
  get localUid(): number;
@@ -33,6 +33,7 @@ require("core-js/modules/es.number.constructor.js");
33
33
  require("core-js/modules/es.object.to-string.js");
34
34
  require("core-js/modules/es.parse-int.js");
35
35
  require("core-js/modules/es.promise.js");
36
+ require("core-js/modules/es.set.js");
36
37
  require("core-js/modules/es.string.includes.js");
37
38
  require("core-js/modules/es.string.iterator.js");
38
39
  require("core-js/modules/esnext.async-iterator.for-each.js");
@@ -52,6 +53,29 @@ require("core-js/modules/esnext.map.merge.js");
52
53
  require("core-js/modules/esnext.map.reduce.js");
53
54
  require("core-js/modules/esnext.map.some.js");
54
55
  require("core-js/modules/esnext.map.update.js");
56
+ require("core-js/modules/esnext.set.add-all.js");
57
+ require("core-js/modules/esnext.set.delete-all.js");
58
+ require("core-js/modules/esnext.set.difference.v2.js");
59
+ require("core-js/modules/esnext.set.difference.js");
60
+ require("core-js/modules/esnext.set.every.js");
61
+ require("core-js/modules/esnext.set.filter.js");
62
+ require("core-js/modules/esnext.set.find.js");
63
+ require("core-js/modules/esnext.set.intersection.v2.js");
64
+ require("core-js/modules/esnext.set.intersection.js");
65
+ require("core-js/modules/esnext.set.is-disjoint-from.v2.js");
66
+ require("core-js/modules/esnext.set.is-disjoint-from.js");
67
+ require("core-js/modules/esnext.set.is-subset-of.v2.js");
68
+ require("core-js/modules/esnext.set.is-subset-of.js");
69
+ require("core-js/modules/esnext.set.is-superset-of.v2.js");
70
+ require("core-js/modules/esnext.set.is-superset-of.js");
71
+ require("core-js/modules/esnext.set.join.js");
72
+ require("core-js/modules/esnext.set.map.js");
73
+ require("core-js/modules/esnext.set.reduce.js");
74
+ require("core-js/modules/esnext.set.some.js");
75
+ require("core-js/modules/esnext.set.symmetric-difference.v2.js");
76
+ require("core-js/modules/esnext.set.symmetric-difference.js");
77
+ require("core-js/modules/esnext.set.union.v2.js");
78
+ require("core-js/modules/esnext.set.union.js");
55
79
  require("core-js/modules/web.dom-collections.for-each.js");
56
80
  require("core-js/modules/web.dom-collections.iterator.js");
57
81
  var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
@@ -112,6 +136,7 @@ var AgoraRtcChannelClientImpl = exports.AgoraRtcChannelClientImpl = /*#__PURE__*
112
136
  });
113
137
  (0, _defineProperty2["default"])(_this, "_cameraViews", new Map());
114
138
  (0, _defineProperty2["default"])(_this, "_rtcStatsTask", null);
139
+ (0, _defineProperty2["default"])(_this, "_renderedRemoteVideoStreamIds", new Set());
115
140
  _this._channelId = _channelId;
116
141
  _this._latencyLevel = _latencyLevel;
117
142
  _this._rtcEngine = _rtcEngine;
@@ -324,11 +349,15 @@ var AgoraRtcChannelClientImpl = exports.AgoraRtcChannelClientImpl = /*#__PURE__*
324
349
  };
325
350
  _this3._rtcEngine.setupRemoteVideoEx(videoCanvas1, tag.connection);
326
351
  _this3._rtcEngine.destroyRendererByView(tag.canvas.view);
352
+ var renderModeType = tag.canvas.renderMode === _type.AgoraRtcRenderMode.FIT ? 2 : 1;
353
+ var mirrorModeType = tag.canvas.mirror ? 1 : 2;
327
354
  var videoCanvas2 = {
328
355
  uid: +tag.sourceId,
329
356
  view: tag.canvas.view,
330
357
  sourceType: 9,
331
- setupMode: 1
358
+ setupMode: 1,
359
+ renderMode: renderModeType,
360
+ mirrorMode: mirrorModeType
332
361
  };
333
362
  _this3._rtcEngine.setupRemoteVideoEx(videoCanvas2, tag.connection);
334
363
  }
@@ -351,12 +380,14 @@ var AgoraRtcChannelClientImpl = exports.AgoraRtcChannelClientImpl = /*#__PURE__*
351
380
  }, {
352
381
  key: "startRenderRemoteVideoStream",
353
382
  value: function startRenderRemoteVideoStream(streamId, view, streamType, renderMode, isMirror) {
383
+ this._renderedRemoteVideoStreamIds.add(streamId);
354
384
  this._rtcEngine.setRemoteVideoStreamTypeEx(+streamId, streamType === _type.AgoraRtcVideoStreamType.HIGH_STREAM ? 0 : 1, this._rtcConnection);
355
385
  return (0, _utils.startVideoRender)(this._rtcEngine, streamId, view, renderMode, isMirror, _type.AgoraRtcRenderSourceType.REMOTE_STREAM, this.canvasHelper, this._sourceManager, this._rtcConnection);
356
386
  }
357
387
  }, {
358
388
  key: "stopRenderRemoteVideoStream",
359
389
  value: function stopRenderRemoteVideoStream(streamId, view) {
390
+ this._renderedRemoteVideoStreamIds["delete"](streamId);
360
391
  this.canvasHelper.ifNeedStopRenderCanvas(view);
361
392
  return this.canvasHelper.unbind(view);
362
393
  }
@@ -429,7 +460,9 @@ var AgoraRtcChannelClientImpl = exports.AgoraRtcChannelClientImpl = /*#__PURE__*
429
460
  }, {
430
461
  key: "_clean",
431
462
  value: function _clean() {
432
- var _this$_rtcStatsTask, _this$_disconnectedTa;
463
+ var _this$_rtcStatsTask,
464
+ _this$_disconnectedTa,
465
+ _this5 = this;
433
466
  this._rtcEngine.removeListener('onJoinChannelSuccess', this._joinSuccessCallback);
434
467
  this._rtcEngine.removeListener('onAudioVolumeIndication', this._handleRemoteAudioVolumeUpdated);
435
468
  this._rtcEngine.removeListener('onNetworkQuality', this._handleNetworkQuality);
@@ -452,6 +485,9 @@ var AgoraRtcChannelClientImpl = exports.AgoraRtcChannelClientImpl = /*#__PURE__*
452
485
  this.subscriber.release();
453
486
  this._rtcEngine.leaveChannelEx(this._rtcConnection);
454
487
  this.removeObserver(this._rtcClientChannelObserver);
488
+ this._renderedRemoteVideoStreamIds.forEach(function (streamId) {
489
+ _this5.stopRenderRemoteVideoStreamOnAllCanvas(streamId);
490
+ });
455
491
  }
456
492
  }, {
457
493
  key: "_getEncryptionConfig",
@@ -481,13 +517,13 @@ var AgoraRtcChannelClientImpl = exports.AgoraRtcChannelClientImpl = /*#__PURE__*
481
517
  }, {
482
518
  key: "_handleRemoteAudioVolumeUpdated",
483
519
  value: function _handleRemoteAudioVolumeUpdated(connection, speakers, speakerNumber, totalVolume) {
484
- var _this5 = this;
520
+ var _this6 = this;
485
521
  if (connection.channelId !== this._rtcConnection.channelId) {
486
522
  return;
487
523
  }
488
524
  speakers.forEach(function (speaker) {
489
525
  if (speaker.uid) {
490
- _this5.observable.notifyObservers('onVolumeIndicationUpdated', "".concat(speaker.uid), speaker.volume, _this5._channelId);
526
+ _this6.observable.notifyObservers('onVolumeIndicationUpdated', "".concat(speaker.uid), speaker.volume, _this6._channelId);
491
527
  }
492
528
  });
493
529
  }
@@ -674,7 +710,7 @@ var AgoraRtcChannelClientImpl = exports.AgoraRtcChannelClientImpl = /*#__PURE__*
674
710
  }, {
675
711
  key: "_handleConnectionStateChanged",
676
712
  value: function _handleConnectionStateChanged(connection, state, reason) {
677
- var _this6 = this;
713
+ var _this7 = this;
678
714
  if (connection.localUid === this._rtcConnection.localUid && connection.channelId === this._rtcConnection.channelId) {
679
715
  if (state !== 3) {
680
716
  // 当 connecitonState !== connected 时
@@ -685,7 +721,7 @@ var AgoraRtcChannelClientImpl = exports.AgoraRtcChannelClientImpl = /*#__PURE__*
685
721
  }
686
722
  if (this._disconnectedTask) return;
687
723
  this._disconnectedTask = _schedule.AgoraScheduler.shared.addDelayTask(function () {
688
- _this6.observable.notifyObservers('onConnectionStateUpdated', connection.channelId, _type.AgoraRtcConnectionState.ABORTED);
724
+ _this7.observable.notifyObservers('onConnectionStateUpdated', connection.channelId, _type.AgoraRtcConnectionState.ABORTED);
689
725
  }, _scheduler.Duration.minute(5));
690
726
  } else {
691
727
  // 当 connecitonState == connected 时
@@ -90,6 +90,7 @@ var _canvasHelper = require("./canvas-helper");
90
90
  var _decorator = require("agora-foundation/lib/decorator");
91
91
  var _dowloadALD = require("./dowloadALD");
92
92
  var _logger = require("../../../core/utilities/logger");
93
+ var _parameters2 = require("../../../core/utilities/parameters");
93
94
  var _excluded = ["screen"];
94
95
  var _AgoraRtcClientImpl;
95
96
  var _initProto;
@@ -124,9 +125,9 @@ var AgoraRtcClientImpl = exports.AgoraRtcClientImpl = /*#__PURE__*/function (_Ag
124
125
  userDataPath = remote.app.getPath('userData');
125
126
  fs = remote.require('fs');
126
127
  JSZip = remote.require('jszip');
127
- ALD_URL = 'https://solutions-apaas.agora.io/lib/desktop/AgoraALD_4.2.6_build.9_rc.1_notarized.zip'; // const zipCacheDir = path.resolve(userDataPath, `AgoraALD`);
128
+ ALD_URL = 'https://solutions-apaas.agora.io/lib/desktop/AgoraALD_20250618.driver.zip'; // const zipCacheDir = path.resolve(userDataPath, `AgoraALD`);
128
129
  zipCacheDir = path.resolve(os.tmpdir(), "AgoraALD"); // const zipCacheDir = path.resolve("/Users/chengqiaoqiao", `AgoraALD`);
129
- zipFileName = 'AgoraALD_4.2.6_build.9_rc.1.zip';
130
+ zipFileName = 'AgoraALD_20250618.driver.zip';
130
131
  zipExtensions = ['.zip'];
131
132
  zipFiles = (0, _dowloadALD.getSpecificFiles)(zipCacheDir, zipExtensions, zipFileName);
132
133
  zipPath = path.resolve("".concat(zipCacheDir, "/").concat(zipFileName)); // 没有 zip,需要下载
@@ -254,7 +255,8 @@ var AgoraRtcClientImpl = exports.AgoraRtcClientImpl = /*#__PURE__*/function (_Ag
254
255
  }, {
255
256
  key: "stopRenderCameraPreviewOnAllCanvas",
256
257
  value: function stopRenderCameraPreviewOnAllCanvas(deviceId) {
257
- // this._rtcEngine.stopPreview();
258
+ this.logger.info('start/stop preview stopRenderCameraPreviewOnAllCanvas');
259
+ this._rtcEngine.stopPreview();
258
260
  this.canvasHelper.stopRenderOnAllCanvasWithSourceId(deviceId);
259
261
  return this.canvasHelper.unbindAll(deviceId, _type.AgoraRtcRenderSourceType.LOCAL_CAMERA);
260
262
  }
@@ -429,6 +431,12 @@ var AgoraRtcClientImpl = exports.AgoraRtcClientImpl = /*#__PURE__*/function (_Ag
429
431
  var _JSON$parse = JSON.parse(parameters),
430
432
  screen = _JSON$parse.screen,
431
433
  mainParameters = (0, _objectWithoutProperties2["default"])(_JSON$parse, _excluded);
434
+ this.logger.info("[MicrophoneKeepRecording][setParameters] mainParameters ==> ".concat(JSON.stringify(mainParameters)));
435
+ var microphoneKeepRecording = (0, _parameters2.getRtcMicrophoneKeepRecording)(mainParameters);
436
+ this.logger.info("[MicrophoneKeepRecording][setParameters] microphoneKeepRecording ==> ".concat(JSON.stringify(microphoneKeepRecording)));
437
+ if (microphoneKeepRecording !== undefined) {
438
+ this.sourceManager.setMicrophoneKeepRecording(microphoneKeepRecording);
439
+ }
432
440
  var keys = Object.keys(mainParameters);
433
441
  if (keys.length > 0) {
434
442
  this._mainParameters = JSON.stringify(mainParameters);
@@ -1,4 +1,4 @@
1
- import type { IRtcEngineEx, RtcConnection } from 'agora-electron-sdk';
1
+ import type { IRtcEngineEx } from 'agora-electron-sdk';
2
2
  export declare class AgoraRtcLoopbackAudioMixer {
3
3
  private _rtcEngine;
4
4
  sourceId?: string;
@@ -9,6 +9,4 @@ export declare class AgoraRtcLoopbackAudioMixer {
9
9
  startLoopbackRecording(sourceId: string): number;
10
10
  updateLoopbackAudioVolume(volume: number): number;
11
11
  stopLoopbackRecording(sourceId: string): number;
12
- publishLoopbackToConnection(connection: RtcConnection): number;
13
- unpublishToConnection(connection: RtcConnection): number;
14
12
  }
@@ -39,20 +39,7 @@ var AgoraRtcLoopbackAudioMixer = exports.AgoraRtcLoopbackAudioMixer = /*#__PURE_
39
39
  key: "stopLoopbackRecording",
40
40
  value: function stopLoopbackRecording(sourceId) {
41
41
  this.sourceId = undefined;
42
- this._rtcEngine.enableLoopbackRecordingEx({}, false, sourceId);
43
42
  return 0;
44
43
  }
45
- }, {
46
- key: "publishLoopbackToConnection",
47
- value: function publishLoopbackToConnection(connection) {
48
- var res = this._rtcEngine.enableLoopbackRecordingEx(connection, true, this.sourceId ? this.sourceId : undefined);
49
- return res;
50
- }
51
- }, {
52
- key: "unpublishToConnection",
53
- value: function unpublishToConnection(connection) {
54
- var res = this._rtcEngine.enableLoopbackRecordingEx(connection, false, this.sourceId ? this.sourceId : undefined);
55
- return res;
56
- }
57
44
  }]);
58
45
  }();
@@ -11,6 +11,9 @@ export declare class AgoraRtcChannelPublisherImpl extends AgoraRtcChannelPublish
11
11
  publishPool: AgoraElectronRtcStreamPublishPool;
12
12
  private _publishVideoMapping;
13
13
  private _publishAudioMapping;
14
+ private _loopbackConnection;
15
+ private _loopbackDeviceId;
16
+ private _isLoopbackEnabled;
14
17
  constructor(_rtcEngine: IRtcEngineEx, mainConnection: AgoraRtcConnection, latencyLevel: AgoraRtcLatencyLevelType, _sourceManager: AgoraRtcSourceManager, _config: AgoraElectronRtcClientInitConfig);
15
18
  private _sourceManagerObserver;
16
19
  private _publishPoolObserver;
@@ -26,4 +29,5 @@ export declare class AgoraRtcChannelPublisherImpl extends AgoraRtcChannelPublish
26
29
  release(): void;
27
30
  private _getVideoState;
28
31
  private _getAudioState;
32
+ private _enableLoopbackRecording;
29
33
  }
@@ -85,6 +85,9 @@ var AgoraRtcChannelPublisherImpl = exports.AgoraRtcChannelPublisherImpl = /*#__P
85
85
  })));
86
86
  (0, _defineProperty2["default"])(_this, "_publishVideoMapping", new Map());
87
87
  (0, _defineProperty2["default"])(_this, "_publishAudioMapping", new Map());
88
+ (0, _defineProperty2["default"])(_this, "_loopbackConnection", undefined);
89
+ (0, _defineProperty2["default"])(_this, "_loopbackDeviceId", undefined);
90
+ (0, _defineProperty2["default"])(_this, "_isLoopbackEnabled", false);
88
91
  (0, _defineProperty2["default"])(_this, "_sourceManagerObserver", {
89
92
  onCameraStateUpdated: function onCameraStateUpdated(deivceId, state) {
90
93
  _this.publishPool.updateVideoSource(deivceId, _type4.AgoraRtcVideoSourceType.CAMERA, state);
@@ -140,7 +143,7 @@ var AgoraRtcChannelPublisherImpl = exports.AgoraRtcChannelPublisherImpl = /*#__P
140
143
  if (item.connection) {
141
144
  _this._rtcEngine.leaveChannelEx(item.connection);
142
145
  if (item.audioSourceType === _type4.AgoraRtcAudioSourceType.LOOPBACK) {
143
- _this._rtcEngine.enableLoopbackRecordingEx(item.connection, false, _this.sourceManager.getLoopbackDeviceId());
146
+ _this._enableLoopbackRecording(item.connection, false, _this.sourceManager.getLoopbackDeviceId());
144
147
  }
145
148
  }
146
149
  },
@@ -165,9 +168,9 @@ var AgoraRtcChannelPublisherImpl = exports.AgoraRtcChannelPublisherImpl = /*#__P
165
168
  if (!item.connection) return;
166
169
  if (item.audioSourceType === _type4.AgoraRtcAudioSourceType.LOOPBACK) {
167
170
  if (item.audioHasPublished) {
168
- this._rtcEngine.enableLoopbackRecordingEx(item.connection, true, this.sourceManager.getLoopbackDeviceId());
171
+ this._enableLoopbackRecording(item.connection, true, this.sourceManager.getLoopbackDeviceId());
169
172
  } else {
170
- this._rtcEngine.enableLoopbackRecordingEx(item.connection, false, this.sourceManager.getLoopbackDeviceId());
173
+ this._enableLoopbackRecording(item.connection, false, this.sourceManager.getLoopbackDeviceId());
171
174
  }
172
175
  }
173
176
  }
@@ -343,6 +346,16 @@ var AgoraRtcChannelPublisherImpl = exports.AgoraRtcChannelPublisherImpl = /*#__P
343
346
  var state = type === _type4.AgoraRtcAudioSourceType.LOOPBACK ? this._sourceManager.getLoopbackRecordingState(sourceId) : this._sourceManager.getMicrophoneState(sourceId);
344
347
  return state;
345
348
  }
349
+ }, {
350
+ key: "_enableLoopbackRecording",
351
+ value: function _enableLoopbackRecording(connection, enabled, deviceId) {
352
+ if (deviceId !== this._loopbackDeviceId || this._isLoopbackEnabled !== enabled || this._loopbackConnection !== connection) {
353
+ this._loopbackDeviceId = deviceId;
354
+ this._isLoopbackEnabled = enabled;
355
+ this._loopbackConnection = connection;
356
+ this._rtcEngine.enableLoopbackRecordingEx(connection, enabled, deviceId);
357
+ }
358
+ }
346
359
  }]);
347
360
  }(_publisher.AgoraRtcChannelPublisher);
348
361
  _AgoraRtcChannelPublisherImpl = AgoraRtcChannelPublisherImpl;
@@ -8,6 +8,8 @@ export declare class AgoraRtcSourceManagerImpl extends AgoraRtcSourceManager {
8
8
  private _currentMicrophoneDeviceId?;
9
9
  private _cameraSourceIndexMapping;
10
10
  private _availableCameraSourceIndex;
11
+ private _microphoneIsRecording;
12
+ private _microphoneKeepRecording;
11
13
  cameraDeviceStatusMapping: Map<string, AgoraRtcDeviceStatusFlag>;
12
14
  microphoneDeviceStatusMapping: Map<string, AgoraRtcDeviceStatusFlag>;
13
15
  release(): void;
@@ -45,6 +47,7 @@ export declare class AgoraRtcSourceManagerImpl extends AgoraRtcSourceManager {
45
47
  getSystemSelectedSpeaker(): AgoraRtcDeviceInfo;
46
48
  getWindowList(thumbSize?: Size, iconSize?: Size): Promise<AgoraRtcWindowInfo[]>;
47
49
  getDisplayList(thumbSize?: Size, iconSize?: Size): Promise<AgoraRtcDisplayInfo[]>;
50
+ setMicrophoneKeepRecording(keepRecording: boolean): void;
48
51
  private _handleVideoSourceVideoStateChanged;
49
52
  private _handleLocalAudioStateChanged;
50
53
  private _handleVideoDeviceChanged;
@@ -145,6 +145,8 @@ var AgoraRtcSourceManagerImpl = exports.AgoraRtcSourceManagerImpl = /*#__PURE__*
145
145
  (0, _defineProperty2["default"])(_this, "_screenCaptureSourceId", '');
146
146
  (0, _defineProperty2["default"])(_this, "_cameraSourceIndexMapping", new Map());
147
147
  (0, _defineProperty2["default"])(_this, "_availableCameraSourceIndex", [_type2.AgoraRtcCameraSourceIndex.PRIMARY, _type2.AgoraRtcCameraSourceIndex.SECONDARY, _type2.AgoraRtcCameraSourceIndex.THIRD, _type2.AgoraRtcCameraSourceIndex.FOURTH]);
148
+ (0, _defineProperty2["default"])(_this, "_microphoneIsRecording", false);
149
+ (0, _defineProperty2["default"])(_this, "_microphoneKeepRecording", false);
148
150
  (0, _defineProperty2["default"])(_this, "cameraDeviceStatusMapping", new Map());
149
151
  (0, _defineProperty2["default"])(_this, "microphoneDeviceStatusMapping", new Map());
150
152
  //@internal
@@ -320,10 +322,12 @@ var AgoraRtcSourceManagerImpl = exports.AgoraRtcSourceManagerImpl = /*#__PURE__*
320
322
  }, {
321
323
  key: "closeMicrophone",
322
324
  value: function closeMicrophone(deviceId) {
323
- var isTesting = (this.microphoneDeviceStatusMapping.get(deviceId) || 0) & _type2.AgoraRtcDeviceStatusFlag.TESTING;
324
325
  var res = 0;
325
- if (!isTesting) {
326
- res = this._stopMicrophoneCapture(deviceId);
326
+ if (!this._microphoneKeepRecording) {
327
+ var isTesting = (this.microphoneDeviceStatusMapping.get(deviceId) || 0) & _type2.AgoraRtcDeviceStatusFlag.TESTING;
328
+ if (!isTesting) {
329
+ res = this._stopMicrophoneCapture(deviceId);
330
+ }
327
331
  }
328
332
  var status = this.microphoneDeviceStatusMapping.get(deviceId) || 0;
329
333
  this.microphoneDeviceStatusMapping.set(deviceId, status &= ~_type2.AgoraRtcDeviceStatusFlag.ON);
@@ -573,6 +577,22 @@ var AgoraRtcSourceManagerImpl = exports.AgoraRtcSourceManagerImpl = /*#__PURE__*
573
577
  resolve(displayList);
574
578
  });
575
579
  }
580
+ }, {
581
+ key: "setMicrophoneKeepRecording",
582
+ value: function setMicrophoneKeepRecording(keepRecording) {
583
+ this._microphoneKeepRecording = keepRecording;
584
+ this.logger.info("[MicrophoneKeepRecording][setMicrophoneKeepRecording] keepRecording ==> ".concat(keepRecording, ", _microphoneIsRecording ==> ").concat(this._microphoneIsRecording));
585
+ if (keepRecording && !this._microphoneIsRecording) {
586
+ this._rtcEngine.enableLocalAudio(true);
587
+ this._rtcEngine.getAudioDeviceManager().startRecordingDeviceTest(_utils.VOLUME_INDICATION_INTERVAL);
588
+ this._microphoneIsRecording = true;
589
+ }
590
+ if (!keepRecording && this._microphoneIsRecording) {
591
+ this._rtcEngine.getAudioDeviceManager().stopRecordingDeviceTest();
592
+ this._rtcEngine.disableAudio();
593
+ this._microphoneIsRecording = false;
594
+ }
595
+ }
576
596
  }, {
577
597
  key: "_handleVideoSourceVideoStateChanged",
578
598
  value: function _handleVideoSourceVideoStateChanged(state, reason) {
@@ -860,7 +880,7 @@ var AgoraRtcSourceManagerImpl = exports.AgoraRtcSourceManagerImpl = /*#__PURE__*
860
880
  }]);
861
881
  }(_sourceManager.AgoraRtcSourceManager);
862
882
  _AgoraRtcSourceManagerImpl = AgoraRtcSourceManagerImpl;
863
- var _applyDecs$e = _applyDecs(_AgoraRtcSourceManagerImpl, [[_decorator.trace, 2, "setCameraCaptureParams"], [_decorator.trace, 2, "openCamera"], [_decorator.trace, 2, "closeCamera"], [_decorator.trace, 2, "startCameraTest"], [_decorator.trace, 2, "stopCameraTest"], [_decorator.trace, 2, "openMicrophone"], [_decorator.trace, 2, "closeMicrophone"], [_decorator.trace, 2, "startMicrophoneTest"], [_decorator.trace, 2, "stopMicrophoneTest"], [_decorator.trace, 2, "startScreenCaptureByDisplayId"], [_decorator.trace, 2, "startScreenCaptureByWindowId"], [_decorator.trace, 2, "stopScreenCapture"], [_decorator.trace, 2, "startLoopbackRecording"], [_decorator.trace, 2, "stopLoopbackRecording"], [_decorator.trace, 2, "adjustLoopbackVolume"], [_decorator.trace, 2, "adjustMicrophoneVolume"], [_decorator.trace, 2, "getWindowList"], [_decorator.trace, 2, "getDisplayList"], [_decorator.bound, 2, "_handleVideoSourceVideoStateChanged"], [_decorator.bound, 2, "_handleLocalAudioStateChanged"], [_decorator.bound, 2, "_handleVideoDeviceChanged"], [_decorator.bound, 2, "_handleAudioDeviceChanged"], [_decorator.bound, 2, "_handleLocalVideoStateChanged"], [_decorator.bound, 2, "_handleLocalAudioError"], [_decorator.bound, 2, "_initializeDeviceList"], [_decorator.bound, 2, "_pickCurrentWindowId"], [_decorator.bound, 2, "_startCameraCapture"], [_decorator.bound, 2, "_stopCameraCapture"], [_decorator.bound, 2, "_startMicrophoneCapture"], [_decorator.bound, 2, "_stopMicrophoneCapture"], [_decorator.bound, 2, "_generateVideoSourceIndex"], [_decorator.bound, 2, "_bindDeviceIdToSourceType"], [_decorator.bound, 2, "_unbindDeviceIdToSourceType"], [_decorator.bound, 2, "_handleVolumeIndicatorUpdated"]], [], 0, void 0, _sourceManager.AgoraRtcSourceManager).e;
883
+ var _applyDecs$e = _applyDecs(_AgoraRtcSourceManagerImpl, [[_decorator.trace, 2, "setCameraCaptureParams"], [_decorator.trace, 2, "openCamera"], [_decorator.trace, 2, "closeCamera"], [_decorator.trace, 2, "startCameraTest"], [_decorator.trace, 2, "stopCameraTest"], [_decorator.trace, 2, "openMicrophone"], [_decorator.trace, 2, "closeMicrophone"], [_decorator.trace, 2, "startMicrophoneTest"], [_decorator.trace, 2, "stopMicrophoneTest"], [_decorator.trace, 2, "startScreenCaptureByDisplayId"], [_decorator.trace, 2, "startScreenCaptureByWindowId"], [_decorator.trace, 2, "stopScreenCapture"], [_decorator.trace, 2, "startLoopbackRecording"], [_decorator.trace, 2, "stopLoopbackRecording"], [_decorator.trace, 2, "adjustLoopbackVolume"], [_decorator.trace, 2, "adjustMicrophoneVolume"], [_decorator.trace, 2, "getWindowList"], [_decorator.trace, 2, "getDisplayList"], [_decorator.bound, 2, "setMicrophoneKeepRecording"], [_decorator.bound, 2, "_handleVideoSourceVideoStateChanged"], [_decorator.bound, 2, "_handleLocalAudioStateChanged"], [_decorator.bound, 2, "_handleVideoDeviceChanged"], [_decorator.bound, 2, "_handleAudioDeviceChanged"], [_decorator.bound, 2, "_handleLocalVideoStateChanged"], [_decorator.bound, 2, "_handleLocalAudioError"], [_decorator.bound, 2, "_initializeDeviceList"], [_decorator.bound, 2, "_pickCurrentWindowId"], [_decorator.bound, 2, "_startCameraCapture"], [_decorator.bound, 2, "_stopCameraCapture"], [_decorator.bound, 2, "_startMicrophoneCapture"], [_decorator.bound, 2, "_stopMicrophoneCapture"], [_decorator.bound, 2, "_generateVideoSourceIndex"], [_decorator.bound, 2, "_bindDeviceIdToSourceType"], [_decorator.bound, 2, "_unbindDeviceIdToSourceType"], [_decorator.bound, 2, "_handleVolumeIndicatorUpdated"]], [], 0, void 0, _sourceManager.AgoraRtcSourceManager).e;
864
884
  var _applyDecs$e2 = (0, _slicedToArray2["default"])(_applyDecs$e, 1);
865
885
  _initProto = _applyDecs$e2[0];
866
886
  _applyDecs$e;
@@ -139,9 +139,8 @@ var startVideoRender = exports.startVideoRender = function startVideoRender(rtcE
139
139
  renderMode: renderModeType,
140
140
  mirrorMode: mirrorModeType
141
141
  });
142
-
143
- // rtcEngine.startPreview();
144
-
142
+ logger.info('start/stop preview startVideoRender');
143
+ rtcEngine.startPreview();
145
144
  logger.info(// @ts-ignore
146
145
  "[RenderCounter] setupLocalVideo, setupMode: ".concat(1, ", current render count: ", rtcEngine.__renderCount, ", len of render caches: ").concat(AgoraEnv.AgoraRendererManager._rendererCaches.length, ", render caches: "),
147
146
  // @ts-ignore
@@ -41,4 +41,5 @@ export declare class AgoraRtcSourceManagerImpl extends AgoraRtcSourceManager {
41
41
  getLoopbackDeviceId(): string;
42
42
  addObserver(observer: AgoraRtcSourceManagerObserver): void;
43
43
  removeObserver(observer: AgoraRtcSourceManagerObserver): void;
44
+ setMicrophoneKeepRecording(keepRecording: boolean): void;
44
45
  }
@@ -316,6 +316,11 @@ var AgoraRtcSourceManagerImpl = exports.AgoraRtcSourceManagerImpl = /*#__PURE__*
316
316
  value: function removeObserver(observer) {
317
317
  this._deviceManager.removeObserver(observer);
318
318
  }
319
+ }, {
320
+ key: "setMicrophoneKeepRecording",
321
+ value: function setMicrophoneKeepRecording(keepRecording) {
322
+ this.logger.warn('setMicrophoneKeepRecording is only available in Electron');
323
+ }
319
324
  }]);
320
325
  }(_sourceManager.AgoraRtcSourceManager);
321
326
  _AgoraRtcSourceManagerImpl = AgoraRtcSourceManagerImpl;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agora-rte-sdk",
3
- "version": "3.6.1",
3
+ "version": "3.6.2",
4
4
  "description": "SDK for building interactive scenarios",
5
5
  "author": "agora.io",
6
6
  "license": "ISC",
@@ -34,7 +34,7 @@
34
34
  "@types/sinon": "^17.0.2",
35
35
  "@types/ua-parser-js": "^0.7.35",
36
36
  "agora-token": "^2.0.3",
37
- "agora-toolchain": "~3.6.1",
37
+ "agora-toolchain": "^3.6.2",
38
38
  "babel-jest": "^29.7.0",
39
39
  "core-js": "^3.33.3",
40
40
  "dotenv": "^16.3.1",
@@ -51,13 +51,13 @@
51
51
  "typescript": "^5.3.2"
52
52
  },
53
53
  "dependencies": {
54
- "agora-electron-sdk": "4.3.2-build.145-rc.3",
54
+ "agora-electron-sdk": "4.3.2-build.145-rc.4",
55
55
  "agora-extension-ai-denoiser": "^1.0.0",
56
56
  "agora-extension-beauty-effect": "^1.0.1-beta",
57
57
  "agora-extension-virtual-background": "^2.1.0",
58
- "agora-foundation": "~3.6.1",
58
+ "agora-foundation": "^3.6.2",
59
59
  "agora-rtc-sdk-ng": "4.23.3",
60
- "agora-rtm": "2.2.2",
60
+ "agora-rtm": "2.2.2-2",
61
61
  "await-to-js": "^3.0.0",
62
62
  "immutable": "^4.3.7",
63
63
  "lodash": "^4.17.21",