agora-rte-sdk 3.7.8 → 3.7.9-alpha

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.
@@ -307,10 +307,7 @@ var AgoraRteApDetectorImpl = exports.AgoraRteApDetectorImpl = /*#__PURE__*/funct
307
307
  if (internalRtcConfig === undefined && externalRtcConfig === undefined) {
308
308
  return false;
309
309
  }
310
- if ((internalRtcConfig === null || internalRtcConfig === void 0 ? void 0 : internalRtcConfig.serverList) === undefined || (externalRtcConfig === null || externalRtcConfig === void 0 ? void 0 : externalRtcConfig.serverList) === undefined) {
311
- return false;
312
- }
313
- if ((internalRtcConfig === null || internalRtcConfig === void 0 ? void 0 : internalRtcConfig.serverList.length) === 0 && (externalRtcConfig === null || externalRtcConfig === void 0 ? void 0 : externalRtcConfig.serverList.length) === 0) {
310
+ if ((0, _imports.isEmpty)(internalRtcConfig === null || internalRtcConfig === void 0 ? void 0 : internalRtcConfig.serverList) && (0, _imports.isEmpty)(externalRtcConfig === null || externalRtcConfig === void 0 ? void 0 : externalRtcConfig.serverList)) {
314
311
  return false;
315
312
  }
316
313
  return true;
package/lib/imports.d.ts CHANGED
@@ -24,7 +24,8 @@ import padEnd from 'lodash/padEnd';
24
24
  import keyBy from 'lodash/keyBy';
25
25
  import filter from 'lodash/filter';
26
26
  import isEqual from 'lodash/isEqual';
27
- export { get, toLower, padStart, cloneDeep, padEnd, keyBy, filter, isEqual };
27
+ import { isEmpty } from 'lodash';
28
+ export { get, toLower, padStart, cloneDeep, padEnd, keyBy, filter, isEqual, isEmpty };
28
29
  import Immutable from 'immutable';
29
30
  export { Immutable };
30
31
  import to from 'await-to-js';
package/lib/imports.js CHANGED
@@ -125,6 +125,12 @@ Object.defineProperty(exports, "isElectron", {
125
125
  return _env.isElectron;
126
126
  }
127
127
  });
128
+ Object.defineProperty(exports, "isEmpty", {
129
+ enumerable: true,
130
+ get: function get() {
131
+ return _lodash.isEmpty;
132
+ }
133
+ });
128
134
  Object.defineProperty(exports, "isEqual", {
129
135
  enumerable: true,
130
136
  get: function get() {
@@ -249,6 +255,7 @@ var _padEnd = _interopRequireDefault(require("lodash/padEnd"));
249
255
  var _keyBy = _interopRequireDefault(require("lodash/keyBy"));
250
256
  var _filter = _interopRequireDefault(require("lodash/filter"));
251
257
  var _isEqual = _interopRequireDefault(require("lodash/isEqual"));
258
+ var _lodash = require("lodash");
252
259
  var _immutable = _interopRequireDefault(require("immutable"));
253
260
  var _awaitToJs = _interopRequireDefault(require("await-to-js"));
254
261
  var _restfulClient = require("./plugin/restful-client");
@@ -237,7 +237,11 @@ var AgoraRtcCaptureEnhancementImpl = exports.AgoraRtcCaptureEnhancementImpl = /*
237
237
  key: "disableAiDenoiser",
238
238
  value: function disableAiDenoiser(_) {
239
239
  this.logger.debug('Disabling RTC AI denoiser');
240
- return this._rtcEngine.setAINSMode(false, 0);
240
+ var config = _constants.DISABLE_AI_DENOISE_CONFIG;
241
+ this._rtcEngine.setParameters(JSON.stringify(config));
242
+ return 0;
243
+
244
+ // return this._rtcEngine.setAINSMode(false, 0 as AudioAinsMode.AinsModeBalanced);
241
245
  }
242
246
  }, {
243
247
  key: "setAiDenoiseLevel",
@@ -27,6 +27,13 @@ export declare const AUDIO_CHANNELS = 8;
27
27
  export declare const DEVICE_SCORE_THRESHOLD = 65;
28
28
  export declare const HIFI_BITRATE = 128000;
29
29
  export declare const STANDARD_BITRATE = 64000;
30
+ export declare const DISABLE_AI_DENOISE_CONFIG: {
31
+ 'che.audio.ans.enable': boolean;
32
+ 'che.audio.sf.enabled': boolean;
33
+ 'che.audio.bgns_config': {
34
+ bgNSpreset: number;
35
+ };
36
+ };
30
37
  export declare const AI_DENOISE_CONFIGS: Record<AgoraRtcAiDenoiseLevel, Record<string, any> | undefined>;
31
38
  export declare const IMAGE_PATTERNS: readonly [".png", ".jpg"];
32
39
  export declare const VIDEO_PATTERNS: readonly [".mp4", ".avi", ".mkv", ".flv"];
@@ -5,7 +5,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
- exports.VIDEO_PATTERNS = exports.VALID_BACKGROUND_TYPES = exports.STATS_INTERVAL = exports.STANDARD_BITRATE = exports.RTC_PARAMS = exports.RENDER_CONSTANTS = exports.REDUCE_LOOPBACK_VOLUME_MICROPHONE = exports.REDUCE_LOOPBACK_VOLUME = exports.MEDIA_DEVICE_TYPE = exports.MEDIA_DEVICE_STATE = exports.IMAGE_PATTERNS = exports.HIFI_BITRATE = exports.DISCONNECTED_TIMEOUT = exports.DEVICE_SCORE_THRESHOLD = exports.DEFAULT_VOLUME = exports.DEFAULT_SPEAKER_DEVICE_ID = exports.DEFAULT_RENDERING_FPS = exports.DEFAULT_MICROPHONE_DEVICE_ID = exports.DEFAULT_LOG_LEVEL = exports.DEFAULT_LOG_FILE_SIZE = exports.AUDIO_PROFILES = exports.AUDIO_CHANNELS = exports.AI_DENOISE_CONFIGS = exports.AGORA_ALD_LOOPBACK_DEVICE = void 0;
8
+ exports.VIDEO_PATTERNS = exports.VALID_BACKGROUND_TYPES = exports.STATS_INTERVAL = exports.STANDARD_BITRATE = exports.RTC_PARAMS = exports.RENDER_CONSTANTS = exports.REDUCE_LOOPBACK_VOLUME_MICROPHONE = exports.REDUCE_LOOPBACK_VOLUME = exports.MEDIA_DEVICE_TYPE = exports.MEDIA_DEVICE_STATE = exports.IMAGE_PATTERNS = exports.HIFI_BITRATE = exports.DISCONNECTED_TIMEOUT = exports.DISABLE_AI_DENOISE_CONFIG = exports.DEVICE_SCORE_THRESHOLD = exports.DEFAULT_VOLUME = exports.DEFAULT_SPEAKER_DEVICE_ID = exports.DEFAULT_RENDERING_FPS = exports.DEFAULT_MICROPHONE_DEVICE_ID = exports.DEFAULT_LOG_LEVEL = exports.DEFAULT_LOG_FILE_SIZE = exports.AUDIO_PROFILES = exports.AUDIO_CHANNELS = exports.AI_DENOISE_CONFIGS = exports.AGORA_ALD_LOOPBACK_DEVICE = void 0;
9
9
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
10
10
  var _type = require("../../../core/rtc/type");
11
11
  var DEFAULT_LOG_FILE_SIZE = exports.DEFAULT_LOG_FILE_SIZE = 512;
@@ -43,32 +43,96 @@ var AUDIO_CHANNELS = exports.AUDIO_CHANNELS = 8;
43
43
  var DEVICE_SCORE_THRESHOLD = exports.DEVICE_SCORE_THRESHOLD = 65;
44
44
  var HIFI_BITRATE = exports.HIFI_BITRATE = 128000;
45
45
  var STANDARD_BITRATE = exports.STANDARD_BITRATE = 64000;
46
+ var DISABLE_AI_DENOISE_CONFIG = exports.DISABLE_AI_DENOISE_CONFIG = {
47
+ 'che.audio.ans.enable': false,
48
+ 'che.audio.sf.enabled': false,
49
+ 'che.audio.bgns_config': {
50
+ bgNSpreset: 0
51
+ }
52
+ };
46
53
 
47
54
  // AI降噪配置映射
48
55
  var AI_DENOISE_CONFIGS = exports.AI_DENOISE_CONFIGS = (0, _defineProperty2["default"])((0, _defineProperty2["default"])((0, _defineProperty2["default"])((0, _defineProperty2["default"])({}, _type.AgoraRtcAiDenoiseLevel.AUTO, undefined), _type.AgoraRtcAiDenoiseLevel.LOW, {
49
- 'che.audio.enable.nsng': true,
50
- 'che.audio.ains_mode': 0,
51
- 'che.audio.ns.mode': 0,
52
- 'che.audio.nsng.lowerBound': 80,
53
- 'che.audio.nsng.lowerMask': 50,
54
- 'che.audio.nsng.statisticalbound': 5,
55
- 'che.audio.nsng.finallowermask': 30
56
+ // 'che.audio.enable.nsng': true,
57
+ // 'che.audio.ains_mode': 0,
58
+ // 'che.audio.ns.mode': 0,
59
+ // 'che.audio.nsng.lowerBound': 80,
60
+ // 'che.audio.nsng.lowerMask': 50,
61
+ // 'che.audio.nsng.statisticalbound': 5,
62
+ // 'che.audio.nsng.finallowermask': 30,
63
+
64
+ 'che.audio.aec.split_srate_for_48k': 16000,
65
+ 'che.audio.sf.enabled': true,
66
+ 'che.audio.sf.delayMode': 1,
67
+ 'che.audio.sf.ainsModelPref': 10,
68
+ 'che.audio.sf.nsngAlgRoute': 10,
69
+ 'che.audio.sf.statNsEnhFactor': 200,
70
+ 'che.audio.sf.ainsKillHEBandFlag': 0,
71
+ 'che.audio.sf.statNsLowerBound': 30,
72
+ 'che.audio.sf.nsngMapInMaskMin': 150,
73
+ 'che.audio.sf.nsngMapOutMaskMin': 0,
74
+ 'che.audio.sf.nsngFinalMaskLowerBound': 0,
75
+ 'che.audio.bgns_config': {
76
+ bgNSpreset: 0
77
+ }
56
78
  }), _type.AgoraRtcAiDenoiseLevel.MEDIUM, {
57
- 'che.audio.enable.nsng': true,
58
- 'che.audio.ains_mode': 2,
59
- 'che.audio.ns.mode': 2,
60
- 'che.audio.nsng.lowerBound': 80,
61
- 'che.audio.nsng.lowerMask': 50,
62
- 'che.audio.nsng.statisticalbound': 5,
63
- 'che.audio.nsng.finallowermask': 30
79
+ // 'che.audio.enable.nsng': true,
80
+ // 'che.audio.ains_mode': 2,
81
+ // 'che.audio.ns.mode': 2,
82
+ // 'che.audio.nsng.lowerBound': 80,
83
+ // 'che.audio.nsng.lowerMask': 50,
84
+ // 'che.audio.nsng.statisticalbound': 5,
85
+ // 'che.audio.nsng.finallowermask': 30,
86
+
87
+ 'che.audio.aec.split_srate_for_48k': 16000,
88
+ 'che.audio.sf.enabled': true,
89
+ 'che.audio.sf.delayMode': 1,
90
+ 'che.audio.sf.ainsModelPref': 10,
91
+ 'che.audio.sf.nsngAlgRoute': 12,
92
+ 'che.audio.sf.statNsOverDrive': 90,
93
+ 'che.audio.sf.statNsEnhFactor': 400,
94
+ 'che.audio.sf.ainsKillHEBandFlag': 0,
95
+ 'che.audio.sf.statNsLowerBound': 100,
96
+ 'che.audio.sf.nsngMapInMaskMin': 150,
97
+ 'che.audio.sf.nsngMapOutMaskMin': 0,
98
+ 'che.audio.sf.nsngFinalMaskLowerBound': 0,
99
+ 'che.audio.bgns_config': {
100
+ bgNSpreset: 1,
101
+ bgNSmode: 0,
102
+ bgNSThreshold: 25,
103
+ bgNSAttackTime: 400,
104
+ bgNSAttackHoldTime: 150,
105
+ bgNSReleaseTime: 80,
106
+ bgNSReleaseHoldTime: 10,
107
+ bgNSThreshold_releaselevel: 18,
108
+ bgNSThreshold_releasetime: 5000,
109
+ bgNSMiniThreshold: 0,
110
+ bgNSThreshold_startuptime: 30
111
+ }
64
112
  }), _type.AgoraRtcAiDenoiseLevel.HIGH, {
65
- 'che.audio.enable.nsng': true,
66
- 'che.audio.ains_mode': 2,
67
- 'che.audio.ns.mode': 2,
68
- 'che.audio.nsng.lowerBound': 10,
69
- 'che.audio.nsng.lowerMask': 10,
70
- 'che.audio.nsng.statisticalbound': 0,
71
- 'che.audio.nsng.finallowermask': 8
113
+ // 'che.audio.enable.nsng': true,
114
+ // 'che.audio.ains_mode': 2,
115
+ // 'che.audio.ns.mode': 2,
116
+ // 'che.audio.nsng.lowerBound': 10,
117
+ // 'che.audio.nsng.lowerMask': 10,
118
+ // 'che.audio.nsng.statisticalbound': 0,
119
+ // 'che.audio.nsng.finallowermask': 8,
120
+ 'che.audio.aec.split_srate_for_48k': 16000,
121
+ 'che.audio.sf.enabled': true,
122
+ 'che.audio.sf.delayMode': 1,
123
+ 'che.audio.sf.ainsModelPref': 10,
124
+ 'che.audio.sf.nsngAlgRoute': 12,
125
+ 'che.audio.sf.statNsOverDrive': 110,
126
+ 'che.audio.sf.statNsEnhFactor': 200,
127
+ 'che.audio.sf.ainsKillHEBandFlag': 0,
128
+ 'che.audio.sf.statNsLowerBound': 30,
129
+ 'che.audio.sf.nsngMapInMaskMin': 150,
130
+ 'che.audio.sf.nsngMapOutMaskMin': 0,
131
+ 'che.audio.sf.nsngFinalMaskLowerBound': 0,
132
+ 'che.audio.bgns_config': {
133
+ bgNSpreset: 3,
134
+ bgNSmode: 3
135
+ }
72
136
  });
73
137
 
74
138
  // 文件模式常量
@@ -418,7 +418,7 @@ var AgoraRtcChannelPublisherImpl = exports.AgoraRtcChannelPublisherImpl = /*#__P
418
418
  if (state === _type3.AgoraRtcMediaSourceState.ERROR) {
419
419
  return _constant.AgoraRtcErrorCode.CANNOT_PUBLISH_LOCAL_AUDIO_STREAM;
420
420
  }
421
- if (type === _type3.AgoraRtcAudioSourceType.LOOPBACK) {
421
+ if (type === _type3.AgoraRtcAudioSourceType.LOOPBACK && state === _type3.AgoraRtcMediaSourceState.OPEN) {
422
422
  this._rtcEngine.setAudioScenario(3);
423
423
  }
424
424
  this._publishAudioMapping.set(streamId, {
@@ -433,7 +433,7 @@ var AgoraRtcChannelPublisherImpl = exports.AgoraRtcChannelPublisherImpl = /*#__P
433
433
  key: "unpublishLocalAudioStream",
434
434
  value: function unpublishLocalAudioStream(streamId, type) {
435
435
  if (type === _type3.AgoraRtcAudioSourceType.LOOPBACK) {
436
- this._rtcEngine.setAudioScenario(8);
436
+ this._rtcEngine.setAudioScenario(5);
437
437
  }
438
438
  this._publishAudioMapping["delete"](streamId);
439
439
  return this.publishPool.unpublishAudio(streamId, type);
@@ -50,4 +50,9 @@ export declare class AgoraRtcWebAdapterImp extends AgoraRtcClient {
50
50
  private _stripPort;
51
51
  private _createSystemSelectedDevicePolling;
52
52
  private _getSystemSelectedSpeakerDeviceId;
53
+ /**
54
+ * 处理麦克风保持录音设置
55
+ * @param mainParameters 主要参数
56
+ */
57
+ private _handleMicrophoneKeepRecording;
53
58
  }
@@ -87,6 +87,7 @@ var _decorator = require("agora-foundation/lib/decorator");
87
87
  var _task = require("agora-foundation/lib/schedule/task");
88
88
  var _scheduler = require("agora-foundation/lib/schedule/scheduler");
89
89
  var _constants = require("./constants");
90
+ var _parameters = require("../../../core/utilities/parameters");
90
91
  var _AgoraRtcWebAdapterImp;
91
92
  var _initProto;
92
93
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
@@ -330,6 +331,7 @@ var AgoraRtcWebAdapterImp = exports.AgoraRtcWebAdapterImp = /*#__PURE__*/functio
330
331
  _agoraRtcSdkNg["default"].setParameter(key, value);
331
332
  });
332
333
  }
334
+ this._handleMicrophoneKeepRecording(obj);
333
335
  } catch (e) {
334
336
  this.logger.error('setParameters failed', e);
335
337
  }
@@ -535,6 +537,23 @@ var AgoraRtcWebAdapterImp = exports.AgoraRtcWebAdapterImp = /*#__PURE__*/functio
535
537
  }
536
538
  return _getSystemSelectedSpeakerDeviceId;
537
539
  }()
540
+ /**
541
+ * 处理麦克风保持录音设置
542
+ * @param mainParameters 主要参数
543
+ */
544
+ }, {
545
+ key: "_handleMicrophoneKeepRecording",
546
+ value: function _handleMicrophoneKeepRecording(mainParameters) {
547
+ this.logger.info("[MicrophoneKeepRecording][setParameters] main parameters ==> ".concat(JSON.stringify(mainParameters)));
548
+ var result = (0, _parameters.getRtcMicrophoneKeepRecording)(mainParameters);
549
+ if (!result.exists) {
550
+ this.logger.info("[MicrophoneKeepRecording][setParameters] ".concat(result.reason, ", return"));
551
+ return;
552
+ }
553
+ var microphoneKeepRecording = result.value;
554
+ this.logger.info("[MicrophoneKeepRecording][setParameters] Keep recording on the microphone ==> ".concat(JSON.stringify(microphoneKeepRecording)));
555
+ this.sourceManager.setKeepAudioRecording(microphoneKeepRecording);
556
+ }
538
557
  }]);
539
558
  }(_rtc.AgoraRtcClient);
540
559
  _AgoraRtcWebAdapterImp = AgoraRtcWebAdapterImp;
@@ -10,8 +10,12 @@ export declare class AgoraRtcDeviceManager {
10
10
  private _dualCameraVideoStreamConfig;
11
11
  private _dualScreenVideoStreamConfig;
12
12
  constructor(_extensionDelegate: AgoraWebRtcExtensionDelegate, _dualCameraVideoStreamConfig: AgoraRteDualVideoStreamConfig, _dualScreenVideoStreamConfig: AgoraRteDualVideoStreamConfig);
13
- getVideoTracksMap(): Map<string, ILocalVideoTrack>;
14
- getAudioTracksMap(): Map<string, ILocalAudioTrack>;
13
+ get keepRecording(): boolean;
14
+ setKeepAudioRecording(keepRecording: boolean): void;
15
+ getCameraVideoTracksMap(): Map<string, ILocalVideoTrack>;
16
+ getScreenVideoTracksMap(): Map<string, ILocalVideoTrack>;
17
+ getMicrophoneAudioTracksMap(): Map<string, ILocalAudioTrack>;
18
+ getScreenAudioTracksMap(): Map<string, ILocalAudioTrack>;
15
19
  getVideoDeviceStateMap(): Map<string, {
16
20
  started: boolean;
17
21
  }>;
@@ -75,6 +75,8 @@ var AgoraRtcDeviceManager = exports.AgoraRtcDeviceManager = /*#__PURE__*/functio
75
75
  (0, _defineProperty2["default"])(this, "_effectManager", new AgoraEffectManager());
76
76
  //@internal
77
77
  (0, _defineProperty2["default"])(this, "_observable", new _observable.AgoraObservable());
78
+ //@internal
79
+ (0, _defineProperty2["default"])(this, "_keepAudioRecording", false);
78
80
  this._extensionDelegate = _extensionDelegate;
79
81
  this._dualCameraVideoStreamConfig = _dualCameraVideoStreamConfig;
80
82
  this._dualScreenVideoStreamConfig = _dualScreenVideoStreamConfig;
@@ -86,17 +88,36 @@ var AgoraRtcDeviceManager = exports.AgoraRtcDeviceManager = /*#__PURE__*/functio
86
88
  _agoraRtcSdkNg["default"].on('playback-device-changed', this._handleSpeakerChanged);
87
89
  this._mediaDeviceStateUpdater = new AgoraMediaDeviceStateUpdater(this._localTrackObservable, this._observable);
88
90
  _agoraRtcSdkNg["default"].registerExtensions(_extensionDelegate.getExtensions());
89
- this._localTrackObservable.addObserver((0, _logger2.generateLogObserver)(this.logger, ['onLocalVideoTrackBeforeCreate', 'onLocalVideoTrackCreated', 'onLocalVideoTrackFailedToCreate', 'onLocalVideoTrackBeforeDestroy']));
91
+ this._localTrackObservable.addObserver((0, _logger2.generateLogObserver)(this.logger, ['onLocalVideoTrackBeforeCreate', 'onLocalVideoTrackCreated', 'onLocalVideoTrackFailedToCreate', 'onLocalVideoTrackBeforeDestroy', 'onVideoDeviceStateFlagUpdated', 'onLocalAudioTrackBeforeCreate', 'onLocalAudioTrackCreated', 'onLocalAudioTrackFailedToCreate', 'onLocalAudioTrackBeforeDestroy', 'onAudioDeviceStateFlagUpdated']));
90
92
  }
91
93
  return (0, _createClass2["default"])(AgoraRtcDeviceManager, [{
92
- key: "getVideoTracksMap",
93
- value: function getVideoTracksMap() {
94
+ key: "keepRecording",
95
+ get: function get() {
96
+ return this._keepAudioRecording;
97
+ }
98
+ }, {
99
+ key: "setKeepAudioRecording",
100
+ value: function setKeepAudioRecording(keepRecording) {
101
+ this._keepAudioRecording = keepRecording;
102
+ this._microphoneControls.forEach(function (control) {
103
+ control.setKeepRecording(keepRecording);
104
+ });
105
+ }
106
+ }, {
107
+ key: "getCameraVideoTracksMap",
108
+ value: function getCameraVideoTracksMap() {
94
109
  var map = new Map();
95
110
  this._cameraControls.forEach(function (control) {
96
111
  if (control.videoTrack) {
97
112
  map.set(control.deviceId, control.videoTrack);
98
113
  }
99
114
  });
115
+ return map;
116
+ }
117
+ }, {
118
+ key: "getScreenVideoTracksMap",
119
+ value: function getScreenVideoTracksMap() {
120
+ var map = new Map();
100
121
  this._screenControls.forEach(function (control) {
101
122
  if (control.videoTrack) {
102
123
  map.set(control.sourceId, control.videoTrack);
@@ -105,14 +126,20 @@ var AgoraRtcDeviceManager = exports.AgoraRtcDeviceManager = /*#__PURE__*/functio
105
126
  return map;
106
127
  }
107
128
  }, {
108
- key: "getAudioTracksMap",
109
- value: function getAudioTracksMap() {
129
+ key: "getMicrophoneAudioTracksMap",
130
+ value: function getMicrophoneAudioTracksMap() {
110
131
  var map = new Map();
111
132
  this._microphoneControls.forEach(function (control) {
112
133
  if (control.audioTrack) {
113
134
  map.set(control.deviceId, control.audioTrack);
114
135
  }
115
136
  });
137
+ return map;
138
+ }
139
+ }, {
140
+ key: "getScreenAudioTracksMap",
141
+ value: function getScreenAudioTracksMap() {
142
+ var map = new Map();
116
143
  this._screenControls.forEach(function (control) {
117
144
  if (control.audioTrack) {
118
145
  map.set(control.sourceId, control.audioTrack);
@@ -179,13 +206,16 @@ var AgoraRtcDeviceManager = exports.AgoraRtcDeviceManager = /*#__PURE__*/functio
179
206
  _agoraRtcSdkNg["default"].off('microphone-changed', this._handleMicChanged);
180
207
  _agoraRtcSdkNg["default"].off('playback-device-changed', this._handleSpeakerChanged);
181
208
  this._cameraControls.forEach(function (control) {
182
- return control.stop();
209
+ control.stop();
210
+ control.release();
183
211
  });
184
212
  this._screenControls.forEach(function (control) {
185
- return control.stop();
213
+ control.stop();
214
+ control.release();
186
215
  });
187
216
  this._microphoneControls.forEach(function (control) {
188
- return control.stop();
217
+ control.stop();
218
+ control.release();
189
219
  });
190
220
  this._cameraControls.clear();
191
221
  this._screenControls.clear();
@@ -617,7 +647,7 @@ var AgoraRtcDeviceManager = exports.AgoraRtcDeviceManager = /*#__PURE__*/functio
617
647
  value: function _getMicrophoneControl(deviceId) {
618
648
  var controls = this._microphoneControls;
619
649
  if (!controls.has(deviceId)) {
620
- controls.set(deviceId, new _microphone.AgoraRtcMicrophoneControl(deviceId, this, this._extensionDelegate));
650
+ controls.set(deviceId, new _microphone.AgoraRtcMicrophoneControl(deviceId, this, this._extensionDelegate, this._keepAudioRecording));
621
651
  }
622
652
  return controls.get(deviceId);
623
653
  }
@@ -1,11 +1,8 @@
1
1
  import { IAgoraRTCClient, ILocalAudioTrack, ILocalVideoTrack } from 'agora-rtc-sdk-ng';
2
- import { AgoraRtcLocalTrackEventsObserver } from './type';
3
- import { AgoraRtcAudioSourceType, AgoraRtcVideoEncoderConfiguration, AgoraRtcVideoSourceType } from '../../../core/rtc/type';
4
- import { AgoraObservable } from 'agora-foundation/lib/utilities/observable';
2
+ import { AgoraRtcVideoEncoderConfiguration } from '../../../core/rtc/type';
5
3
  export declare class AgoraRtcPublishManager {
6
4
  private _mode;
7
5
  private _rtcClient;
8
- private _localTrackObservable;
9
6
  /**
10
7
  * local camera state by device id
11
8
  */
@@ -29,8 +26,7 @@ export declare class AgoraRtcPublishManager {
29
26
  private _audioPublishMap;
30
27
  private _videoEncoderConfigMap;
31
28
  private _isProcessing;
32
- private _trackObserver;
33
- constructor(_mode: 'live' | 'rtc', _rtcClient: IAgoraRTCClient, _localTrackObservable: AgoraObservable<AgoraRtcLocalTrackEventsObserver>,
29
+ constructor(_mode: 'live' | 'rtc', _rtcClient: IAgoraRTCClient,
34
30
  /**
35
31
  * local camera state by device id
36
32
  */
@@ -51,10 +47,10 @@ export declare class AgoraRtcPublishManager {
51
47
  * local tracks mapped by source id
52
48
  */
53
49
  _localAudioTracks?: Map<string, ILocalAudioTrack>);
54
- onLocalVideoTrackCreated(sourceId: string, sourceType: AgoraRtcVideoSourceType, localTrack: ILocalVideoTrack): void;
55
- onLocalVideoTrackBeforeDestroy(sourceId: string, sourceType: AgoraRtcVideoSourceType, localTrack: ILocalVideoTrack): void;
56
- onLocalAudioTrackCreated(sourceId: string, sourceType: AgoraRtcAudioSourceType, localTrack: ILocalAudioTrack): void;
57
- onLocalAudioTrackBeforeDestroy(sourceId: string, sourceType: AgoraRtcAudioSourceType, localTrack: ILocalAudioTrack): void;
50
+ onLocalVideoTrackCreated(sourceId: string, localTrack: ILocalVideoTrack): void;
51
+ onLocalVideoTrackBeforeDestroy(sourceId: string, localTrack: ILocalVideoTrack): void;
52
+ onLocalAudioTrackCreated(sourceId: string, localTrack: ILocalAudioTrack): void;
53
+ onLocalAudioTrackBeforeDestroy(sourceId: string, localTrack: ILocalAudioTrack): void;
58
54
  onVideoDeviceStateFlagUpdated(deviceId: string, flag: number): void;
59
55
  onAudioDeviceStateFlagUpdated(deviceId: string, flag: number): void;
60
56
  publishVideo(streamId: string, sourceId: string): void;
@@ -110,11 +110,11 @@ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e
110
110
  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; }
111
111
  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; }
112
112
  var AgoraRtcPublishManager = exports.AgoraRtcPublishManager = /*#__PURE__*/function () {
113
- function AgoraRtcPublishManager(_mode, _rtcClient, _localTrackObservable) {
114
- var _videoDeviceStateMap = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : new Map();
115
- var _audioDeviceStateMap = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : new Map();
116
- var _localVideoTracks = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : new Map();
117
- var _localAudioTracks = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : new Map();
113
+ function AgoraRtcPublishManager(_mode, _rtcClient) {
114
+ var _videoDeviceStateMap = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : new Map();
115
+ var _audioDeviceStateMap = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : new Map();
116
+ var _localVideoTracks = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : new Map();
117
+ var _localAudioTracks = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : new Map();
118
118
  (0, _classCallCheck2["default"])(this, AgoraRtcPublishManager);
119
119
  (0, _defineProperty2["default"])(this, "logger", (_initProto(this), (0, _logger.createLogger)({
120
120
  prefix: 'AgoraRtcPublishManager'
@@ -127,46 +127,36 @@ var AgoraRtcPublishManager = exports.AgoraRtcPublishManager = /*#__PURE__*/funct
127
127
  (0, _defineProperty2["default"])(this, "_isProcessing", false);
128
128
  this._mode = _mode;
129
129
  this._rtcClient = _rtcClient;
130
- this._localTrackObservable = _localTrackObservable;
131
130
  this._videoDeviceStateMap = _videoDeviceStateMap;
132
131
  this._audioDeviceStateMap = _audioDeviceStateMap;
133
132
  this._localVideoTracks = _localVideoTracks;
134
133
  this._localAudioTracks = _localAudioTracks;
135
134
  this._syncState = this._syncState.bind(this);
136
- this._trackObserver = {
137
- onLocalVideoTrackCreated: this.onLocalVideoTrackCreated.bind(this),
138
- onLocalVideoTrackBeforeDestroy: this.onLocalVideoTrackBeforeDestroy.bind(this),
139
- onLocalAudioTrackCreated: this.onLocalAudioTrackCreated.bind(this),
140
- onLocalAudioTrackBeforeDestroy: this.onLocalAudioTrackBeforeDestroy.bind(this),
141
- onVideoDeviceStateFlagUpdated: this.onVideoDeviceStateFlagUpdated.bind(this),
142
- onAudioDeviceStateFlagUpdated: this.onAudioDeviceStateFlagUpdated.bind(this)
143
- };
144
- this._localTrackObservable.addObserver(this._trackObserver);
145
135
  this._rtcClient.on('connection-state-change', this._handleRtcConnectionStateChange.bind(this));
146
136
  }
147
137
  return (0, _createClass2["default"])(AgoraRtcPublishManager, [{
148
138
  key: "onLocalVideoTrackCreated",
149
- value: function onLocalVideoTrackCreated(sourceId, sourceType, localTrack) {
139
+ value: function onLocalVideoTrackCreated(sourceId, localTrack) {
150
140
  this._localVideoTracks.set(sourceId, localTrack);
151
141
  this._applyVideoEncoderConfig();
152
142
  this._syncState();
153
143
  }
154
144
  }, {
155
145
  key: "onLocalVideoTrackBeforeDestroy",
156
- value: function onLocalVideoTrackBeforeDestroy(sourceId, sourceType, localTrack) {
146
+ value: function onLocalVideoTrackBeforeDestroy(sourceId, localTrack) {
157
147
  this._localVideoTracks["delete"](sourceId);
158
148
  this._destroyedLocalVideoTracks.set(sourceId, localTrack);
159
149
  this._syncState();
160
150
  }
161
151
  }, {
162
152
  key: "onLocalAudioTrackCreated",
163
- value: function onLocalAudioTrackCreated(sourceId, sourceType, localTrack) {
153
+ value: function onLocalAudioTrackCreated(sourceId, localTrack) {
164
154
  this._localAudioTracks.set(sourceId, localTrack);
165
155
  this._syncState();
166
156
  }
167
157
  }, {
168
158
  key: "onLocalAudioTrackBeforeDestroy",
169
- value: function onLocalAudioTrackBeforeDestroy(sourceId, sourceType, localTrack) {
159
+ value: function onLocalAudioTrackBeforeDestroy(sourceId, localTrack) {
170
160
  this._localAudioTracks["delete"](sourceId);
171
161
  this._destroyedLocalAudioTracks.set(sourceId, localTrack);
172
162
  this._syncState();
@@ -231,9 +221,7 @@ var AgoraRtcPublishManager = exports.AgoraRtcPublishManager = /*#__PURE__*/funct
231
221
  }
232
222
  }, {
233
223
  key: "release",
234
- value: function release() {
235
- this._localTrackObservable.removeObserver(this._trackObserver);
236
- }
224
+ value: function release() {}
237
225
  }, {
238
226
  key: "setVideoEncoderConfig",
239
227
  value: function setVideoEncoderConfig(streamId, config) {
@@ -1,7 +1,7 @@
1
- import { IAgoraRTCClient } from 'agora-rtc-sdk-ng';
1
+ import { IAgoraRTCClient, ILocalAudioTrack, ILocalVideoTrack } from 'agora-rtc-sdk-ng';
2
2
  import { AgoraRtcChannelPublisher } from '../../../core/rtc/publisher';
3
3
  import { AgoraRtcSourceManager } from '../../../core/rtc/source-manager';
4
- import { AgoraRtcChannelClientObserver, AgoraRtcConnection, AgoraRtcVideoEncoderConfiguration, AgoraRtcVideoStreamType, AgoraRtcScreenScenarioType, AgoraRtcChannelPublisherObserver } from '../../../core/rtc/type';
4
+ import { AgoraRtcAudioSourceType, AgoraRtcChannelClientObserver, AgoraRtcConnection, AgoraRtcVideoEncoderConfiguration, AgoraRtcVideoSourceType, AgoraRtcVideoStreamType, AgoraRtcScreenScenarioType, AgoraRtcChannelPublisherObserver } from '../../../core/rtc/type';
5
5
  import { AgoraRteVideoSourceType, AgoraRteAudioSourceType } from '../../../type';
6
6
  import { AgoraWebRtcStreamPublishPoolImpl } from './publish-pool';
7
7
  import { AgoraWebRtcChannelClientInitConfig } from './type';
@@ -22,10 +22,17 @@ export declare class AgoraRtcChannelPublisherImpl extends AgoraRtcChannelPublish
22
22
  private _defaultCameraHighVideoEncoderConfig;
23
23
  private _defaultCameraLowVideoEncoderConfig;
24
24
  private _defaultScreenVideoEncoderConfig;
25
+ private _localTrackObserver;
25
26
  publishPool: AgoraWebRtcStreamPublishPoolImpl;
26
27
  private _sourceManagerObserver;
27
28
  private _publishPoolObserver;
28
29
  constructor(mainConnection: AgoraRtcConnection, sourceManager: AgoraRtcSourceManager, _rtcClient: IAgoraRTCClient, _initConfig: AgoraWebRtcChannelClientInitConfig, _deviceManager: AgoraRtcDeviceManager, _channelObservable: AgoraObservable<AgoraRtcChannelClientObserver>);
30
+ onLocalVideoTrackCreated(sourceId: string, sourceType: AgoraRtcVideoSourceType, localTrack: ILocalVideoTrack): void;
31
+ onLocalVideoTrackBeforeDestroy(sourceId: string, sourceType: AgoraRtcVideoSourceType, localTrack: ILocalVideoTrack): void;
32
+ onLocalAudioTrackCreated(sourceId: string, sourceType: AgoraRtcAudioSourceType, localTrack: ILocalAudioTrack): void;
33
+ onLocalAudioTrackBeforeDestroy(sourceId: string, sourceType: AgoraRtcAudioSourceType, localTrack: ILocalAudioTrack): void;
34
+ onVideoDeviceStateFlagUpdated(deviceId: string, flag: number): void;
35
+ onAudioDeviceStateFlagUpdated(deviceId: string, flag: number): void;
29
36
  release(): void;
30
37
  publishLocalVideoStream(token: string | undefined, streamId: string, sourceId: string, type: AgoraRteVideoSourceType): number;
31
38
  unpublishLocalVideoStream(streamId: string, type: AgoraRteVideoSourceType): number;
@@ -86,7 +86,7 @@ function _setFunctionName(e, t, n) { "symbol" == _typeof(t) && (t = (t = t.descr
86
86
  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; }
87
87
  var AgoraRtcChannelPublisherImpl = exports.AgoraRtcChannelPublisherImpl = /*#__PURE__*/function (_AgoraRtcChannelPubli) {
88
88
  function AgoraRtcChannelPublisherImpl(mainConnection, sourceManager, _rtcClient, _initConfig, _deviceManager, _channelObservable) {
89
- var _this$_initConfig$opt, _this$_initConfig$opt2;
89
+ var _this$onVideoDeviceSt, _this$onAudioDeviceSt, _this$_initConfig$opt, _this$_initConfig$opt2;
90
90
  var _this;
91
91
  (0, _classCallCheck2["default"])(this, AgoraRtcChannelPublisherImpl);
92
92
  _this = _callSuper(this, AgoraRtcChannelPublisherImpl);
@@ -99,6 +99,14 @@ var AgoraRtcChannelPublisherImpl = exports.AgoraRtcChannelPublisherImpl = /*#__P
99
99
  (0, _defineProperty2["default"])(_this, "_publishManagerBinderMap", new Map());
100
100
  (0, _defineProperty2["default"])(_this, "_publishVideoMapping", new Map());
101
101
  (0, _defineProperty2["default"])(_this, "_publishAudioMapping", new Map());
102
+ (0, _defineProperty2["default"])(_this, "_localTrackObserver", {
103
+ onLocalVideoTrackCreated: _this.onLocalVideoTrackCreated.bind(_this),
104
+ onLocalVideoTrackBeforeDestroy: _this.onLocalVideoTrackBeforeDestroy.bind(_this),
105
+ onLocalAudioTrackCreated: _this.onLocalAudioTrackCreated.bind(_this),
106
+ onLocalAudioTrackBeforeDestroy: _this.onLocalAudioTrackBeforeDestroy.bind(_this),
107
+ onVideoDeviceStateFlagUpdated: (_this$onVideoDeviceSt = _this.onVideoDeviceStateFlagUpdated) === null || _this$onVideoDeviceSt === void 0 ? void 0 : _this$onVideoDeviceSt.bind(_this),
108
+ onAudioDeviceStateFlagUpdated: (_this$onAudioDeviceSt = _this.onAudioDeviceStateFlagUpdated) === null || _this$onAudioDeviceSt === void 0 ? void 0 : _this$onAudioDeviceSt.bind(_this)
109
+ });
102
110
  (0, _defineProperty2["default"])(_this, "_sourceManagerObserver", {
103
111
  onCameraStateUpdated: function onCameraStateUpdated(deivceId, state) {
104
112
  _this.publishPool.updateVideoSource(deivceId, _type4.AgoraRtcVideoSourceType.CAMERA, state);
@@ -197,18 +205,74 @@ var AgoraRtcChannelPublisherImpl = exports.AgoraRtcChannelPublisherImpl = /*#__P
197
205
  _this._channelObservable = _channelObservable;
198
206
  _this.sourceManager = sourceManager;
199
207
  _this.publishPool = new _publishPool.AgoraWebRtcStreamPublishPoolImpl(mainConnection);
200
- _this._mainPublishManager = new _publish.AgoraRtcPublishManager((_this$_initConfig$opt = (_this$_initConfig$opt2 = _this._initConfig.options) === null || _this$_initConfig$opt2 === void 0 ? void 0 : _this$_initConfig$opt2.mode) !== null && _this$_initConfig$opt !== void 0 ? _this$_initConfig$opt : 'live', _this._rtcClient, _this._deviceManager.localTrackObservable, _this._deviceManager.getVideoDeviceStateMap(), _this._deviceManager.getAudioDeviceStateMap(), _this._deviceManager.getVideoTracksMap(), _this._deviceManager.getAudioTracksMap());
208
+ _this._mainPublishManager = new _publish.AgoraRtcPublishManager((_this$_initConfig$opt = (_this$_initConfig$opt2 = _this._initConfig.options) === null || _this$_initConfig$opt2 === void 0 ? void 0 : _this$_initConfig$opt2.mode) !== null && _this$_initConfig$opt !== void 0 ? _this$_initConfig$opt : 'live', _this._rtcClient, _this._deviceManager.getVideoDeviceStateMap(), _this._deviceManager.getAudioDeviceStateMap(), _this._deviceManager.getCameraVideoTracksMap(), _this._deviceManager.getMicrophoneAudioTracksMap());
201
209
  _this.sourceManager.addObserver(_this._sourceManagerObserver);
202
210
  _this.publishPool.addObserver(_this._publishPoolObserver);
203
211
  _this._defaultCameraHighVideoEncoderConfig = _initConfig.dualCameraVideoStreamConfig.highVideoEncoderConfig;
204
212
  _this._defaultCameraLowVideoEncoderConfig = _initConfig.dualCameraVideoStreamConfig.lowVideoEncoderConfig;
205
213
  _this._defaultScreenVideoEncoderConfig = _initConfig.dualScreenVideoStreamConfig.highVideoEncoderConfig;
214
+ _this._deviceManager.localTrackObservable.addObserver(_this._localTrackObserver);
206
215
  return _this;
207
216
  }
208
217
  (0, _inherits2["default"])(AgoraRtcChannelPublisherImpl, _AgoraRtcChannelPubli);
209
218
  return (0, _createClass2["default"])(AgoraRtcChannelPublisherImpl, [{
219
+ key: "onLocalVideoTrackCreated",
220
+ value: function onLocalVideoTrackCreated(sourceId, sourceType, localTrack) {
221
+ if (sourceType === _type4.AgoraRtcVideoSourceType.CAMERA) {
222
+ this._mainPublishManager.onLocalVideoTrackCreated(sourceId, localTrack);
223
+ } else if (sourceType === _type4.AgoraRtcVideoSourceType.SCREEN) {
224
+ this._publishManagerBinderMap.forEach(function (binder) {
225
+ binder.publishManager.onLocalVideoTrackCreated(sourceId, localTrack);
226
+ });
227
+ }
228
+ }
229
+ }, {
230
+ key: "onLocalVideoTrackBeforeDestroy",
231
+ value: function onLocalVideoTrackBeforeDestroy(sourceId, sourceType, localTrack) {
232
+ if (sourceType === _type4.AgoraRtcVideoSourceType.CAMERA) {
233
+ this._mainPublishManager.onLocalVideoTrackBeforeDestroy(sourceId, localTrack);
234
+ } else if (sourceType === _type4.AgoraRtcVideoSourceType.SCREEN) {
235
+ this._publishManagerBinderMap.forEach(function (binder) {
236
+ binder.publishManager.onLocalVideoTrackBeforeDestroy(sourceId, localTrack);
237
+ });
238
+ }
239
+ }
240
+ }, {
241
+ key: "onLocalAudioTrackCreated",
242
+ value: function onLocalAudioTrackCreated(sourceId, sourceType, localTrack) {
243
+ if (sourceType === _type4.AgoraRtcAudioSourceType.MICROPHONE) {
244
+ this._mainPublishManager.onLocalAudioTrackCreated(sourceId, localTrack);
245
+ } else if (sourceType === _type4.AgoraRtcAudioSourceType.LOOPBACK) {
246
+ this._publishManagerBinderMap.forEach(function (binder) {
247
+ binder.publishManager.onLocalAudioTrackCreated(sourceId, localTrack);
248
+ });
249
+ }
250
+ }
251
+ }, {
252
+ key: "onLocalAudioTrackBeforeDestroy",
253
+ value: function onLocalAudioTrackBeforeDestroy(sourceId, sourceType, localTrack) {
254
+ if (sourceType === _type4.AgoraRtcAudioSourceType.MICROPHONE) {
255
+ this._mainPublishManager.onLocalAudioTrackBeforeDestroy(sourceId, localTrack);
256
+ } else if (sourceType === _type4.AgoraRtcAudioSourceType.LOOPBACK) {
257
+ this._publishManagerBinderMap.forEach(function (binder) {
258
+ binder.publishManager.onLocalAudioTrackBeforeDestroy(sourceId, localTrack);
259
+ });
260
+ }
261
+ }
262
+ }, {
263
+ key: "onVideoDeviceStateFlagUpdated",
264
+ value: function onVideoDeviceStateFlagUpdated(deviceId, flag) {
265
+ this._mainPublishManager.onVideoDeviceStateFlagUpdated(deviceId, flag);
266
+ }
267
+ }, {
268
+ key: "onAudioDeviceStateFlagUpdated",
269
+ value: function onAudioDeviceStateFlagUpdated(deviceId, flag) {
270
+ this._mainPublishManager.onAudioDeviceStateFlagUpdated(deviceId, flag);
271
+ }
272
+ }, {
210
273
  key: "release",
211
274
  value: function release() {
275
+ this._deviceManager.localTrackObservable.removeObserver(this._localTrackObserver);
212
276
  this.sourceManager.removeObserver(this._sourceManagerObserver);
213
277
  this.publishPool.removeObserver(this._publishPoolObserver);
214
278
  }
@@ -424,7 +488,7 @@ var AgoraRtcPublishManagerBinder = /*#__PURE__*/function () {
424
488
  this._rtcClient.disableDualStream();
425
489
  }
426
490
  }
427
- this._publishManager = new _publish.AgoraRtcPublishManager(mode, this._rtcClient, this._deviceManager.localTrackObservable, this._deviceManager.getVideoDeviceStateMap(), this._deviceManager.getAudioDeviceStateMap(), this._deviceManager.getVideoTracksMap(), this._deviceManager.getAudioTracksMap());
491
+ this._publishManager = new _publish.AgoraRtcPublishManager(mode, this._rtcClient, this._deviceManager.getVideoDeviceStateMap(), this._deviceManager.getAudioDeviceStateMap(), this._deviceManager.getScreenVideoTracksMap(), this._deviceManager.getScreenAudioTracksMap());
428
492
  this._rtcClient.join(this._initConfig.appId, connection.channelId, token, +connection.localUid).then(function () {
429
493
  _this2._trackStatsTask = _imports.AgoraScheduler.shared.addIntervalTask(_this2._handleTrackStatsTask, _imports.AgoraScheduler.Duration.second(2));
430
494
  _this2._connected = true;
@@ -437,6 +501,11 @@ var AgoraRtcPublishManagerBinder = /*#__PURE__*/function () {
437
501
  });
438
502
  }
439
503
  return (0, _createClass2["default"])(AgoraRtcPublishManagerBinder, [{
504
+ key: "publishManager",
505
+ get: function get() {
506
+ return this._publishManager;
507
+ }
508
+ }, {
440
509
  key: "publishVideo",
441
510
  value: function publishVideo(streamId, sourceId) {
442
511
  this._hasPublishedVideo = true;
@@ -1,9 +1,7 @@
1
1
  import { AgoraRtcCameraCaptureParams, AgoraRtcCameraPosition, AgoraRtcDeviceInfo, AgoraRtcDisplayInfo, AgoraRtcMediaSourceState, AgoraRtcScreenCaptureParams, AgoraRtcScreenCaptureType, AgoraRtcSourceManagerObserver, AgoraRtcVideoOrientation, AgoraRtcWindowInfo } from '../../../core/rtc/type';
2
2
  import { AgoraRtcSourceManager } from '../../../core/rtc/source-manager';
3
3
  import { AgoraRtcDeviceManager } from './device';
4
- import { AgoraObservable } from '../../../imports';
5
4
  export declare class AgoraRtcSourceManagerImpl extends AgoraRtcSourceManager {
6
- protected readonly observable: AgoraObservable<AgoraRtcSourceManagerObserver>;
7
5
  constructor({ deviceManager, cameraCaptureParams, screenCaptureParams, }: {
8
6
  deviceManager: AgoraRtcDeviceManager;
9
7
  cameraCaptureParams: AgoraRtcCameraCaptureParams;
@@ -83,6 +83,8 @@ var AgoraRtcSourceManagerImpl = exports.AgoraRtcSourceManagerImpl = /*#__PURE__*
83
83
  prefix: 'AgoraRtcSourceManagerImpl'
84
84
  })));
85
85
  // @internal
86
+ (0, _defineProperty2["default"])(_this, "observable", new _imports.AgoraObservable());
87
+ // @internal
86
88
  (0, _defineProperty2["default"])(_this, "_cameraStateMap", new Map());
87
89
  // @internal
88
90
  (0, _defineProperty2["default"])(_this, "_microphoneStateMap", new Map());
@@ -90,7 +92,6 @@ var AgoraRtcSourceManagerImpl = exports.AgoraRtcSourceManagerImpl = /*#__PURE__*
90
92
  (0, _defineProperty2["default"])(_this, "_screenCaptureStateMap", new Map());
91
93
  // @internal
92
94
  (0, _defineProperty2["default"])(_this, "_loopbackStateMap", new Map());
93
- (0, _defineProperty2["default"])(_this, "observable", new _imports.AgoraObservable());
94
95
  // @internal
95
96
  (0, _defineProperty2["default"])(_this, "_observer", {
96
97
  onScreenCaptureStateUpdated: function onScreenCaptureStateUpdated(sourceId, type, state) {
@@ -188,11 +189,12 @@ var AgoraRtcSourceManagerImpl = exports.AgoraRtcSourceManagerImpl = /*#__PURE__*
188
189
  }, {
189
190
  key: "keepRecording",
190
191
  get: function get() {
191
- return false;
192
+ return this._deviceManager.keepRecording;
192
193
  }
193
194
  }, {
194
195
  key: "setCameraCaptureParams",
195
196
  value: function setCameraCaptureParams(deviceId, params) {
197
+ this._cameraCaptureParams = params;
196
198
  this._deviceManager.setCameraCaptureParams(deviceId, params);
197
199
  return 0;
198
200
  }
@@ -200,6 +202,7 @@ var AgoraRtcSourceManagerImpl = exports.AgoraRtcSourceManagerImpl = /*#__PURE__*
200
202
  key: "openCamera",
201
203
  value: function openCamera(deviceId) {
202
204
  this._cameraStateMap.set(deviceId, _type.AgoraRtcMediaSourceState.OPEN);
205
+ this._deviceManager.setCameraCaptureParams(deviceId, this._cameraCaptureParams);
203
206
  this._deviceManager.startCamera(deviceId);
204
207
  return 0;
205
208
  }
@@ -296,14 +299,6 @@ var AgoraRtcSourceManagerImpl = exports.AgoraRtcSourceManagerImpl = /*#__PURE__*
296
299
  this._deviceManager.startScreenCapture(sourceId, params);
297
300
  return 0;
298
301
  }
299
-
300
- // @trace
301
- // updateScreenCapture(sourceId: string, params: AgoraRtcScreenCaptureParams): number {
302
- // return 0;
303
- // }
304
-
305
- // stopScreenCapture(sourceId: string): number;
306
- // stopScreenCapture(sourceId: string, type: AgoraRtcScreenCaptureType): number;
307
302
  }, {
308
303
  key: "stopScreenCapture",
309
304
  value: function stopScreenCapture(sourceId, type) {
@@ -384,7 +379,7 @@ var AgoraRtcSourceManagerImpl = exports.AgoraRtcSourceManagerImpl = /*#__PURE__*
384
379
  }, {
385
380
  key: "setKeepAudioRecording",
386
381
  value: function setKeepAudioRecording(keepRecording) {
387
- this.logger.warn('setKeepAudioRecording is only available in Electron');
382
+ this._deviceManager.setKeepAudioRecording(keepRecording);
388
383
  }
389
384
  }, {
390
385
  key: "observeSystemSelectedMicrophoneChanged",
@@ -489,7 +484,7 @@ var AgoraRtcSourceManagerImpl = exports.AgoraRtcSourceManagerImpl = /*#__PURE__*
489
484
  }]);
490
485
  }(_sourceManager.AgoraRtcSourceManager);
491
486
  _AgoraRtcSourceManagerImpl = AgoraRtcSourceManagerImpl;
492
- var _applyDecs$e = _applyDecs(_AgoraRtcSourceManagerImpl, [[_decorator.trace, 2, "openCamera"], [_decorator.trace, 2, "closeCamera"], [_decorator.trace, 2, "switchCamera"], [_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, "startScreenCaptureByDisplayIdWithParams"], [_decorator.trace, 2, "startScreenCaptureByDisplayId"], [_decorator.trace, 2, "startScreenCaptureByWindowIdWithParams"], [_decorator.trace, 2, "startScreenCaptureByWindowId"], [_decorator.trace, 2, "startScreenCapture"], [_decorator.trace, 2, "startLoopbackRecording"], [_decorator.trace, 2, "stopLoopbackRecording"], [_decorator.trace, 2, "adjustLoopbackVolume"], [_decorator.trace, 2, "adjustMicrophoneVolume"], [_decorator.trace, 2, "observeSystemSelectedMicrophoneChanged"], [_decorator.bound, 2, "_checkRecordingDefaultDevice"]], [], 0, void 0, _sourceManager.AgoraRtcSourceManager).e;
487
+ var _applyDecs$e = _applyDecs(_AgoraRtcSourceManagerImpl, [[_decorator.trace, 2, "openCamera"], [_decorator.trace, 2, "closeCamera"], [_decorator.trace, 2, "switchCamera"], [_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, "startScreenCaptureByDisplayIdWithParams"], [_decorator.trace, 2, "startScreenCaptureByDisplayId"], [_decorator.trace, 2, "startScreenCaptureByWindowIdWithParams"], [_decorator.trace, 2, "startScreenCaptureByWindowId"], [_decorator.trace, 2, "startScreenCapture"], [_decorator.trace, 2, "stopScreenCapture"], [_decorator.trace, 2, "startLoopbackRecording"], [_decorator.trace, 2, "stopLoopbackRecording"], [_decorator.trace, 2, "adjustLoopbackVolume"], [_decorator.trace, 2, "adjustMicrophoneVolume"], [_decorator.trace, 2, "setKeepAudioRecording"], [_decorator.trace, 2, "observeSystemSelectedMicrophoneChanged"], [_decorator.bound, 2, "_checkRecordingDefaultDevice"]], [], 0, void 0, _sourceManager.AgoraRtcSourceManager).e;
493
488
  var _applyDecs$e2 = (0, _slicedToArray2["default"])(_applyDecs$e, 1);
494
489
  _initProto = _applyDecs$e2[0];
495
490
  _applyDecs$e;
@@ -9,6 +9,7 @@ export declare class AgoraRtcMicrophoneControl {
9
9
  private _extensionDelegate;
10
10
  private static readonly _DEFAULT_TRACK_KEY_;
11
11
  protected logger: import("agora-foundation/lib/logger").Logger;
12
+ private _isKeepRecording;
12
13
  private _isMicrophoneStarted;
13
14
  private _isDeviceStarting;
14
15
  private _isDeviceTesting;
@@ -17,13 +18,12 @@ export declare class AgoraRtcMicrophoneControl {
17
18
  private _isProcessing;
18
19
  private _volumeTask?;
19
20
  private _volumeInterval;
20
- private _volumeIndicatorEnabled;
21
21
  private _audioRawDataConfig?;
22
22
  private _audioRawDataTrack?;
23
23
  private _volume?;
24
24
  private _localTrackObservable;
25
25
  private _deviceManagerObservable;
26
- constructor(_deviceId: string, _deviceManager: AgoraRtcDeviceManager, _extensionDelegate: AgoraWebRtcExtensionDelegate);
26
+ constructor(_deviceId: string, _deviceManager: AgoraRtcDeviceManager, _extensionDelegate: AgoraWebRtcExtensionDelegate, isKeepRecording: boolean);
27
27
  get audioTrack(): ILocalAudioTrack | undefined;
28
28
  get deviceId(): string;
29
29
  get isStarted(): boolean;
@@ -33,6 +33,7 @@ export declare class AgoraRtcMicrophoneControl {
33
33
  stop(): void;
34
34
  startTest(): void;
35
35
  stopTest(): void;
36
+ setKeepRecording(keepRecording: boolean): void;
36
37
  setVolumeInterval(interval: number): void;
37
38
  enableVolumeIndicator(): void;
38
39
  disableVolumeIndicator(): void;
@@ -48,4 +49,7 @@ export declare class AgoraRtcMicrophoneControl {
48
49
  private _stopVolumePolling;
49
50
  private _isStateStale;
50
51
  private _syncState;
52
+ private _openDevice;
53
+ private _closeDevice;
54
+ private _initPreprocessor;
51
55
  }
@@ -20,13 +20,12 @@ var _struct = require("../struct");
20
20
  var _logger = require("../../../../core/utilities/logger");
21
21
  var _clamp = _interopRequireDefault(require("lodash/clamp"));
22
22
  var AgoraRtcMicrophoneControl = exports.AgoraRtcMicrophoneControl = /*#__PURE__*/function () {
23
- // private _localAudioInputObservable: AgoraObservable<AgoraRtcLocalTrackEventsObserver>;
24
-
25
- function AgoraRtcMicrophoneControl(_deviceId, _deviceManager, _extensionDelegate) {
23
+ function AgoraRtcMicrophoneControl(_deviceId, _deviceManager, _extensionDelegate, isKeepRecording) {
26
24
  (0, _classCallCheck2["default"])(this, AgoraRtcMicrophoneControl);
27
25
  (0, _defineProperty2["default"])(this, "logger", (0, _logger.createLogger)({
28
26
  prefix: 'AgoraRtcMicrophoneControl'
29
27
  }));
28
+ (0, _defineProperty2["default"])(this, "_isKeepRecording", false);
30
29
  (0, _defineProperty2["default"])(this, "_isMicrophoneStarted", false);
31
30
  // True indicates the device is started by start()
32
31
  (0, _defineProperty2["default"])(this, "_isDeviceStarting", false);
@@ -34,7 +33,6 @@ var AgoraRtcMicrophoneControl = exports.AgoraRtcMicrophoneControl = /*#__PURE__*
34
33
  (0, _defineProperty2["default"])(this, "_isDeviceTesting", false);
35
34
  (0, _defineProperty2["default"])(this, "_isProcessing", false);
36
35
  (0, _defineProperty2["default"])(this, "_volumeInterval", 100);
37
- (0, _defineProperty2["default"])(this, "_volumeIndicatorEnabled", false);
38
36
  this._deviceId = _deviceId;
39
37
  this._deviceManager = _deviceManager;
40
38
  this._extensionDelegate = _extensionDelegate;
@@ -43,6 +41,7 @@ var AgoraRtcMicrophoneControl = exports.AgoraRtcMicrophoneControl = /*#__PURE__*
43
41
  this._deviceContxt = new _struct.AgoraRtcAudioEffectContext(_deviceId);
44
42
  this._deviceManagerObservable = this._deviceManager.deviceManagerObservable;
45
43
  this._localTrackObservable = this._deviceManager.localTrackObservable;
44
+ this._isKeepRecording = isKeepRecording;
46
45
  }
47
46
  return (0, _createClass2["default"])(AgoraRtcMicrophoneControl, [{
48
47
  key: "audioTrack",
@@ -109,6 +108,12 @@ var AgoraRtcMicrophoneControl = exports.AgoraRtcMicrophoneControl = /*#__PURE__*
109
108
  this._stopVolumePolling();
110
109
  }
111
110
  }
111
+ }, {
112
+ key: "setKeepRecording",
113
+ value: function setKeepRecording(keepRecording) {
114
+ this._isKeepRecording = keepRecording;
115
+ this._syncState();
116
+ }
112
117
  }, {
113
118
  key: "setVolumeInterval",
114
119
  value: function setVolumeInterval(interval) {
@@ -120,12 +125,12 @@ var AgoraRtcMicrophoneControl = exports.AgoraRtcMicrophoneControl = /*#__PURE__*
120
125
  }, {
121
126
  key: "enableVolumeIndicator",
122
127
  value: function enableVolumeIndicator() {
123
- this._volumeIndicatorEnabled = true;
128
+ this._startVolumePolling();
124
129
  }
125
130
  }, {
126
131
  key: "disableVolumeIndicator",
127
132
  value: function disableVolumeIndicator() {
128
- this._volumeIndicatorEnabled = false;
133
+ this._stopVolumePolling();
129
134
  }
130
135
  }, {
131
136
  key: "setAudioRawDataConfig",
@@ -242,15 +247,16 @@ var AgoraRtcMicrophoneControl = exports.AgoraRtcMicrophoneControl = /*#__PURE__*
242
247
  key: "_isStateStale",
243
248
  value: function _isStateStale(_ref) {
244
249
  var deviceId = _ref.deviceId,
245
- isMicrophoneStarted = _ref.isMicrophoneStarted;
246
- return this._deviceId !== deviceId || this._isMicrophoneStarted !== isMicrophoneStarted;
250
+ isMicrophoneStarted = _ref.isMicrophoneStarted,
251
+ isKeepRecording = _ref.isKeepRecording;
252
+ return this._deviceId !== deviceId || this._isMicrophoneStarted !== isMicrophoneStarted || this._isKeepRecording !== isKeepRecording;
247
253
  }
248
254
  }, {
249
255
  key: "_syncState",
250
256
  value: function () {
251
257
  var _syncState2 = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee() {
252
258
  var _this = this;
253
- var rerun, micTrack, context, extensionDelegate, deviceId, isMicrophoneStarted, start, track, elapsed, _t;
259
+ var rerun, micTrack, deviceId, isMicrophoneStarted, isKeepRecording, shouldOpenDevice, track, _micTrack, _t;
254
260
  return _regenerator["default"].wrap(function (_context) {
255
261
  while (1) switch (_context.prev = _context.next) {
256
262
  case 0:
@@ -262,13 +268,13 @@ var AgoraRtcMicrophoneControl = exports.AgoraRtcMicrophoneControl = /*#__PURE__*
262
268
  case 1:
263
269
  rerun = false;
264
270
  micTrack = this._micTrack;
265
- context = this._deviceContxt;
266
- extensionDelegate = this._extensionDelegate;
267
271
  deviceId = this._deviceId;
268
272
  isMicrophoneStarted = this._isMicrophoneStarted;
273
+ isKeepRecording = this._isKeepRecording;
269
274
  _context.prev = 2;
270
275
  this._isProcessing = true;
271
- if (!isMicrophoneStarted) {
276
+ shouldOpenDevice = isMicrophoneStarted || isKeepRecording;
277
+ if (!shouldOpenDevice) {
272
278
  _context.next = 6;
273
279
  break;
274
280
  }
@@ -277,40 +283,16 @@ var AgoraRtcMicrophoneControl = exports.AgoraRtcMicrophoneControl = /*#__PURE__*
277
283
  break;
278
284
  }
279
285
  this._localTrackObservable.notifyObservers('onLocalAudioTrackBeforeCreate', deviceId, _type.AgoraRtcAudioSourceType.MICROPHONE);
280
- this.logger.debug("before create microphone track, deviceId: ".concat(deviceId));
281
- start = performance.now(); // create a track just for opening the microphone
282
286
  _context.next = 3;
283
- return _agoraRtcSdkNg["default"].createMicrophoneAudioTrack({
284
- microphoneId: deviceId
285
- });
287
+ return this._openDevice(deviceId);
286
288
  case 3:
287
289
  track = _context.sent;
288
- elapsed = performance.now() - start;
289
- this.logger.debug("after create microphone track, deviceId: ".concat(deviceId, ", elapsed: ").concat(elapsed, "ms"));
290
- this._micTrack = track;
291
- if (typeof this._volume === 'number') {
292
- this._micTrack.setVolume(this._volume);
293
- }
294
- this.logger.debug("before create microphone preprocessor, deviceId: ".concat(deviceId));
295
- start = performance.now();
296
290
  _context.next = 4;
297
- return extensionDelegate.createMicrophoneProcessors().then(function (processors) {
298
- _this.logger.debug('create microphone preprocessor success');
299
- context.assembler.addProcessors(processors);
300
- })["catch"](function (e) {
301
- _this.logger.debug('failed to create microphone preprocessor', e);
302
- });
291
+ return this._initPreprocessor(deviceId, track);
303
292
  case 4:
304
- elapsed = performance.now() - start;
305
- this.logger.debug("after create microphone preprocessor, deviceId: ".concat(deviceId, ", elapsed: ").concat(elapsed, "ms"));
306
- context.assembler.setTrack(track);
307
-
308
- // if (this._localAudioInputObservable.countOfObservers() > 0) {
309
- // this._setAudioRawDataCallback();
310
- // } else {
311
- // this._unsetAudioRawDataCallback();
312
- // }
313
-
293
+ if (typeof this._volume === 'number') {
294
+ track.setVolume(this._volume);
295
+ }
314
296
  this._localTrackObservable.notifyObservers('onLocalAudioTrackCreated', deviceId, _type.AgoraRtcAudioSourceType.MICROPHONE, track);
315
297
  track.on('track-ended', function () {
316
298
  _this._localTrackObservable.notifyObservers('onLocalAudioTrackBeforeDestroy', deviceId, _type.AgoraRtcAudioSourceType.MICROPHONE, track);
@@ -321,42 +303,148 @@ var AgoraRtcMicrophoneControl = exports.AgoraRtcMicrophoneControl = /*#__PURE__*
321
303
  case 6:
322
304
  if (micTrack) {
323
305
  this._localTrackObservable.notifyObservers('onLocalAudioTrackBeforeDestroy', deviceId, _type.AgoraRtcAudioSourceType.MICROPHONE, micTrack);
324
- micTrack.stop();
325
- micTrack.close();
306
+ this._closeDevice(micTrack);
326
307
  }
327
- this._micTrack = undefined;
328
- this._audioRawDataTrack = undefined;
329
308
  case 7:
309
+ if (!isKeepRecording) {
310
+ _context.next = 10;
311
+ break;
312
+ }
313
+ _micTrack = this._micTrack;
314
+ if (!isMicrophoneStarted) {
315
+ _context.next = 9;
316
+ break;
317
+ }
318
+ _context.next = 8;
319
+ return _micTrack.setMuted(false);
320
+ case 8:
321
+ _context.next = 10;
322
+ break;
323
+ case 9:
324
+ _context.next = 10;
325
+ return _micTrack.setMuted(true);
326
+ case 10:
330
327
  rerun = this._isStateStale({
331
328
  deviceId: deviceId,
332
- isMicrophoneStarted: isMicrophoneStarted
329
+ isMicrophoneStarted: isMicrophoneStarted,
330
+ isKeepRecording: isKeepRecording
333
331
  });
334
- _context.next = 9;
332
+ _context.next = 12;
335
333
  break;
336
- case 8:
337
- _context.prev = 8;
334
+ case 11:
335
+ _context.prev = 11;
338
336
  _t = _context["catch"](2);
339
337
  this.logger.warn('failed to create a microphone track', _t);
340
338
  this._localTrackObservable.notifyObservers('onLocalAudioTrackFailedToCreate', deviceId, _type.AgoraRtcAudioSourceType.MICROPHONE, _t);
341
- case 9:
342
- _context.prev = 9;
339
+ case 12:
340
+ _context.prev = 12;
343
341
  this._isProcessing = false;
344
342
  if (rerun) {
345
343
  // immediately check again if the state is stale
346
344
  _schedule.AgoraScheduler.shared.addDelayTask(this._syncState, 0);
347
345
  }
348
- return _context.finish(9);
349
- case 10:
346
+ return _context.finish(12);
347
+ case 13:
350
348
  case "end":
351
349
  return _context.stop();
352
350
  }
353
- }, _callee, this, [[2, 8, 9, 10]]);
351
+ }, _callee, this, [[2, 11, 12, 13]]);
354
352
  }));
355
353
  function _syncState() {
356
354
  return _syncState2.apply(this, arguments);
357
355
  }
358
356
  return _syncState;
359
357
  }()
358
+ }, {
359
+ key: "_openDevice",
360
+ value: function () {
361
+ var _openDevice2 = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee2(deviceId) {
362
+ var start, track, elapsed;
363
+ return _regenerator["default"].wrap(function (_context2) {
364
+ while (1) switch (_context2.prev = _context2.next) {
365
+ case 0:
366
+ this.logger.debug("before create microphone track, deviceId: ".concat(deviceId));
367
+ start = performance.now(); // create a track just for opening the microphone
368
+ _context2.next = 1;
369
+ return _agoraRtcSdkNg["default"].createMicrophoneAudioTrack({
370
+ microphoneId: deviceId
371
+ });
372
+ case 1:
373
+ track = _context2.sent;
374
+ elapsed = performance.now() - start;
375
+ this.logger.debug("after create microphone track, deviceId: ".concat(deviceId, ", elapsed: ").concat(elapsed, "ms"));
376
+ this._micTrack = track;
377
+ return _context2.abrupt("return", track);
378
+ case 2:
379
+ case "end":
380
+ return _context2.stop();
381
+ }
382
+ }, _callee2, this);
383
+ }));
384
+ function _openDevice(_x) {
385
+ return _openDevice2.apply(this, arguments);
386
+ }
387
+ return _openDevice;
388
+ }()
389
+ }, {
390
+ key: "_closeDevice",
391
+ value: function () {
392
+ var _closeDevice2 = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee3(track) {
393
+ return _regenerator["default"].wrap(function (_context3) {
394
+ while (1) switch (_context3.prev = _context3.next) {
395
+ case 0:
396
+ if (track) {
397
+ track.stop();
398
+ track.close();
399
+ }
400
+ this._micTrack = undefined;
401
+ this._audioRawDataTrack = undefined;
402
+ case 1:
403
+ case "end":
404
+ return _context3.stop();
405
+ }
406
+ }, _callee3, this);
407
+ }));
408
+ function _closeDevice(_x2) {
409
+ return _closeDevice2.apply(this, arguments);
410
+ }
411
+ return _closeDevice;
412
+ }()
413
+ }, {
414
+ key: "_initPreprocessor",
415
+ value: function () {
416
+ var _initPreprocessor2 = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee4(deviceId, track) {
417
+ var _this2 = this;
418
+ var context, extensionDelegate, start, elapsed;
419
+ return _regenerator["default"].wrap(function (_context4) {
420
+ while (1) switch (_context4.prev = _context4.next) {
421
+ case 0:
422
+ context = this._deviceContxt;
423
+ extensionDelegate = this._extensionDelegate;
424
+ this.logger.debug("before create microphone preprocessor, deviceId: ".concat(deviceId));
425
+ start = performance.now();
426
+ _context4.next = 1;
427
+ return extensionDelegate.createMicrophoneProcessors().then(function (processors) {
428
+ _this2.logger.debug('create microphone preprocessor success');
429
+ context.assembler.addProcessors(processors);
430
+ })["catch"](function (e) {
431
+ _this2.logger.debug('failed to create microphone preprocessor', e);
432
+ });
433
+ case 1:
434
+ elapsed = performance.now() - start;
435
+ this.logger.debug("after create microphone preprocessor, deviceId: ".concat(deviceId, ", elapsed: ").concat(elapsed, "ms"));
436
+ context.assembler.setTrack(track);
437
+ case 2:
438
+ case "end":
439
+ return _context4.stop();
440
+ }
441
+ }, _callee4, this);
442
+ }));
443
+ function _initPreprocessor(_x3, _x4) {
444
+ return _initPreprocessor2.apply(this, arguments);
445
+ }
446
+ return _initPreprocessor;
447
+ }()
360
448
  }]);
361
449
  }();
362
450
  (0, _defineProperty2["default"])(AgoraRtcMicrophoneControl, "_DEFAULT_TRACK_KEY_", '$$default$$');
@@ -13,7 +13,17 @@ export interface AgoraRtcLocalTrackEventsObserver {
13
13
  onLocalAudioTrackCreated?(sourceId: string, sourceType: AgoraRtcAudioSourceType, localTrack: ILocalAudioTrack): void;
14
14
  onLocalAudioTrackBeforeDestroy?(sourceId: string, sourceType: AgoraRtcAudioSourceType, localTrack: ILocalAudioTrack): void;
15
15
  onLocalAudioTrackFailedToCreate?(sourceId: string, sourceType: AgoraRtcAudioSourceType, error?: Error): void;
16
+ /**
17
+ * 当摄像头设备调用start或stop时触发
18
+ * @param deviceId
19
+ * @param stateFlag
20
+ */
16
21
  onVideoDeviceStateFlagUpdated?(deviceId: string, stateFlag: number): void;
22
+ /**
23
+ * 当麦克风设备调用start或stop时触发
24
+ * @param deviceId
25
+ * @param stateFlag
26
+ */
17
27
  onAudioDeviceStateFlagUpdated?(deviceId: string, stateFlag: number): void;
18
28
  }
19
29
  export type AgoraWebRtcClientInitConfig = {
@@ -147,7 +147,7 @@ var AgoraRtmClientImpl = exports.AgoraRtmClientImpl = /*#__PURE__*/function (_Ag
147
147
  this.logger.info("RTM client created, version: ".concat(_agoraRtm["default"].VERSION));
148
148
  if (!this._privateConfig) {
149
149
  rtmRegion = (0, _convertType.convertRtmRegion)(this._region);
150
- this.logger.info("set RTM area: ".concat(rtmRegion, "}"));
150
+ this.logger.info("set RTM area: ".concat(rtmRegion));
151
151
  _agoraRtm["default"].setArea({
152
152
  areaCodes: [rtmRegion]
153
153
  });
@@ -302,14 +302,11 @@ var AgoraRtmClientImpl = exports.AgoraRtmClientImpl = /*#__PURE__*/function (_Ag
302
302
  return _regenerator["default"].wrap(function (_context5) {
303
303
  while (1) switch (_context5.prev = _context5.next) {
304
304
  case 0:
305
- if (this._isLogin) {
306
- _context5.next = 1;
305
+ this._token = token;
306
+ if (!this._isLogin) {
307
+ _context5.next = 4;
307
308
  break;
308
309
  }
309
- this._token = token;
310
- _context5.next = 4;
311
- break;
312
- case 1:
313
310
  _context5.prev = 1;
314
311
  _context5.next = 2;
315
312
  return this._client.renewToken(this._token);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agora-rte-sdk",
3
- "version": "3.7.8",
3
+ "version": "3.7.9-alpha",
4
4
  "description": "SDK for building interactive scenarios",
5
5
  "author": "agora.io",
6
6
  "license": "ISC",
@@ -28,7 +28,7 @@
28
28
  "@types/sinon": "^17.0.2",
29
29
  "@types/ua-parser-js": "^0.7.35",
30
30
  "agora-token": "^2.0.3",
31
- "agora-toolchain": "3.7.8",
31
+ "agora-toolchain": "3.7.9-alpha",
32
32
  "core-js": "^3.33.3",
33
33
  "electron": "22.3.27",
34
34
  "husky": "^9.0.11",
@@ -39,11 +39,11 @@
39
39
  "typescript": "^5.3.2"
40
40
  },
41
41
  "dependencies": {
42
- "agora-electron-sdk": "4.3.2-build.156-rc.1",
42
+ "agora-electron-sdk": "4.3.2-build.201-rc.1",
43
43
  "agora-extension-ai-denoiser": "^1.0.0",
44
44
  "agora-extension-beauty-effect": "^1.0.1-beta",
45
45
  "agora-extension-virtual-background": "^2.1.0",
46
- "agora-foundation": "3.7.8",
46
+ "agora-foundation": "3.7.9-alpha",
47
47
  "agora-rtc-sdk-ng": "4.23.3",
48
48
  "agora-rtm": "2.2.2-3",
49
49
  "await-to-js": "^3.0.0",