agora-rte-sdk 3.10.1-rc.2 → 3.10.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.
@@ -55,7 +55,7 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
55
55
  var _imports = require("../../imports");
56
56
  var _constant = require("../../constant");
57
57
  var _AgoraRtcStreamPublishPool;
58
- var _initProto, _publishAudioDecs, _updateVideoSourceDecs, _updateAudioSourceDecs, _unpublishVideoDecs, _unpublishAudioDecs, _ref;
58
+ var _initProto, _publishVideoDecs, _publishAudioDecs, _updateVideoSourceDecs, _updateAudioSourceDecs, _unpublishVideoDecs, _unpublishAudioDecs, _ref;
59
59
  function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; }
60
60
  function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
61
61
  function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
@@ -64,7 +64,7 @@ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol"
64
64
  function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
65
65
  function _setFunctionName(e, t, n) { "symbol" == _typeof(t) && (t = (t = t.description) ? "[" + t + "]" : ""); try { Object.defineProperty(e, "name", { configurable: !0, value: n ? n + " " + t : t }); } catch (e) {} return e; }
66
66
  function _checkInRHS(e) { if (Object(e) !== e) throw TypeError("right-hand side of 'in' should be an object, got " + (null !== e ? _typeof(e) : "null")); return e; }
67
- _ref = (_publishAudioDecs = (0, _imports.trace)(['token', 'streamId', 'sourceId', 'type', 'state']), _updateVideoSourceDecs = (0, _imports.trace)(['sourceId', 'type', 'state']), _updateAudioSourceDecs = (0, _imports.trace)(['sourceId', 'type', 'state']), _unpublishVideoDecs = (0, _imports.trace)(['streamId', 'type']), _unpublishAudioDecs = (0, _imports.trace)(['streamId', 'type']), "observable");
67
+ _ref = (_publishVideoDecs = (0, _imports.trace)(['token', 'streamId', 'sourceId', 'type', 'state']), _publishAudioDecs = (0, _imports.trace)(['token', 'streamId', 'sourceId', 'type', 'state']), _updateVideoSourceDecs = (0, _imports.trace)(['sourceId', 'type', 'state']), _updateAudioSourceDecs = (0, _imports.trace)(['sourceId', 'type', 'state']), _unpublishVideoDecs = (0, _imports.trace)(['streamId', 'type']), _unpublishAudioDecs = (0, _imports.trace)(['streamId', 'type']), "observable");
68
68
  var AgoraRtcStreamPublishPool = exports.AgoraRtcStreamPublishPool = /*#__PURE__*/function () {
69
69
  function AgoraRtcStreamPublishPool() {
70
70
  (0, _classCallCheck2["default"])(this, AgoraRtcStreamPublishPool);
@@ -293,7 +293,7 @@ var AgoraRtcStreamPublishPool = exports.AgoraRtcStreamPublishPool = /*#__PURE__*
293
293
  }]);
294
294
  }();
295
295
  _AgoraRtcStreamPublishPool = AgoraRtcStreamPublishPool;
296
- var _applyDecs$e = _applyDecs(_AgoraRtcStreamPublishPool, [[_publishAudioDecs, 2, "publishAudio"], [_updateVideoSourceDecs, 2, "updateVideoSource"], [_updateAudioSourceDecs, 2, "updateAudioSource"], [_unpublishVideoDecs, 2, "unpublishVideo"], [_unpublishAudioDecs, 2, "unpublishAudio"]], []).e;
296
+ var _applyDecs$e = _applyDecs(_AgoraRtcStreamPublishPool, [[_publishVideoDecs, 2, "publishVideo"], [_publishAudioDecs, 2, "publishAudio"], [_updateVideoSourceDecs, 2, "updateVideoSource"], [_updateAudioSourceDecs, 2, "updateAudioSource"], [_unpublishVideoDecs, 2, "unpublishVideo"], [_unpublishAudioDecs, 2, "unpublishAudio"]], []).e;
297
297
  var _applyDecs$e2 = (0, _slicedToArray2["default"])(_applyDecs$e, 1);
298
298
  _initProto = _applyDecs$e2[0];
299
299
  _applyDecs$e;
@@ -11,7 +11,7 @@ export declare class CameraPreviewTaskManager {
11
11
  * 执行指定 sourceId(deviceId)对应的所有 task
12
12
  * 用于多摄像头场景下,只执行特定设备的 preview task
13
13
  */
14
- executeTasksBySourceId(sourceId: string): void;
14
+ executeTasksBySourceId(sourceId: string): Boolean;
15
15
  getTaskOptions(view: HTMLElement): VideoRenderParams | undefined;
16
16
  deleteTask(view: HTMLElement): void;
17
17
  clearAllTasks(): void;
@@ -109,7 +109,7 @@ var CameraPreviewTaskManager = exports.CameraPreviewTaskManager = /*#__PURE__*/f
109
109
  key: "executeTasksBySourceId",
110
110
  value: function executeTasksBySourceId(sourceId) {
111
111
  if (this.taskMap.size === 0) {
112
- return;
112
+ return false;
113
113
  }
114
114
  var executed = [];
115
115
  var _iterator2 = _createForOfIteratorHelper(this.taskMap),
@@ -133,6 +133,7 @@ var CameraPreviewTaskManager = exports.CameraPreviewTaskManager = /*#__PURE__*/f
133
133
  var view = _executed[_i];
134
134
  this.taskMap["delete"](view);
135
135
  }
136
+ return true;
136
137
  }
137
138
  }, {
138
139
  key: "getTaskOptions",
@@ -410,6 +410,9 @@ var AgoraRtcClientImpl = exports.AgoraRtcClientImpl = /*#__PURE__*/function (_Ag
410
410
  sourceManager: this.sourceManager,
411
411
  canvasTagPool: this.canvasTagPool
412
412
  };
413
+
414
+ // 在RTC SDK先调用 prview 再开采集会导致render异常。
415
+ // 所以需要保存在_cameraPreviewTaskManager 中,在采集开启的时候开始render
413
416
  if (this._sourceManager.isCameraCapturingByDeviceId(deviceId)) {
414
417
  return (0, _utils.startVideoRender)(videoRenderParams, this.logger);
415
418
  } else {
@@ -930,7 +933,7 @@ var AgoraRtcClientImpl = exports.AgoraRtcClientImpl = /*#__PURE__*/function (_Ag
930
933
  case 4:
931
934
  _context.prev = 4;
932
935
  _t = _context["catch"](2);
933
- this.logger.error('failed to install AgoraALD for macOS');
936
+ this.logger.error("failed to install AgoraALD for macOS: ".concat(JSON.stringify(_t)));
934
937
  case 5:
935
938
  case "end":
936
939
  return _context.stop();
@@ -136,9 +136,14 @@ function _installAgoraALD() {
136
136
  return downloadFile(encodeURI(ALD_URL), tempZipPath);
137
137
  case 1:
138
138
  logger.info("[AgoraAld-Downloader]finished download ald zip to: ".concat(tempZipPath));
139
- // temp 文件重命名为 zip
140
- fs.renameSync(tempZipPath, zipPath);
141
- logger.info("[AgoraAld-Downloader] rename to: ".concat(zipPath));
139
+ if (getSpecificFiles(zipCacheDir, zipExtensions, zipFileName).length <= 0) {
140
+ // temp 文件重命名为 zip
141
+ fs.renameSync(tempZipPath, zipPath);
142
+ logger.info("[AgoraAld-Downloader] rename to: ".concat(zipPath));
143
+ } else {
144
+ // 下载文件是异步的操作, 可能在下载过程中 zip 已经存在了, 这种情况不再需要将下载的文件重命名
145
+ logger.info("[AgoraAld-Downloader] ald zip already exists: ".concat(zipPath));
146
+ }
142
147
  case 2:
143
148
  zipData = fs.readFileSync(zipPath);
144
149
  logger.info('[AgoraAld-Downloader] start read zip data');
@@ -118,12 +118,12 @@ var AgoraElectronRtcStreamPublishPoolImpl = exports.AgoraElectronRtcStreamPublis
118
118
  }, {
119
119
  key: "shouldNotifyUpdate",
120
120
  value: function shouldNotifyUpdate(item) {
121
+ // Keep cached media options in sync even while paused so resume uses fresh state.
122
+ var channelMediaOptions = this._convertChannelMediaOptions(item);
123
+ item.mediaOptions = channelMediaOptions;
121
124
  if (this._isPaused) {
122
125
  return false;
123
126
  }
124
- // Calculate new media options based on updated item state
125
- var channelMediaOptions = this._convertChannelMediaOptions(item);
126
- item.mediaOptions = channelMediaOptions;
127
127
  return this._checkIfNeedNotifyUpdate(channelMediaOptions, this._oldMediaOptions);
128
128
  }
129
129
  }, {
@@ -198,7 +198,7 @@ var AgoraRtcChannelPublisherImpl = exports.AgoraRtcChannelPublisherImpl = /*#__P
198
198
  mediaOptions.publishMicrophoneTrack = true;
199
199
  }
200
200
  var audioSourceType = item.audioSourceType && (0, _defineProperty2["default"])((0, _defineProperty2["default"])({}, _type.AgoraRtcAudioSourceType.MICROPHONE, 'microphone'), _type.AgoraRtcAudioSourceType.LOOPBACK, 'loopback')[item.audioSourceType] || 'video';
201
- _this.logger.info("rtcEngine updateChannelMediaOptionsEx for ".concat(audioSourceType, ", mediaOptions: ").concat(JSON.stringify(mediaOptions), ", connection: ").concat(JSON.stringify(item.connection)));
201
+ _this.logger.info("rtcEngine updateChannelMediaOptionsEx for ".concat(audioSourceType, ", mediaOptions: ").concat(JSON.stringify(mediaOptions), ", item.mediaOptions: ").concat(JSON.stringify(item.mediaOptions), ", connection: ").concat(JSON.stringify(item.connection)));
202
202
  _this._rtcEngine.updateChannelMediaOptionsEx(mediaOptions, item.connection);
203
203
 
204
204
  // handle microphone
@@ -537,8 +537,11 @@ var AgoraRtcChannelPublisherImpl = exports.AgoraRtcChannelPublisherImpl = /*#__P
537
537
  var isScreenStream = false;
538
538
  var highStreamConfig = this._bindStreamConfig(isScreenStream, _type.AgoraRtcStreamLayer.HIGH, this._defaultCameraHighVideoEncoderConfig);
539
539
  var lowStreamConfig = this._bindStreamConfig(isScreenStream, _type.AgoraRtcStreamLayer.LOW, this._defaultCameraLowVideoEncoderConfig);
540
- this._videoStreamConfigs.set(connection.localUid.toString(), highStreamConfig);
541
- this._videoStreamConfigs.set(connection.localUid.toString(), lowStreamConfig);
540
+ // 合并 high 和 low 的结果,只 set 一次避免后者覆盖前者造成可读性问题
541
+ this._videoStreamConfigs.set(connection.localUid.toString(), {
542
+ highVideoEncoderConfig: highStreamConfig.highVideoEncoderConfig,
543
+ lowVideoEncoderConfig: lowStreamConfig.lowVideoEncoderConfig
544
+ });
542
545
  return _constant.AgoraRtcErrorCode.SUCCESS;
543
546
  }
544
547
  }, {
@@ -22,7 +22,6 @@ export declare class AgoraRtcSourceManagerImpl implements AgoraRtcSourceManager
22
22
  private _enableSystemSelectedMicrophonePolling;
23
23
  private _systemSelectedMicrophonePolling;
24
24
  private _cameraPreviewTaskManager;
25
- private _cameraCapturingDeviceIds;
26
25
  private _cameraCaptureParamsMapping;
27
26
  private _screenCaptureParamsMapping;
28
27
  get keepRecording(): boolean;
@@ -37,6 +37,7 @@ require("core-js/modules/es.array.includes.js");
37
37
  require("core-js/modules/es.array.is-array.js");
38
38
  require("core-js/modules/es.array.iterator.js");
39
39
  require("core-js/modules/es.array.map.js");
40
+ require("core-js/modules/es.array.some.js");
40
41
  require("core-js/modules/es.array-buffer.constructor.js");
41
42
  require("core-js/modules/es.array-buffer.slice.js");
42
43
  require("core-js/modules/es.data-view.js");
@@ -46,7 +47,6 @@ require("core-js/modules/es.map.js");
46
47
  require("core-js/modules/es.object.to-string.js");
47
48
  require("core-js/modules/es.parse-int.js");
48
49
  require("core-js/modules/es.promise.js");
49
- require("core-js/modules/es.set.js");
50
50
  require("core-js/modules/es.string.includes.js");
51
51
  require("core-js/modules/es.string.iterator.js");
52
52
  require("core-js/modules/es.typed-array.uint8-array.js");
@@ -87,6 +87,7 @@ require("core-js/modules/esnext.iterator.filter.js");
87
87
  require("core-js/modules/esnext.iterator.find.js");
88
88
  require("core-js/modules/esnext.iterator.for-each.js");
89
89
  require("core-js/modules/esnext.iterator.map.js");
90
+ require("core-js/modules/esnext.iterator.some.js");
90
91
  require("core-js/modules/esnext.map.delete-all.js");
91
92
  require("core-js/modules/esnext.map.emplace.js");
92
93
  require("core-js/modules/esnext.map.every.js");
@@ -101,29 +102,6 @@ require("core-js/modules/esnext.map.merge.js");
101
102
  require("core-js/modules/esnext.map.reduce.js");
102
103
  require("core-js/modules/esnext.map.some.js");
103
104
  require("core-js/modules/esnext.map.update.js");
104
- require("core-js/modules/esnext.set.add-all.js");
105
- require("core-js/modules/esnext.set.delete-all.js");
106
- require("core-js/modules/esnext.set.difference.v2.js");
107
- require("core-js/modules/esnext.set.difference.js");
108
- require("core-js/modules/esnext.set.every.js");
109
- require("core-js/modules/esnext.set.filter.js");
110
- require("core-js/modules/esnext.set.find.js");
111
- require("core-js/modules/esnext.set.intersection.v2.js");
112
- require("core-js/modules/esnext.set.intersection.js");
113
- require("core-js/modules/esnext.set.is-disjoint-from.v2.js");
114
- require("core-js/modules/esnext.set.is-disjoint-from.js");
115
- require("core-js/modules/esnext.set.is-subset-of.v2.js");
116
- require("core-js/modules/esnext.set.is-subset-of.js");
117
- require("core-js/modules/esnext.set.is-superset-of.v2.js");
118
- require("core-js/modules/esnext.set.is-superset-of.js");
119
- require("core-js/modules/esnext.set.join.js");
120
- require("core-js/modules/esnext.set.map.js");
121
- require("core-js/modules/esnext.set.reduce.js");
122
- require("core-js/modules/esnext.set.some.js");
123
- require("core-js/modules/esnext.set.symmetric-difference.v2.js");
124
- require("core-js/modules/esnext.set.symmetric-difference.js");
125
- require("core-js/modules/esnext.set.union.v2.js");
126
- require("core-js/modules/esnext.set.union.js");
127
105
  require("core-js/modules/esnext.typed-array.filter-reject.js");
128
106
  require("core-js/modules/esnext.typed-array.group-by.js");
129
107
  require("core-js/modules/esnext.typed-array.to-spliced.js");
@@ -195,8 +173,6 @@ var AgoraRtcSourceManagerImpl = exports.AgoraRtcSourceManagerImpl = /*#__PURE__*
195
173
  (0, _defineProperty2["default"])(this, "enableObserveSystemSelectedMicrophoneChanged", false);
196
174
  (0, _defineProperty2["default"])(this, "_enableSystemSelectedMicrophonePolling", false);
197
175
  (0, _defineProperty2["default"])(this, "_systemSelectedMicrophonePolling", this._createSystemSelectedMicrophonePolling());
198
- // 按 deviceId 维度管理摄像头采集状态,避免停止一个摄像头时影响其他摄像头的 preview
199
- (0, _defineProperty2["default"])(this, "_cameraCapturingDeviceIds", new Set());
200
176
  // 摄像头捕获参数映射, key是deviceId
201
177
  (0, _defineProperty2["default"])(this, "_cameraCaptureParamsMapping", new Map());
202
178
  // 屏幕捕获参数映射, 屏幕共享需要区分屏幕和窗口,key的生成规则是deviceId_type, 例如:1_SCREEN, 1_WINDOW
@@ -222,7 +198,10 @@ var AgoraRtcSourceManagerImpl = exports.AgoraRtcSourceManagerImpl = /*#__PURE__*
222
198
  }, {
223
199
  key: "isCameraCapturing",
224
200
  get: function get() {
225
- return this._cameraCapturingDeviceIds.size > 0;
201
+ var _this = this;
202
+ return this._cameraStateControl.sourceIdList.some(function (sourceId) {
203
+ return _this._cameraStateControl.getSourceCaptureEnabled(sourceId);
204
+ });
226
205
  }
227
206
 
228
207
  /**
@@ -231,7 +210,7 @@ var AgoraRtcSourceManagerImpl = exports.AgoraRtcSourceManagerImpl = /*#__PURE__*
231
210
  }, {
232
211
  key: "isCameraCapturingByDeviceId",
233
212
  value: function isCameraCapturingByDeviceId(deviceId) {
234
- return this._cameraCapturingDeviceIds.has(deviceId);
213
+ return this._cameraStateControl.getSourceCaptureEnabled(deviceId);
235
214
  }
236
215
  }, {
237
216
  key: "addObserver",
@@ -256,7 +235,6 @@ var AgoraRtcSourceManagerImpl = exports.AgoraRtcSourceManagerImpl = /*#__PURE__*
256
235
  this._screenStateControl.release();
257
236
  this._windowStateControl.release();
258
237
  this._cameraPreviewTaskManager.release();
259
- this._cameraCapturingDeviceIds.clear();
260
238
  return _constant.AgoraRtcErrorCode.SUCCESS;
261
239
  }
262
240
  }, {
@@ -350,13 +328,13 @@ var AgoraRtcSourceManagerImpl = exports.AgoraRtcSourceManagerImpl = /*#__PURE__*
350
328
  }, {
351
329
  key: "getWindowList",
352
330
  value: function getWindowList() {
353
- var _this = this;
331
+ var _this2 = this;
354
332
  return new Promise(function (resolve) {
355
- var windowList = _this._getFormattedScreenCaptureSourceInfo(_utils.defaultThumbSize, _utils.defaultWindowIconSize, _type2.AgoraElectronScreenCaptureSourceType.ScreencapturesourcetypeWindow);
333
+ var windowList = _this2._getFormattedScreenCaptureSourceInfo(_utils.defaultThumbSize, _utils.defaultWindowIconSize, _type2.AgoraElectronScreenCaptureSourceType.ScreencapturesourcetypeWindow);
356
334
  var windowIdList = windowList.map(function (win) {
357
335
  return win.id;
358
336
  });
359
- var currentWindowId = _this._pickCurrentWindowId(windowIdList);
337
+ var currentWindowId = _this2._pickCurrentWindowId(windowIdList);
360
338
  windowList.forEach(function (win) {
361
339
  if (currentWindowId === win.id) {
362
340
  win.isCurrent = true;
@@ -368,9 +346,9 @@ var AgoraRtcSourceManagerImpl = exports.AgoraRtcSourceManagerImpl = /*#__PURE__*
368
346
  }, {
369
347
  key: "getDisplayList",
370
348
  value: function getDisplayList() {
371
- var _this2 = this;
349
+ var _this3 = this;
372
350
  return new Promise(function (resolve) {
373
- var displayList = _this2._getFormattedScreenCaptureSourceInfo(_utils.defaultThumbSize, _utils.defaultDisplayIconSize, _type2.AgoraElectronScreenCaptureSourceType.ScreencapturesourcetypeScreen);
351
+ var displayList = _this3._getFormattedScreenCaptureSourceInfo(_utils.defaultThumbSize, _utils.defaultDisplayIconSize, _type2.AgoraElectronScreenCaptureSourceType.ScreencapturesourcetypeScreen);
374
352
  resolve(displayList);
375
353
  });
376
354
  }
@@ -479,7 +457,7 @@ var AgoraRtcSourceManagerImpl = exports.AgoraRtcSourceManagerImpl = /*#__PURE__*
479
457
  }, {
480
458
  key: "setKeepAudioRecording",
481
459
  value: function setKeepAudioRecording(keepRecording) {
482
- var _this3 = this;
460
+ var _this4 = this;
483
461
  var res = 0;
484
462
  if (keepRecording) {
485
463
  res = this._startRecordingDeviceCapture();
@@ -492,12 +470,12 @@ var AgoraRtcSourceManagerImpl = exports.AgoraRtcSourceManagerImpl = /*#__PURE__*
492
470
  this._microphoneStateControl.sourceIdList.forEach(function (sourceId) {
493
471
  if (res === 0) {
494
472
  if (keepRecording) {
495
- _this3._microphoneStateControl.startSourceTest(sourceId);
473
+ _this4._microphoneStateControl.startSourceTest(sourceId);
496
474
  } else {
497
- _this3._microphoneStateControl.stopSourceTest(sourceId);
475
+ _this4._microphoneStateControl.stopSourceTest(sourceId);
498
476
  }
499
477
  } else {
500
- _this3._microphoneStateControl.occurSourceError(sourceId);
478
+ _this4._microphoneStateControl.occurSourceError(sourceId);
501
479
  }
502
480
  });
503
481
  }
@@ -666,7 +644,6 @@ var AgoraRtcSourceManagerImpl = exports.AgoraRtcSourceManagerImpl = /*#__PURE__*
666
644
  if (!sourceCaptureEnabled) {
667
645
  res = this._startCameraCapture(cameraDeviceId);
668
646
  if (res === 0) {
669
- this._cameraCapturingDeviceIds.add(cameraDeviceId);
670
647
  this._cameraPreviewTaskManager.executeTasksBySourceId(cameraDeviceId);
671
648
  }
672
649
  }
@@ -691,9 +668,6 @@ var AgoraRtcSourceManagerImpl = exports.AgoraRtcSourceManagerImpl = /*#__PURE__*
691
668
  var res = 0;
692
669
  if (!isMediaCaptureTestingAndOpenEnabled && sourceCaptureEnabled) {
693
670
  res = this._stopCameraCapture(cameraDeviceId);
694
- if (res === 0) {
695
- this._cameraCapturingDeviceIds["delete"](cameraDeviceId);
696
- }
697
671
  }
698
672
  if (res === 0) {
699
673
  if (isStopCameraTest) {
@@ -920,7 +894,7 @@ var AgoraRtcSourceManagerImpl = exports.AgoraRtcSourceManagerImpl = /*#__PURE__*
920
894
  }, {
921
895
  key: "_initializeDeviceList",
922
896
  value: function _initializeDeviceList() {
923
- var _this4 = this;
897
+ var _this5 = this;
924
898
  this._cameraList = this._getCameraList();
925
899
  this._microphoneList = this._getMicrophoneList();
926
900
  var cameraList = Array.from(this._cameraList.values());
@@ -929,7 +903,7 @@ var AgoraRtcSourceManagerImpl = exports.AgoraRtcSourceManagerImpl = /*#__PURE__*
929
903
  this.observable.notifyObservers('onMicrophoneListAdded', microphoneList);
930
904
  this._getSystemSelectedUniqueDeviceId().then(function (deviceTag) {
931
905
  if (deviceTag) {
932
- _this4._systemSelectedMicrophoneTag = deviceTag;
906
+ _this5._systemSelectedMicrophoneTag = deviceTag;
933
907
  }
934
908
  });
935
909
  }
@@ -1192,63 +1166,63 @@ var AgoraRtcSourceManagerImpl = exports.AgoraRtcSourceManagerImpl = /*#__PURE__*
1192
1166
  }, {
1193
1167
  key: "_createMicrophoneStateControlObserver",
1194
1168
  value: function _createMicrophoneStateControlObserver() {
1195
- var _this5 = this;
1169
+ var _this6 = this;
1196
1170
  return {
1197
1171
  onSourceStateUpdated: function onSourceStateUpdated(deviceId, deviceStateEnabled) {
1198
1172
  var state = deviceStateEnabled ? _type.AgoraRtcMediaSourceState.OPEN : _type.AgoraRtcMediaSourceState.CLOSE;
1199
1173
  if (deviceStateEnabled) {
1200
- _this5.observable.notifyObservers('onMicrophoneStateUpdated', deviceId, state);
1174
+ _this6.observable.notifyObservers('onMicrophoneStateUpdated', deviceId, state);
1201
1175
  } else {
1202
- _this5.observable.notifyObservers('onMicrophoneStateUpdated', deviceId, state);
1176
+ _this6.observable.notifyObservers('onMicrophoneStateUpdated', deviceId, state);
1203
1177
  }
1204
1178
  },
1205
1179
  onSourceErrorOccurred: function onSourceErrorOccurred(deviceId) {
1206
- _this5.observable.notifyObservers('onMicrophoneStateUpdated', deviceId, _type.AgoraRtcMediaSourceState.ERROR);
1180
+ _this6.observable.notifyObservers('onMicrophoneStateUpdated', deviceId, _type.AgoraRtcMediaSourceState.ERROR);
1207
1181
  },
1208
1182
  onMicrophoneVolumeIndicationUpdated: function onMicrophoneVolumeIndicationUpdated(deviceId, volume) {
1209
- _this5.observable.notifyObservers('onMicrophoneVolumeIndicationUpdated', deviceId, volume);
1183
+ _this6.observable.notifyObservers('onMicrophoneVolumeIndicationUpdated', deviceId, volume);
1210
1184
  }
1211
1185
  };
1212
1186
  }
1213
1187
  }, {
1214
1188
  key: "_createCameraStateControlObserver",
1215
1189
  value: function _createCameraStateControlObserver() {
1216
- var _this6 = this;
1190
+ var _this7 = this;
1217
1191
  return {
1218
1192
  onSourceStateUpdated: function onSourceStateUpdated(sourceId, deviceStateEnabled) {
1219
1193
  var state = deviceStateEnabled ? _type.AgoraRtcMediaSourceState.OPEN : _type.AgoraRtcMediaSourceState.CLOSE;
1220
- _this6.observable.notifyObservers('onCameraStateUpdated', sourceId, state);
1194
+ _this7.observable.notifyObservers('onCameraStateUpdated', sourceId, state);
1221
1195
  },
1222
1196
  onSourceErrorOccurred: function onSourceErrorOccurred(sourceId) {
1223
- _this6.observable.notifyObservers('onCameraStateUpdated', sourceId, _type.AgoraRtcMediaSourceState.ERROR);
1197
+ _this7.observable.notifyObservers('onCameraStateUpdated', sourceId, _type.AgoraRtcMediaSourceState.ERROR);
1224
1198
  }
1225
1199
  };
1226
1200
  }
1227
1201
  }, {
1228
1202
  key: "_createScreenStateControlObserver",
1229
1203
  value: function _createScreenStateControlObserver(type) {
1230
- var _this7 = this;
1204
+ var _this8 = this;
1231
1205
  return {
1232
1206
  onSourceStateUpdated: function onSourceStateUpdated(sourceId, sourceStateEnabled) {
1233
1207
  var state = sourceStateEnabled ? _type.AgoraRtcMediaSourceState.OPEN : _type.AgoraRtcMediaSourceState.CLOSE;
1234
- _this7.observable.notifyObservers('onScreenCaptureStateUpdated', sourceId, type, state);
1208
+ _this8.observable.notifyObservers('onScreenCaptureStateUpdated', sourceId, type, state);
1235
1209
  },
1236
1210
  onSourceErrorOccurred: function onSourceErrorOccurred(sourceId) {
1237
- _this7.observable.notifyObservers('onScreenCaptureStateUpdated', sourceId, type, _type.AgoraRtcMediaSourceState.ERROR);
1211
+ _this8.observable.notifyObservers('onScreenCaptureStateUpdated', sourceId, type, _type.AgoraRtcMediaSourceState.ERROR);
1238
1212
  }
1239
1213
  };
1240
1214
  }
1241
1215
  }, {
1242
1216
  key: "_createLoopbackStateControlObserver",
1243
1217
  value: function _createLoopbackStateControlObserver() {
1244
- var _this8 = this;
1218
+ var _this9 = this;
1245
1219
  return {
1246
1220
  onSourceStateUpdated: function onSourceStateUpdated(sourceId, sourceStateEnabled) {
1247
1221
  var state = sourceStateEnabled ? _type.AgoraRtcMediaSourceState.OPEN : _type.AgoraRtcMediaSourceState.CLOSE;
1248
- _this8.observable.notifyObservers('onLoopbackRecordingStateUpdated', sourceId, state);
1222
+ _this9.observable.notifyObservers('onLoopbackRecordingStateUpdated', sourceId, state);
1249
1223
  },
1250
1224
  onSourceErrorOccurred: function onSourceErrorOccurred(sourceId) {
1251
- _this8.observable.notifyObservers('onLoopbackRecordingStateUpdated', sourceId, _type.AgoraRtcMediaSourceState.ERROR);
1225
+ _this9.observable.notifyObservers('onLoopbackRecordingStateUpdated', sourceId, _type.AgoraRtcMediaSourceState.ERROR);
1252
1226
  }
1253
1227
  };
1254
1228
  }
@@ -1344,7 +1318,7 @@ var AgoraRtcSourceManagerImpl = exports.AgoraRtcSourceManagerImpl = /*#__PURE__*
1344
1318
  }, {
1345
1319
  key: "_updateMicrophoneDeviceList",
1346
1320
  value: function _updateMicrophoneDeviceList() {
1347
- var _this9 = this;
1321
+ var _this0 = this;
1348
1322
  var audioRecordingDevices = this._audioDeviceManager.enumerateRecordingDevices();
1349
1323
  var oldMicList = this._microphoneList;
1350
1324
  var newMicList = new Map();
@@ -1361,7 +1335,7 @@ var AgoraRtcSourceManagerImpl = exports.AgoraRtcSourceManagerImpl = /*#__PURE__*
1361
1335
  };
1362
1336
  newMicList.set(device.deviceId, deviceInfo);
1363
1337
  var deviceInfoString = "deviceName\uFF1A".concat(deviceInfo === null || deviceInfo === void 0 ? void 0 : deviceInfo.deviceName, " deviceId: ").concat(deviceInfo === null || deviceInfo === void 0 ? void 0 : deviceInfo.deviceId, ", vendorId: ").concat(deviceInfo === null || deviceInfo === void 0 ? void 0 : deviceInfo.vendorId, ", productId: ").concat(deviceInfo === null || deviceInfo === void 0 ? void 0 : deviceInfo.productId);
1364
- _this9.logger.info("RecordingDevices deviceInfoString: ".concat(deviceInfoString));
1338
+ _this0.logger.info("RecordingDevices deviceInfoString: ".concat(deviceInfoString));
1365
1339
  }
1366
1340
  });
1367
1341
  var _this$_getDeviceListC2 = this._getDeviceListChangedInfo({
@@ -1400,7 +1374,7 @@ var AgoraRtcSourceManagerImpl = exports.AgoraRtcSourceManagerImpl = /*#__PURE__*
1400
1374
  }, {
1401
1375
  key: "_handleScreenCaptureStateChanged",
1402
1376
  value: function _handleScreenCaptureStateChanged(callbackCaptureEnabled, type, isManualCloseScreenCapture) {
1403
- var _this0 = this;
1377
+ var _this1 = this;
1404
1378
  var isScreen = type === _type.AgoraRtcScreenCaptureType.SCREEN;
1405
1379
  var screenStateControl = isScreen ? this._screenStateControl : this._windowStateControl;
1406
1380
  screenStateControl.mediaSourceIndexMapping.forEach(function (sourceIndex, sourceId) {
@@ -1412,7 +1386,7 @@ var AgoraRtcSourceManagerImpl = exports.AgoraRtcSourceManagerImpl = /*#__PURE__*
1412
1386
  var isCloseSource = !callbackCaptureEnabled && sourceEnabledState;
1413
1387
  if (isCloseSource) {
1414
1388
  if (isManualCloseScreenCapture) {
1415
- _this0._stopScreenCaptureAndUnbindSource(sourceId, type);
1389
+ _this1._stopScreenCaptureAndUnbindSource(sourceId, type);
1416
1390
  } else {
1417
1391
  screenStateControl.closeSource(sourceId);
1418
1392
  screenStateControl.unbindSourceIdToSourceIndex(sourceId);
@@ -1451,15 +1425,11 @@ var AgoraRtcSourceManagerImpl = exports.AgoraRtcSourceManagerImpl = /*#__PURE__*
1451
1425
  if (storageCaptureDisabled && callbackCaptureEnabled) {
1452
1426
  this.logger.info("_handleCameraVideoStateChanged stopCameraCaptureAndUnbindSource sourceId: ".concat(targetDeviceId));
1453
1427
  var res = this._stopCameraCapture(targetDeviceId);
1454
- if (res === 0) {
1455
- this._cameraCapturingDeviceIds["delete"](targetDeviceId);
1456
- }
1457
1428
  }
1458
1429
  if (storageCaptureEnabled && (isErrorState || isCloseReason)) {
1459
1430
  this.logger.info("_handleCameraVideoStateChanged occurSourceError sourceId: ".concat(targetDeviceId));
1460
1431
  this._cameraStateControl.unbindSourceIdToSourceIndex(targetDeviceId);
1461
1432
  this._cameraStateControl.occurSourceError(targetDeviceId);
1462
- this._cameraCapturingDeviceIds["delete"](targetDeviceId);
1463
1433
  }
1464
1434
  }
1465
1435
  }, {
@@ -27,7 +27,7 @@ import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
27
27
  import _createClass from "@babel/runtime/helpers/createClass";
28
28
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
29
29
  var _AgoraRtcStreamPublishPool;
30
- var _initProto, _publishAudioDecs, _updateVideoSourceDecs, _updateAudioSourceDecs, _unpublishVideoDecs, _unpublishAudioDecs, _ref;
30
+ var _initProto, _publishVideoDecs, _publishAudioDecs, _updateVideoSourceDecs, _updateAudioSourceDecs, _unpublishVideoDecs, _unpublishAudioDecs, _ref;
31
31
  function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; }
32
32
  function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
33
33
  function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
@@ -57,7 +57,7 @@ function _setFunctionName(e, t, n) { "symbol" == _typeof(t) && (t = (t = t.descr
57
57
  function _checkInRHS(e) { if (Object(e) !== e) throw TypeError("right-hand side of 'in' should be an object, got " + (null !== e ? _typeof(e) : "null")); return e; }
58
58
  import { AgoraObservable, trace } from '../../imports';
59
59
  import { AgoraRtcErrorCode } from '../../constant';
60
- _ref = (_publishAudioDecs = trace(['token', 'streamId', 'sourceId', 'type', 'state']), _updateVideoSourceDecs = trace(['sourceId', 'type', 'state']), _updateAudioSourceDecs = trace(['sourceId', 'type', 'state']), _unpublishVideoDecs = trace(['streamId', 'type']), _unpublishAudioDecs = trace(['streamId', 'type']), "observable");
60
+ _ref = (_publishVideoDecs = trace(['token', 'streamId', 'sourceId', 'type', 'state']), _publishAudioDecs = trace(['token', 'streamId', 'sourceId', 'type', 'state']), _updateVideoSourceDecs = trace(['sourceId', 'type', 'state']), _updateAudioSourceDecs = trace(['sourceId', 'type', 'state']), _unpublishVideoDecs = trace(['streamId', 'type']), _unpublishAudioDecs = trace(['streamId', 'type']), "observable");
61
61
  export var AgoraRtcStreamPublishPool = /*#__PURE__*/function () {
62
62
  function AgoraRtcStreamPublishPool() {
63
63
  _classCallCheck(this, AgoraRtcStreamPublishPool);
@@ -286,7 +286,7 @@ export var AgoraRtcStreamPublishPool = /*#__PURE__*/function () {
286
286
  }]);
287
287
  }();
288
288
  _AgoraRtcStreamPublishPool = AgoraRtcStreamPublishPool;
289
- var _applyDecs$e = _applyDecs(_AgoraRtcStreamPublishPool, [[_publishAudioDecs, 2, "publishAudio"], [_updateVideoSourceDecs, 2, "updateVideoSource"], [_updateAudioSourceDecs, 2, "updateAudioSource"], [_unpublishVideoDecs, 2, "unpublishVideo"], [_unpublishAudioDecs, 2, "unpublishAudio"]], []).e;
289
+ var _applyDecs$e = _applyDecs(_AgoraRtcStreamPublishPool, [[_publishVideoDecs, 2, "publishVideo"], [_publishAudioDecs, 2, "publishAudio"], [_updateVideoSourceDecs, 2, "updateVideoSource"], [_updateAudioSourceDecs, 2, "updateAudioSource"], [_unpublishVideoDecs, 2, "unpublishVideo"], [_unpublishAudioDecs, 2, "unpublishAudio"]], []).e;
290
290
  var _applyDecs$e2 = _slicedToArray(_applyDecs$e, 1);
291
291
  _initProto = _applyDecs$e2[0];
292
292
  _applyDecs$e;
@@ -101,7 +101,7 @@ export var CameraPreviewTaskManager = /*#__PURE__*/function () {
101
101
  key: "executeTasksBySourceId",
102
102
  value: function executeTasksBySourceId(sourceId) {
103
103
  if (this.taskMap.size === 0) {
104
- return;
104
+ return false;
105
105
  }
106
106
  var executed = [];
107
107
  var _iterator2 = _createForOfIteratorHelper(this.taskMap),
@@ -125,6 +125,7 @@ export var CameraPreviewTaskManager = /*#__PURE__*/function () {
125
125
  var view = _executed[_i];
126
126
  this.taskMap["delete"](view);
127
127
  }
128
+ return true;
128
129
  }
129
130
  }, {
130
131
  key: "getTaskOptions",
@@ -403,6 +403,9 @@ export var AgoraRtcClientImpl = /*#__PURE__*/function (_AgoraRtcClient) {
403
403
  sourceManager: this.sourceManager,
404
404
  canvasTagPool: this.canvasTagPool
405
405
  };
406
+
407
+ // 在RTC SDK先调用 prview 再开采集会导致render异常。
408
+ // 所以需要保存在_cameraPreviewTaskManager 中,在采集开启的时候开始render
406
409
  if (this._sourceManager.isCameraCapturingByDeviceId(deviceId)) {
407
410
  return startVideoRender(videoRenderParams, this.logger);
408
411
  } else {
@@ -923,7 +926,7 @@ export var AgoraRtcClientImpl = /*#__PURE__*/function (_AgoraRtcClient) {
923
926
  case 4:
924
927
  _context.prev = 4;
925
928
  _t = _context["catch"](2);
926
- this.logger.error('failed to install AgoraALD for macOS');
929
+ this.logger.error("failed to install AgoraALD for macOS: ".concat(JSON.stringify(_t)));
927
930
  case 5:
928
931
  case "end":
929
932
  return _context.stop();
@@ -127,9 +127,14 @@ function _installAgoraALD() {
127
127
  return downloadFile(encodeURI(ALD_URL), tempZipPath);
128
128
  case 1:
129
129
  logger.info("[AgoraAld-Downloader]finished download ald zip to: ".concat(tempZipPath));
130
- // temp 文件重命名为 zip
131
- fs.renameSync(tempZipPath, zipPath);
132
- logger.info("[AgoraAld-Downloader] rename to: ".concat(zipPath));
130
+ if (getSpecificFiles(zipCacheDir, zipExtensions, zipFileName).length <= 0) {
131
+ // temp 文件重命名为 zip
132
+ fs.renameSync(tempZipPath, zipPath);
133
+ logger.info("[AgoraAld-Downloader] rename to: ".concat(zipPath));
134
+ } else {
135
+ // 下载文件是异步的操作, 可能在下载过程中 zip 已经存在了, 这种情况不再需要将下载的文件重命名
136
+ logger.info("[AgoraAld-Downloader] ald zip already exists: ".concat(zipPath));
137
+ }
133
138
  case 2:
134
139
  zipData = fs.readFileSync(zipPath);
135
140
  logger.info('[AgoraAld-Downloader] start read zip data');
@@ -111,12 +111,12 @@ export var AgoraElectronRtcStreamPublishPoolImpl = /*#__PURE__*/function (_Agora
111
111
  }, {
112
112
  key: "shouldNotifyUpdate",
113
113
  value: function shouldNotifyUpdate(item) {
114
+ // Keep cached media options in sync even while paused so resume uses fresh state.
115
+ var channelMediaOptions = this._convertChannelMediaOptions(item);
116
+ item.mediaOptions = channelMediaOptions;
114
117
  if (this._isPaused) {
115
118
  return false;
116
119
  }
117
- // Calculate new media options based on updated item state
118
- var channelMediaOptions = this._convertChannelMediaOptions(item);
119
- item.mediaOptions = channelMediaOptions;
120
120
  return this._checkIfNeedNotifyUpdate(channelMediaOptions, this._oldMediaOptions);
121
121
  }
122
122
  }, {
@@ -191,7 +191,7 @@ export var AgoraRtcChannelPublisherImpl = /*#__PURE__*/function () {
191
191
  mediaOptions.publishMicrophoneTrack = true;
192
192
  }
193
193
  var audioSourceType = item.audioSourceType && _defineProperty(_defineProperty({}, AgoraRtcAudioSourceType.MICROPHONE, 'microphone'), AgoraRtcAudioSourceType.LOOPBACK, 'loopback')[item.audioSourceType] || 'video';
194
- _this.logger.info("rtcEngine updateChannelMediaOptionsEx for ".concat(audioSourceType, ", mediaOptions: ").concat(JSON.stringify(mediaOptions), ", connection: ").concat(JSON.stringify(item.connection)));
194
+ _this.logger.info("rtcEngine updateChannelMediaOptionsEx for ".concat(audioSourceType, ", mediaOptions: ").concat(JSON.stringify(mediaOptions), ", item.mediaOptions: ").concat(JSON.stringify(item.mediaOptions), ", connection: ").concat(JSON.stringify(item.connection)));
195
195
  _this._rtcEngine.updateChannelMediaOptionsEx(mediaOptions, item.connection);
196
196
 
197
197
  // handle microphone
@@ -530,8 +530,11 @@ export var AgoraRtcChannelPublisherImpl = /*#__PURE__*/function () {
530
530
  var isScreenStream = false;
531
531
  var highStreamConfig = this._bindStreamConfig(isScreenStream, AgoraRtcStreamLayer.HIGH, this._defaultCameraHighVideoEncoderConfig);
532
532
  var lowStreamConfig = this._bindStreamConfig(isScreenStream, AgoraRtcStreamLayer.LOW, this._defaultCameraLowVideoEncoderConfig);
533
- this._videoStreamConfigs.set(connection.localUid.toString(), highStreamConfig);
534
- this._videoStreamConfigs.set(connection.localUid.toString(), lowStreamConfig);
533
+ // 合并 high 和 low 的结果,只 set 一次避免后者覆盖前者造成可读性问题
534
+ this._videoStreamConfigs.set(connection.localUid.toString(), {
535
+ highVideoEncoderConfig: highStreamConfig.highVideoEncoderConfig,
536
+ lowVideoEncoderConfig: lowStreamConfig.lowVideoEncoderConfig
537
+ });
535
538
  return AgoraRtcErrorCode.SUCCESS;
536
539
  }
537
540
  }, {
@@ -27,6 +27,7 @@ import "core-js/modules/es.array.iterator.js";
27
27
  import "core-js/modules/es.array.map.js";
28
28
  import "core-js/modules/es.array.push.js";
29
29
  import "core-js/modules/es.array.slice.js";
30
+ import "core-js/modules/es.array.some.js";
30
31
  import "core-js/modules/es.array-buffer.constructor.js";
31
32
  import "core-js/modules/es.array-buffer.slice.js";
32
33
  import "core-js/modules/es.data-view.js";
@@ -47,7 +48,6 @@ import "core-js/modules/es.promise.js";
47
48
  import "core-js/modules/es.regexp.exec.js";
48
49
  import "core-js/modules/es.regexp.test.js";
49
50
  import "core-js/modules/es.regexp.to-string.js";
50
- import "core-js/modules/es.set.js";
51
51
  import "core-js/modules/es.string.includes.js";
52
52
  import "core-js/modules/es.string.iterator.js";
53
53
  import "core-js/modules/es.typed-array.uint8-array.js";
@@ -89,6 +89,7 @@ import "core-js/modules/esnext.iterator.filter.js";
89
89
  import "core-js/modules/esnext.iterator.find.js";
90
90
  import "core-js/modules/esnext.iterator.for-each.js";
91
91
  import "core-js/modules/esnext.iterator.map.js";
92
+ import "core-js/modules/esnext.iterator.some.js";
92
93
  import "core-js/modules/esnext.map.delete-all.js";
93
94
  import "core-js/modules/esnext.map.emplace.js";
94
95
  import "core-js/modules/esnext.map.every.js";
@@ -103,29 +104,6 @@ import "core-js/modules/esnext.map.merge.js";
103
104
  import "core-js/modules/esnext.map.reduce.js";
104
105
  import "core-js/modules/esnext.map.some.js";
105
106
  import "core-js/modules/esnext.map.update.js";
106
- import "core-js/modules/esnext.set.add-all.js";
107
- import "core-js/modules/esnext.set.delete-all.js";
108
- import "core-js/modules/esnext.set.difference.v2.js";
109
- import "core-js/modules/esnext.set.difference.js";
110
- import "core-js/modules/esnext.set.every.js";
111
- import "core-js/modules/esnext.set.filter.js";
112
- import "core-js/modules/esnext.set.find.js";
113
- import "core-js/modules/esnext.set.intersection.v2.js";
114
- import "core-js/modules/esnext.set.intersection.js";
115
- import "core-js/modules/esnext.set.is-disjoint-from.v2.js";
116
- import "core-js/modules/esnext.set.is-disjoint-from.js";
117
- import "core-js/modules/esnext.set.is-subset-of.v2.js";
118
- import "core-js/modules/esnext.set.is-subset-of.js";
119
- import "core-js/modules/esnext.set.is-superset-of.v2.js";
120
- import "core-js/modules/esnext.set.is-superset-of.js";
121
- import "core-js/modules/esnext.set.join.js";
122
- import "core-js/modules/esnext.set.map.js";
123
- import "core-js/modules/esnext.set.reduce.js";
124
- import "core-js/modules/esnext.set.some.js";
125
- import "core-js/modules/esnext.set.symmetric-difference.v2.js";
126
- import "core-js/modules/esnext.set.symmetric-difference.js";
127
- import "core-js/modules/esnext.set.union.v2.js";
128
- import "core-js/modules/esnext.set.union.js";
129
107
  import "core-js/modules/esnext.symbol.metadata.js";
130
108
  import "core-js/modules/esnext.typed-array.filter-reject.js";
131
109
  import "core-js/modules/esnext.typed-array.group-by.js";
@@ -188,8 +166,6 @@ export var AgoraRtcSourceManagerImpl = /*#__PURE__*/function () {
188
166
  _defineProperty(this, "enableObserveSystemSelectedMicrophoneChanged", false);
189
167
  _defineProperty(this, "_enableSystemSelectedMicrophonePolling", false);
190
168
  _defineProperty(this, "_systemSelectedMicrophonePolling", this._createSystemSelectedMicrophonePolling());
191
- // 按 deviceId 维度管理摄像头采集状态,避免停止一个摄像头时影响其他摄像头的 preview
192
- _defineProperty(this, "_cameraCapturingDeviceIds", new Set());
193
169
  // 摄像头捕获参数映射, key是deviceId
194
170
  _defineProperty(this, "_cameraCaptureParamsMapping", new Map());
195
171
  // 屏幕捕获参数映射, 屏幕共享需要区分屏幕和窗口,key的生成规则是deviceId_type, 例如:1_SCREEN, 1_WINDOW
@@ -215,7 +191,10 @@ export var AgoraRtcSourceManagerImpl = /*#__PURE__*/function () {
215
191
  }, {
216
192
  key: "isCameraCapturing",
217
193
  get: function get() {
218
- return this._cameraCapturingDeviceIds.size > 0;
194
+ var _this = this;
195
+ return this._cameraStateControl.sourceIdList.some(function (sourceId) {
196
+ return _this._cameraStateControl.getSourceCaptureEnabled(sourceId);
197
+ });
219
198
  }
220
199
 
221
200
  /**
@@ -224,7 +203,7 @@ export var AgoraRtcSourceManagerImpl = /*#__PURE__*/function () {
224
203
  }, {
225
204
  key: "isCameraCapturingByDeviceId",
226
205
  value: function isCameraCapturingByDeviceId(deviceId) {
227
- return this._cameraCapturingDeviceIds.has(deviceId);
206
+ return this._cameraStateControl.getSourceCaptureEnabled(deviceId);
228
207
  }
229
208
  }, {
230
209
  key: "addObserver",
@@ -249,7 +228,6 @@ export var AgoraRtcSourceManagerImpl = /*#__PURE__*/function () {
249
228
  this._screenStateControl.release();
250
229
  this._windowStateControl.release();
251
230
  this._cameraPreviewTaskManager.release();
252
- this._cameraCapturingDeviceIds.clear();
253
231
  return AgoraRtcErrorCode.SUCCESS;
254
232
  }
255
233
  }, {
@@ -343,13 +321,13 @@ export var AgoraRtcSourceManagerImpl = /*#__PURE__*/function () {
343
321
  }, {
344
322
  key: "getWindowList",
345
323
  value: function getWindowList() {
346
- var _this = this;
324
+ var _this2 = this;
347
325
  return new Promise(function (resolve) {
348
- var windowList = _this._getFormattedScreenCaptureSourceInfo(defaultThumbSize, defaultWindowIconSize, AgoraElectronScreenCaptureSourceType.ScreencapturesourcetypeWindow);
326
+ var windowList = _this2._getFormattedScreenCaptureSourceInfo(defaultThumbSize, defaultWindowIconSize, AgoraElectronScreenCaptureSourceType.ScreencapturesourcetypeWindow);
349
327
  var windowIdList = windowList.map(function (win) {
350
328
  return win.id;
351
329
  });
352
- var currentWindowId = _this._pickCurrentWindowId(windowIdList);
330
+ var currentWindowId = _this2._pickCurrentWindowId(windowIdList);
353
331
  windowList.forEach(function (win) {
354
332
  if (currentWindowId === win.id) {
355
333
  win.isCurrent = true;
@@ -361,9 +339,9 @@ export var AgoraRtcSourceManagerImpl = /*#__PURE__*/function () {
361
339
  }, {
362
340
  key: "getDisplayList",
363
341
  value: function getDisplayList() {
364
- var _this2 = this;
342
+ var _this3 = this;
365
343
  return new Promise(function (resolve) {
366
- var displayList = _this2._getFormattedScreenCaptureSourceInfo(defaultThumbSize, defaultDisplayIconSize, AgoraElectronScreenCaptureSourceType.ScreencapturesourcetypeScreen);
344
+ var displayList = _this3._getFormattedScreenCaptureSourceInfo(defaultThumbSize, defaultDisplayIconSize, AgoraElectronScreenCaptureSourceType.ScreencapturesourcetypeScreen);
367
345
  resolve(displayList);
368
346
  });
369
347
  }
@@ -472,7 +450,7 @@ export var AgoraRtcSourceManagerImpl = /*#__PURE__*/function () {
472
450
  }, {
473
451
  key: "setKeepAudioRecording",
474
452
  value: function setKeepAudioRecording(keepRecording) {
475
- var _this3 = this;
453
+ var _this4 = this;
476
454
  var res = 0;
477
455
  if (keepRecording) {
478
456
  res = this._startRecordingDeviceCapture();
@@ -485,12 +463,12 @@ export var AgoraRtcSourceManagerImpl = /*#__PURE__*/function () {
485
463
  this._microphoneStateControl.sourceIdList.forEach(function (sourceId) {
486
464
  if (res === 0) {
487
465
  if (keepRecording) {
488
- _this3._microphoneStateControl.startSourceTest(sourceId);
466
+ _this4._microphoneStateControl.startSourceTest(sourceId);
489
467
  } else {
490
- _this3._microphoneStateControl.stopSourceTest(sourceId);
468
+ _this4._microphoneStateControl.stopSourceTest(sourceId);
491
469
  }
492
470
  } else {
493
- _this3._microphoneStateControl.occurSourceError(sourceId);
471
+ _this4._microphoneStateControl.occurSourceError(sourceId);
494
472
  }
495
473
  });
496
474
  }
@@ -659,7 +637,6 @@ export var AgoraRtcSourceManagerImpl = /*#__PURE__*/function () {
659
637
  if (!sourceCaptureEnabled) {
660
638
  res = this._startCameraCapture(cameraDeviceId);
661
639
  if (res === 0) {
662
- this._cameraCapturingDeviceIds.add(cameraDeviceId);
663
640
  this._cameraPreviewTaskManager.executeTasksBySourceId(cameraDeviceId);
664
641
  }
665
642
  }
@@ -684,9 +661,6 @@ export var AgoraRtcSourceManagerImpl = /*#__PURE__*/function () {
684
661
  var res = 0;
685
662
  if (!isMediaCaptureTestingAndOpenEnabled && sourceCaptureEnabled) {
686
663
  res = this._stopCameraCapture(cameraDeviceId);
687
- if (res === 0) {
688
- this._cameraCapturingDeviceIds["delete"](cameraDeviceId);
689
- }
690
664
  }
691
665
  if (res === 0) {
692
666
  if (isStopCameraTest) {
@@ -913,7 +887,7 @@ export var AgoraRtcSourceManagerImpl = /*#__PURE__*/function () {
913
887
  }, {
914
888
  key: "_initializeDeviceList",
915
889
  value: function _initializeDeviceList() {
916
- var _this4 = this;
890
+ var _this5 = this;
917
891
  this._cameraList = this._getCameraList();
918
892
  this._microphoneList = this._getMicrophoneList();
919
893
  var cameraList = Array.from(this._cameraList.values());
@@ -922,7 +896,7 @@ export var AgoraRtcSourceManagerImpl = /*#__PURE__*/function () {
922
896
  this.observable.notifyObservers('onMicrophoneListAdded', microphoneList);
923
897
  this._getSystemSelectedUniqueDeviceId().then(function (deviceTag) {
924
898
  if (deviceTag) {
925
- _this4._systemSelectedMicrophoneTag = deviceTag;
899
+ _this5._systemSelectedMicrophoneTag = deviceTag;
926
900
  }
927
901
  });
928
902
  }
@@ -1185,63 +1159,63 @@ export var AgoraRtcSourceManagerImpl = /*#__PURE__*/function () {
1185
1159
  }, {
1186
1160
  key: "_createMicrophoneStateControlObserver",
1187
1161
  value: function _createMicrophoneStateControlObserver() {
1188
- var _this5 = this;
1162
+ var _this6 = this;
1189
1163
  return {
1190
1164
  onSourceStateUpdated: function onSourceStateUpdated(deviceId, deviceStateEnabled) {
1191
1165
  var state = deviceStateEnabled ? AgoraRtcMediaSourceState.OPEN : AgoraRtcMediaSourceState.CLOSE;
1192
1166
  if (deviceStateEnabled) {
1193
- _this5.observable.notifyObservers('onMicrophoneStateUpdated', deviceId, state);
1167
+ _this6.observable.notifyObservers('onMicrophoneStateUpdated', deviceId, state);
1194
1168
  } else {
1195
- _this5.observable.notifyObservers('onMicrophoneStateUpdated', deviceId, state);
1169
+ _this6.observable.notifyObservers('onMicrophoneStateUpdated', deviceId, state);
1196
1170
  }
1197
1171
  },
1198
1172
  onSourceErrorOccurred: function onSourceErrorOccurred(deviceId) {
1199
- _this5.observable.notifyObservers('onMicrophoneStateUpdated', deviceId, AgoraRtcMediaSourceState.ERROR);
1173
+ _this6.observable.notifyObservers('onMicrophoneStateUpdated', deviceId, AgoraRtcMediaSourceState.ERROR);
1200
1174
  },
1201
1175
  onMicrophoneVolumeIndicationUpdated: function onMicrophoneVolumeIndicationUpdated(deviceId, volume) {
1202
- _this5.observable.notifyObservers('onMicrophoneVolumeIndicationUpdated', deviceId, volume);
1176
+ _this6.observable.notifyObservers('onMicrophoneVolumeIndicationUpdated', deviceId, volume);
1203
1177
  }
1204
1178
  };
1205
1179
  }
1206
1180
  }, {
1207
1181
  key: "_createCameraStateControlObserver",
1208
1182
  value: function _createCameraStateControlObserver() {
1209
- var _this6 = this;
1183
+ var _this7 = this;
1210
1184
  return {
1211
1185
  onSourceStateUpdated: function onSourceStateUpdated(sourceId, deviceStateEnabled) {
1212
1186
  var state = deviceStateEnabled ? AgoraRtcMediaSourceState.OPEN : AgoraRtcMediaSourceState.CLOSE;
1213
- _this6.observable.notifyObservers('onCameraStateUpdated', sourceId, state);
1187
+ _this7.observable.notifyObservers('onCameraStateUpdated', sourceId, state);
1214
1188
  },
1215
1189
  onSourceErrorOccurred: function onSourceErrorOccurred(sourceId) {
1216
- _this6.observable.notifyObservers('onCameraStateUpdated', sourceId, AgoraRtcMediaSourceState.ERROR);
1190
+ _this7.observable.notifyObservers('onCameraStateUpdated', sourceId, AgoraRtcMediaSourceState.ERROR);
1217
1191
  }
1218
1192
  };
1219
1193
  }
1220
1194
  }, {
1221
1195
  key: "_createScreenStateControlObserver",
1222
1196
  value: function _createScreenStateControlObserver(type) {
1223
- var _this7 = this;
1197
+ var _this8 = this;
1224
1198
  return {
1225
1199
  onSourceStateUpdated: function onSourceStateUpdated(sourceId, sourceStateEnabled) {
1226
1200
  var state = sourceStateEnabled ? AgoraRtcMediaSourceState.OPEN : AgoraRtcMediaSourceState.CLOSE;
1227
- _this7.observable.notifyObservers('onScreenCaptureStateUpdated', sourceId, type, state);
1201
+ _this8.observable.notifyObservers('onScreenCaptureStateUpdated', sourceId, type, state);
1228
1202
  },
1229
1203
  onSourceErrorOccurred: function onSourceErrorOccurred(sourceId) {
1230
- _this7.observable.notifyObservers('onScreenCaptureStateUpdated', sourceId, type, AgoraRtcMediaSourceState.ERROR);
1204
+ _this8.observable.notifyObservers('onScreenCaptureStateUpdated', sourceId, type, AgoraRtcMediaSourceState.ERROR);
1231
1205
  }
1232
1206
  };
1233
1207
  }
1234
1208
  }, {
1235
1209
  key: "_createLoopbackStateControlObserver",
1236
1210
  value: function _createLoopbackStateControlObserver() {
1237
- var _this8 = this;
1211
+ var _this9 = this;
1238
1212
  return {
1239
1213
  onSourceStateUpdated: function onSourceStateUpdated(sourceId, sourceStateEnabled) {
1240
1214
  var state = sourceStateEnabled ? AgoraRtcMediaSourceState.OPEN : AgoraRtcMediaSourceState.CLOSE;
1241
- _this8.observable.notifyObservers('onLoopbackRecordingStateUpdated', sourceId, state);
1215
+ _this9.observable.notifyObservers('onLoopbackRecordingStateUpdated', sourceId, state);
1242
1216
  },
1243
1217
  onSourceErrorOccurred: function onSourceErrorOccurred(sourceId) {
1244
- _this8.observable.notifyObservers('onLoopbackRecordingStateUpdated', sourceId, AgoraRtcMediaSourceState.ERROR);
1218
+ _this9.observable.notifyObservers('onLoopbackRecordingStateUpdated', sourceId, AgoraRtcMediaSourceState.ERROR);
1245
1219
  }
1246
1220
  };
1247
1221
  }
@@ -1337,7 +1311,7 @@ export var AgoraRtcSourceManagerImpl = /*#__PURE__*/function () {
1337
1311
  }, {
1338
1312
  key: "_updateMicrophoneDeviceList",
1339
1313
  value: function _updateMicrophoneDeviceList() {
1340
- var _this9 = this;
1314
+ var _this0 = this;
1341
1315
  var audioRecordingDevices = this._audioDeviceManager.enumerateRecordingDevices();
1342
1316
  var oldMicList = this._microphoneList;
1343
1317
  var newMicList = new Map();
@@ -1354,7 +1328,7 @@ export var AgoraRtcSourceManagerImpl = /*#__PURE__*/function () {
1354
1328
  };
1355
1329
  newMicList.set(device.deviceId, deviceInfo);
1356
1330
  var deviceInfoString = "deviceName\uFF1A".concat(deviceInfo === null || deviceInfo === void 0 ? void 0 : deviceInfo.deviceName, " deviceId: ").concat(deviceInfo === null || deviceInfo === void 0 ? void 0 : deviceInfo.deviceId, ", vendorId: ").concat(deviceInfo === null || deviceInfo === void 0 ? void 0 : deviceInfo.vendorId, ", productId: ").concat(deviceInfo === null || deviceInfo === void 0 ? void 0 : deviceInfo.productId);
1357
- _this9.logger.info("RecordingDevices deviceInfoString: ".concat(deviceInfoString));
1331
+ _this0.logger.info("RecordingDevices deviceInfoString: ".concat(deviceInfoString));
1358
1332
  }
1359
1333
  });
1360
1334
  var _this$_getDeviceListC2 = this._getDeviceListChangedInfo({
@@ -1393,7 +1367,7 @@ export var AgoraRtcSourceManagerImpl = /*#__PURE__*/function () {
1393
1367
  }, {
1394
1368
  key: "_handleScreenCaptureStateChanged",
1395
1369
  value: function _handleScreenCaptureStateChanged(callbackCaptureEnabled, type, isManualCloseScreenCapture) {
1396
- var _this0 = this;
1370
+ var _this1 = this;
1397
1371
  var isScreen = type === AgoraRtcScreenCaptureType.SCREEN;
1398
1372
  var screenStateControl = isScreen ? this._screenStateControl : this._windowStateControl;
1399
1373
  screenStateControl.mediaSourceIndexMapping.forEach(function (sourceIndex, sourceId) {
@@ -1405,7 +1379,7 @@ export var AgoraRtcSourceManagerImpl = /*#__PURE__*/function () {
1405
1379
  var isCloseSource = !callbackCaptureEnabled && sourceEnabledState;
1406
1380
  if (isCloseSource) {
1407
1381
  if (isManualCloseScreenCapture) {
1408
- _this0._stopScreenCaptureAndUnbindSource(sourceId, type);
1382
+ _this1._stopScreenCaptureAndUnbindSource(sourceId, type);
1409
1383
  } else {
1410
1384
  screenStateControl.closeSource(sourceId);
1411
1385
  screenStateControl.unbindSourceIdToSourceIndex(sourceId);
@@ -1444,15 +1418,11 @@ export var AgoraRtcSourceManagerImpl = /*#__PURE__*/function () {
1444
1418
  if (storageCaptureDisabled && callbackCaptureEnabled) {
1445
1419
  this.logger.info("_handleCameraVideoStateChanged stopCameraCaptureAndUnbindSource sourceId: ".concat(targetDeviceId));
1446
1420
  var res = this._stopCameraCapture(targetDeviceId);
1447
- if (res === 0) {
1448
- this._cameraCapturingDeviceIds["delete"](targetDeviceId);
1449
- }
1450
1421
  }
1451
1422
  if (storageCaptureEnabled && (isErrorState || isCloseReason)) {
1452
1423
  this.logger.info("_handleCameraVideoStateChanged occurSourceError sourceId: ".concat(targetDeviceId));
1453
1424
  this._cameraStateControl.unbindSourceIdToSourceIndex(targetDeviceId);
1454
1425
  this._cameraStateControl.occurSourceError(targetDeviceId);
1455
- this._cameraCapturingDeviceIds["delete"](targetDeviceId);
1456
1426
  }
1457
1427
  }
1458
1428
  }, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agora-rte-sdk",
3
- "version": "3.10.1-rc.2",
3
+ "version": "3.10.2",
4
4
  "description": "SDK for building interactive scenarios",
5
5
  "author": "agora.io",
6
6
  "license": "ISC",
@@ -29,7 +29,7 @@
29
29
  "@types/sinon": "^17.0.2",
30
30
  "@types/ua-parser-js": "^0.7.35",
31
31
  "agora-token": "^2.0.3",
32
- "agora-toolchain": "3.10.1-rc.2",
32
+ "agora-toolchain": "3.10.2",
33
33
  "core-js": "^3.33.3",
34
34
  "electron": "22.3.27",
35
35
  "husky": "^9.0.11",
@@ -44,7 +44,7 @@
44
44
  "agora-extension-ai-denoiser": "^1.0.0",
45
45
  "agora-extension-beauty-effect": "^1.0.1-beta",
46
46
  "agora-extension-virtual-background": "^2.1.0",
47
- "agora-foundation": "3.10.1-rc.2",
47
+ "agora-foundation": "3.10.2",
48
48
  "agora-rtc-sdk-ng": "4.23.3",
49
49
  "agora-rtm": "2.2.2-3",
50
50
  "await-to-js": "^3.0.0",