agora-rte-sdk 3.7.0 → 3.7.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.
- package/lib/core/processor/message-handler.d.ts +1 -1
- package/lib/core/processor/message-handler.js +8 -2
- package/lib/core/processor/type.d.ts +1 -1
- package/lib/core/scene/index.js +23 -7
- package/lib/plugin/rtc/electron/client.d.ts +3 -0
- package/lib/plugin/rtc/electron/client.js +138 -73
- package/lib/plugin/rtc/electron/source-manager.d.ts +7 -1
- package/lib/plugin/rtc/electron/source-manager.js +157 -76
- package/lib/plugin/rtc/web/client.js +14 -18
- package/package.json +3 -3
|
@@ -27,7 +27,7 @@ export declare class AgoraRteMessageHandle {
|
|
|
27
27
|
onRemoteUsersRemoved: (removedUsers: AgoraRteSequenceMessageOutUser[], removedStreamsData: AgoraRteMediaStreamInfo[]) => void;
|
|
28
28
|
onLocalUserRemoved: (user: AgoraRteSequenceMessageOutUser) => void;
|
|
29
29
|
onLocalUserAdded: (user: AgoraRteSequenceMessageInUser) => void;
|
|
30
|
-
onUserSubscribe: (subscribeUsers: AgoraRteUserInfo[], operator: AgoraRteUserInfo, cause?: import("./type").AgoraRteOperatCause) => void;
|
|
30
|
+
onUserSubscribe: (subscribeUsers: AgoraRteUserInfo[], addedStreamsData: AgoraRteMediaStreamInfo[], operator: AgoraRteUserInfo, cause?: import("./type").AgoraRteOperatCause) => void;
|
|
31
31
|
onUserUnsubscribe: (unsubscribeUsers: AgoraRteUserInfo[], removedStreamsData: AgoraRteMediaStreamInfo[], operator: AgoraRteUserInfo, cause?: import("./type").AgoraRteOperatCause) => void;
|
|
32
32
|
onUserCountUpdated: (total: number) => void;
|
|
33
33
|
onUserPropertyUpdated: (userUuid: string, userProperties: Record<string, unknown>, operator: AgoraRteUserInfo, cause?: import("./type").AgoraRteOperatCause) => void;
|
|
@@ -437,6 +437,7 @@ var AgoraRteMessageHandle = exports.AgoraRteMessageHandle = /*#__PURE__*/functio
|
|
|
437
437
|
cause = data.cause;
|
|
438
438
|
var subscribeUsersData = [];
|
|
439
439
|
var unsubscribeUsersData = [];
|
|
440
|
+
var addedStreamsData = [];
|
|
440
441
|
var removedStreamsData = [];
|
|
441
442
|
users.forEach(function (u) {
|
|
442
443
|
var user;
|
|
@@ -452,6 +453,9 @@ var AgoraRteMessageHandle = exports.AgoraRteMessageHandle = /*#__PURE__*/functio
|
|
|
452
453
|
streams = _u$streams === void 0 ? [] : _u$streams;
|
|
453
454
|
streams.forEach(function (streamData) {
|
|
454
455
|
var stream = _struct.AgoraRteMediaStream.fromData(streamData, user);
|
|
456
|
+
if (!_this4._dataStore.findStream(stream.streamId)) {
|
|
457
|
+
addedStreamsData.push(stream);
|
|
458
|
+
}
|
|
455
459
|
_this4._dataStore.setStream(stream.streamId, stream);
|
|
456
460
|
});
|
|
457
461
|
subscribeUsersData.push(user);
|
|
@@ -474,7 +478,7 @@ var AgoraRteMessageHandle = exports.AgoraRteMessageHandle = /*#__PURE__*/functio
|
|
|
474
478
|
}
|
|
475
479
|
});
|
|
476
480
|
if (subscribeUsersData.length > 0) {
|
|
477
|
-
this.observable.notifyObservers('onUserSubscribe', subscribeUsersData,
|
|
481
|
+
this.observable.notifyObservers('onUserSubscribe', subscribeUsersData, addedStreamsData,
|
|
478
482
|
// FIXME: get real connector
|
|
479
483
|
_type2.AgoraRteUser.fromSeqData(_objectSpread({}, operator)), cause);
|
|
480
484
|
}
|
|
@@ -605,7 +609,9 @@ var AgoraRteMessageHandle = exports.AgoraRteMessageHandle = /*#__PURE__*/functio
|
|
|
605
609
|
var user = this._dataStore.findUser(currentUserOnline.userUuid);
|
|
606
610
|
if (user && user.userRole !== currentUserOnline.role) {
|
|
607
611
|
user.userRole = currentUserOnline.role;
|
|
608
|
-
|
|
612
|
+
var users = [user];
|
|
613
|
+
var streams = [];
|
|
614
|
+
this.observable.notifyObservers('onUserSubscribe', users, streams, _type2.AgoraRteUser.fromSeqData(currentUserOnline));
|
|
609
615
|
}
|
|
610
616
|
this.observable.notifyObservers('onLocalUserAdded', currentUserOnline);
|
|
611
617
|
}
|
|
@@ -136,7 +136,7 @@ export type AgoraRteMessageHandlerObserver = Partial<{
|
|
|
136
136
|
onRemoteUsersRemoved: (removedUsers: AgoraRteSequenceMessageOutUser[], removedStreamsData: AgoraRteMediaStreamInfo[]) => void;
|
|
137
137
|
onLocalUserRemoved: (user: AgoraRteSequenceMessageOutUser) => void;
|
|
138
138
|
onLocalUserAdded: (user: AgoraRteSequenceMessageInUser) => void;
|
|
139
|
-
onUserSubscribe: (subscribeUsers: AgoraRteUserInfo[], operator: AgoraRteUserInfo, cause?: AgoraRteOperatCause) => void;
|
|
139
|
+
onUserSubscribe: (subscribeUsers: AgoraRteUserInfo[], addedStreamsData: AgoraRteMediaStreamInfo[], operator: AgoraRteUserInfo, cause?: AgoraRteOperatCause) => void;
|
|
140
140
|
onUserUnsubscribe: (unsubscribeUsers: AgoraRteUserInfo[], removedStreamsData: AgoraRteMediaStreamInfo[], operator: AgoraRteUserInfo, cause?: AgoraRteOperatCause) => void;
|
|
141
141
|
onUserCountUpdated: (total: number) => void;
|
|
142
142
|
onUserPropertyUpdated: (userUuid: string, userProperties: Record<string, unknown>, operator: AgoraRteUserInfo, cause?: AgoraRteOperatCause) => void;
|
package/lib/core/scene/index.js
CHANGED
|
@@ -1209,7 +1209,7 @@ var AgoraRteScene = exports.AgoraRteScene = /*#__PURE__*/function () {
|
|
|
1209
1209
|
cause: cause
|
|
1210
1210
|
});
|
|
1211
1211
|
},
|
|
1212
|
-
onUserSubscribe: function onUserSubscribe(users, operator, cause) {
|
|
1212
|
+
onUserSubscribe: function onUserSubscribe(users, addedStreams, operator, cause) {
|
|
1213
1213
|
users.forEach(function (user) {
|
|
1214
1214
|
_this9.logger.info("[AgoraRteScene] sceneId:".concat(_this9.sceneId, " user-updated ").concat(user.userId));
|
|
1215
1215
|
_this9.observable.notifyObservers('onUserUpdated', _this9.sceneId, {
|
|
@@ -1218,9 +1218,16 @@ var AgoraRteScene = exports.AgoraRteScene = /*#__PURE__*/function () {
|
|
|
1218
1218
|
reason: _type.AgoraRteUserUpdatedReason.ROLE,
|
|
1219
1219
|
cause: cause
|
|
1220
1220
|
});
|
|
1221
|
+
if (addedStreams.length > 0) {
|
|
1222
|
+
_this9.observable.notifyObservers('onStreamsAdded', _this9.sceneId, addedStreams.map(function (s) {
|
|
1223
|
+
return {
|
|
1224
|
+
modifiedStream: s
|
|
1225
|
+
};
|
|
1226
|
+
}));
|
|
1227
|
+
}
|
|
1221
1228
|
});
|
|
1222
1229
|
},
|
|
1223
|
-
onUserUnsubscribe: function onUserUnsubscribe(users,
|
|
1230
|
+
onUserUnsubscribe: function onUserUnsubscribe(users, removedStreams, operator, cause) {
|
|
1224
1231
|
users.forEach(function (user) {
|
|
1225
1232
|
_this9.logger.info("sceneId:".concat(_this9.sceneId, " user-updated ").concat(user));
|
|
1226
1233
|
_this9.observable.notifyObservers('onUserUpdated', _this9.sceneId, {
|
|
@@ -1229,6 +1236,13 @@ var AgoraRteScene = exports.AgoraRteScene = /*#__PURE__*/function () {
|
|
|
1229
1236
|
reason: _type.AgoraRteUserUpdatedReason.ROLE,
|
|
1230
1237
|
cause: cause
|
|
1231
1238
|
});
|
|
1239
|
+
if (removedStreams.length > 0) {
|
|
1240
|
+
_this9.observable.notifyObservers('onStreamsRemoved', _this9.sceneId, removedStreams.map(function (s) {
|
|
1241
|
+
return {
|
|
1242
|
+
modifiedStream: s
|
|
1243
|
+
};
|
|
1244
|
+
}));
|
|
1245
|
+
}
|
|
1232
1246
|
});
|
|
1233
1247
|
},
|
|
1234
1248
|
onRemoteUsersRemoved: function onRemoteUsersRemoved(users, removedStreams) {
|
|
@@ -1493,11 +1507,13 @@ var AgoraRteScene = exports.AgoraRteScene = /*#__PURE__*/function () {
|
|
|
1493
1507
|
}, {
|
|
1494
1508
|
key: "_handleRemoteUserRemoved",
|
|
1495
1509
|
value: function _handleRemoteUserRemoved(users, removedStreams) {
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1510
|
+
if (removedStreams.length > 0) {
|
|
1511
|
+
this.observable.notifyObservers('onStreamsRemoved', this.sceneId, removedStreams.map(function (s) {
|
|
1512
|
+
return {
|
|
1513
|
+
modifiedStream: s
|
|
1514
|
+
};
|
|
1515
|
+
}));
|
|
1516
|
+
}
|
|
1501
1517
|
var eventUsers = users.map(function (u) {
|
|
1502
1518
|
return {
|
|
1503
1519
|
userInfo: _type.AgoraRteUser.fromSeqData(u),
|
|
@@ -61,4 +61,7 @@ export declare class AgoraRtcClientImpl extends AgoraRtcClient {
|
|
|
61
61
|
private _handleVolumeIndication;
|
|
62
62
|
private _handleTestVolume;
|
|
63
63
|
private _stripPort;
|
|
64
|
+
private _createSystemSelectedDevicePolling;
|
|
65
|
+
private _getSystemSelectedUniqueDeviceId;
|
|
66
|
+
private _getSystemSelectedSpeaker;
|
|
64
67
|
}
|
|
@@ -87,6 +87,8 @@ var _dowloadALD = require("./dowloadALD");
|
|
|
87
87
|
var _logger = require("../../../core/utilities/logger");
|
|
88
88
|
var _parameters2 = require("../../../core/utilities/parameters");
|
|
89
89
|
var _constant = require("../../../constant");
|
|
90
|
+
var _schedule = require("agora-foundation/lib/schedule");
|
|
91
|
+
var _scheduler = require("agora-foundation/lib/schedule/scheduler");
|
|
90
92
|
var _excluded = ["screen"];
|
|
91
93
|
var _AgoraRtcClientImpl;
|
|
92
94
|
var _initProto;
|
|
@@ -107,6 +109,8 @@ var AgoraRtcClientImpl = exports.AgoraRtcClientImpl = /*#__PURE__*/function (_Ag
|
|
|
107
109
|
prefix: 'AgoraRtcClientImpl'
|
|
108
110
|
})));
|
|
109
111
|
// @internal
|
|
112
|
+
(0, _defineProperty2["default"])(_this, "_taskInterval", _scheduler.Duration.second(1));
|
|
113
|
+
// @internal
|
|
110
114
|
(0, _defineProperty2["default"])(_this, "_mainParameters", '');
|
|
111
115
|
//@internal
|
|
112
116
|
(0, _defineProperty2["default"])(_this, "_speakerList", new Map());
|
|
@@ -245,7 +249,7 @@ var AgoraRtcClientImpl = exports.AgoraRtcClientImpl = /*#__PURE__*/function (_Ag
|
|
|
245
249
|
_this._speakerList.set(device.deviceId, deviceInfo);
|
|
246
250
|
}
|
|
247
251
|
});
|
|
248
|
-
_this.
|
|
252
|
+
_this._getSystemSelectedSpeaker().then(function (deviceInfo) {
|
|
249
253
|
if (deviceInfo) {
|
|
250
254
|
_this._systemSelectedSpeakerDeviceId = deviceInfo.deviceId;
|
|
251
255
|
}
|
|
@@ -301,77 +305,49 @@ var AgoraRtcClientImpl = exports.AgoraRtcClientImpl = /*#__PURE__*/function (_Ag
|
|
|
301
305
|
key: "_handleAudioDeviceChanged",
|
|
302
306
|
value: function () {
|
|
303
307
|
var _handleAudioDeviceChanged2 = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee3(deviceId, deviceType, deviceState) {
|
|
304
|
-
var audioPlaybackDevices, oldSpeakerList, newSpeakerList, _diffMap, addedList, removedList, deviceInfoList, _deviceInfoList
|
|
308
|
+
var audioPlaybackDevices, oldSpeakerList, newSpeakerList, _diffMap, addedList, removedList, deviceInfoList, _deviceInfoList;
|
|
305
309
|
return _regenerator["default"].wrap(function (_context3) {
|
|
306
310
|
while (1) switch (_context3.prev = _context3.next) {
|
|
307
311
|
case 0:
|
|
308
|
-
if (
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
};
|
|
322
|
-
newSpeakerList.set(device.deviceId, deviceInfo);
|
|
323
|
-
}
|
|
324
|
-
});
|
|
325
|
-
_diffMap = (0, _utils.diffMap)(oldSpeakerList, newSpeakerList), addedList = _diffMap.addedList, removedList = _diffMap.removedList;
|
|
326
|
-
if (addedList.length > 0) {
|
|
327
|
-
deviceInfoList = addedList.map(function (deviceId) {
|
|
328
|
-
var _newSpeakerList$get;
|
|
329
|
-
return {
|
|
330
|
-
deviceId: deviceId,
|
|
331
|
-
deviceName: ((_newSpeakerList$get = newSpeakerList.get(deviceId)) === null || _newSpeakerList$get === void 0 ? void 0 : _newSpeakerList$get.deviceName) || ''
|
|
332
|
-
};
|
|
333
|
-
});
|
|
334
|
-
this.rtcClientObservable.notifyObservers('onSpeakerListAdded', deviceInfoList);
|
|
335
|
-
}
|
|
336
|
-
if (removedList.length > 0) {
|
|
337
|
-
_deviceInfoList = removedList.map(function (deviceId) {
|
|
338
|
-
var _oldSpeakerList$get;
|
|
339
|
-
return {
|
|
340
|
-
deviceId: deviceId,
|
|
341
|
-
deviceName: ((_oldSpeakerList$get = oldSpeakerList.get(deviceId)) === null || _oldSpeakerList$get === void 0 ? void 0 : _oldSpeakerList$get.deviceName) || ''
|
|
342
|
-
};
|
|
312
|
+
if (deviceType === 0 /* playback devices */) {
|
|
313
|
+
audioPlaybackDevices = this._rtcEngine.getAudioDeviceManager().enumeratePlaybackDevices();
|
|
314
|
+
oldSpeakerList = this._speakerList;
|
|
315
|
+
newSpeakerList = new Map();
|
|
316
|
+
this._speakerList = newSpeakerList;
|
|
317
|
+
audioPlaybackDevices.forEach(function (device) {
|
|
318
|
+
if (device.deviceId && device.deviceName) {
|
|
319
|
+
var deviceInfo = {
|
|
320
|
+
deviceId: device.deviceId,
|
|
321
|
+
deviceName: device.deviceName
|
|
322
|
+
};
|
|
323
|
+
newSpeakerList.set(device.deviceId, deviceInfo);
|
|
324
|
+
}
|
|
343
325
|
});
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
326
|
+
_diffMap = (0, _utils.diffMap)(oldSpeakerList, newSpeakerList), addedList = _diffMap.addedList, removedList = _diffMap.removedList;
|
|
327
|
+
if (addedList.length > 0) {
|
|
328
|
+
deviceInfoList = addedList.map(function (deviceId) {
|
|
329
|
+
var _newSpeakerList$get;
|
|
330
|
+
return {
|
|
331
|
+
deviceId: deviceId,
|
|
332
|
+
deviceName: ((_newSpeakerList$get = newSpeakerList.get(deviceId)) === null || _newSpeakerList$get === void 0 ? void 0 : _newSpeakerList$get.deviceName) || ''
|
|
333
|
+
};
|
|
334
|
+
});
|
|
335
|
+
this.rtcClientObservable.notifyObservers('onSpeakerListAdded', deviceInfoList);
|
|
336
|
+
}
|
|
337
|
+
if (removedList.length > 0) {
|
|
338
|
+
_deviceInfoList = removedList.map(function (deviceId) {
|
|
339
|
+
var _oldSpeakerList$get;
|
|
340
|
+
return {
|
|
341
|
+
deviceId: deviceId,
|
|
342
|
+
deviceName: ((_oldSpeakerList$get = oldSpeakerList.get(deviceId)) === null || _oldSpeakerList$get === void 0 ? void 0 : _oldSpeakerList$get.deviceName) || ''
|
|
343
|
+
};
|
|
344
|
+
});
|
|
345
|
+
this.rtcClientObservable.notifyObservers('onSpeakerListRemoved', _deviceInfoList);
|
|
346
|
+
}
|
|
347
|
+
} else {
|
|
348
|
+
this.logger.debug("audio device changed, deviceType: ".concat(deviceType, ","));
|
|
349
349
|
}
|
|
350
|
-
_context3.next = 1;
|
|
351
|
-
return this.getSystemSelectedSpeaker();
|
|
352
350
|
case 1:
|
|
353
|
-
deviceInfo = _context3.sent;
|
|
354
|
-
if (!deviceInfo) {
|
|
355
|
-
_context3.next = 2;
|
|
356
|
-
break;
|
|
357
|
-
}
|
|
358
|
-
if (this._systemSelectedSpeakerDeviceId !== deviceInfo.deviceId) {
|
|
359
|
-
this.rtcClientObservable.notifyObservers('onSystemSelectedSpeakerChanged', {
|
|
360
|
-
deviceId: deviceInfo.deviceId,
|
|
361
|
-
deviceName: deviceInfo.deviceName
|
|
362
|
-
});
|
|
363
|
-
this._systemSelectedSpeakerDeviceId = deviceInfo.deviceId;
|
|
364
|
-
}
|
|
365
|
-
_context3.next = 3;
|
|
366
|
-
break;
|
|
367
|
-
case 2:
|
|
368
|
-
throw new Error('deviceInfo is empty, no speaker device selected');
|
|
369
|
-
case 3:
|
|
370
|
-
_context3.next = 5;
|
|
371
|
-
break;
|
|
372
|
-
case 4:
|
|
373
|
-
this.logger.debug("audio device changed, deviceType: ".concat(deviceType, ","));
|
|
374
|
-
case 5:
|
|
375
351
|
case "end":
|
|
376
352
|
return _context3.stop();
|
|
377
353
|
}
|
|
@@ -444,6 +420,7 @@ var AgoraRtcClientImpl = exports.AgoraRtcClientImpl = /*#__PURE__*/function (_Ag
|
|
|
444
420
|
}, {
|
|
445
421
|
key: "release",
|
|
446
422
|
value: function release() {
|
|
423
|
+
var _this$_speakerTask;
|
|
447
424
|
this._rtcEngine.removeListener('onError', this._handleRtcError);
|
|
448
425
|
this._rtcEngine.removeListener('onAudioDeviceVolumeChanged', this._handleAudioDeviceVolumeChanged);
|
|
449
426
|
this._rtcEngine.removeListener('onAudioVolumeIndication', this._handleVolumeIndication);
|
|
@@ -451,6 +428,9 @@ var AgoraRtcClientImpl = exports.AgoraRtcClientImpl = /*#__PURE__*/function (_Ag
|
|
|
451
428
|
this._rtcEngine.removeListener('onAudioDeviceStateChanged', this._handleAudioDeviceChanged);
|
|
452
429
|
this.sourceManager.release();
|
|
453
430
|
this._rtcEngine.release();
|
|
431
|
+
this._systemSelectedSpeakerDeviceId = DEFAULT_SPEAKER_DEVICE_ID;
|
|
432
|
+
(_this$_speakerTask = this._speakerTask) === null || _this$_speakerTask === void 0 || _this$_speakerTask.stop();
|
|
433
|
+
this._speakerTask = undefined;
|
|
454
434
|
}
|
|
455
435
|
}, {
|
|
456
436
|
key: "startPlayTestAudio",
|
|
@@ -499,11 +479,7 @@ var AgoraRtcClientImpl = exports.AgoraRtcClientImpl = /*#__PURE__*/function (_Ag
|
|
|
499
479
|
}, {
|
|
500
480
|
key: "getSystemSelectedSpeaker",
|
|
501
481
|
value: function getSystemSelectedSpeaker() {
|
|
502
|
-
|
|
503
|
-
return Promise.resolve(device.deviceId && device.deviceName ? {
|
|
504
|
-
deviceId: device.deviceId,
|
|
505
|
-
deviceName: device.deviceName
|
|
506
|
-
} : undefined);
|
|
482
|
+
return this._getSystemSelectedSpeaker();
|
|
507
483
|
}
|
|
508
484
|
}, {
|
|
509
485
|
key: "setAccessPoint",
|
|
@@ -650,8 +626,16 @@ var AgoraRtcClientImpl = exports.AgoraRtcClientImpl = /*#__PURE__*/function (_Ag
|
|
|
650
626
|
}, {
|
|
651
627
|
key: "observeSystemSelectedSpeakerChanged",
|
|
652
628
|
value: function observeSystemSelectedSpeakerChanged(enable) {
|
|
653
|
-
|
|
654
|
-
|
|
629
|
+
if (enable) {
|
|
630
|
+
if (!this._speakerTask) {
|
|
631
|
+
this._speakerTask = this._createSystemSelectedDevicePolling();
|
|
632
|
+
}
|
|
633
|
+
if (this._speakerTask.isStopped) {
|
|
634
|
+
this._speakerTask.start();
|
|
635
|
+
}
|
|
636
|
+
} else {
|
|
637
|
+
var _this$_speakerTask2;
|
|
638
|
+
(_this$_speakerTask2 = this._speakerTask) === null || _this$_speakerTask2 === void 0 || _this$_speakerTask2.stop();
|
|
655
639
|
this._systemSelectedSpeakerDeviceId = DEFAULT_SPEAKER_DEVICE_ID;
|
|
656
640
|
}
|
|
657
641
|
return _constant.AgoraRtcErrorCode.SUCCESS;
|
|
@@ -724,6 +708,87 @@ var AgoraRtcClientImpl = exports.AgoraRtcClientImpl = /*#__PURE__*/function (_Ag
|
|
|
724
708
|
value: function _stripPort(url) {
|
|
725
709
|
return url.replace(/:\d+/, '');
|
|
726
710
|
}
|
|
711
|
+
}, {
|
|
712
|
+
key: "_createSystemSelectedDevicePolling",
|
|
713
|
+
value: function _createSystemSelectedDevicePolling() {
|
|
714
|
+
var _this2 = this;
|
|
715
|
+
var createExecuteTask = /*#__PURE__*/function () {
|
|
716
|
+
var _ref5 = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee6() {
|
|
717
|
+
var currentUniqueDeviceId, oldUniqueDeviceId, deviceInfo;
|
|
718
|
+
return _regenerator["default"].wrap(function (_context6) {
|
|
719
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
720
|
+
case 0:
|
|
721
|
+
_context6.next = 1;
|
|
722
|
+
return _this2._getSystemSelectedUniqueDeviceId();
|
|
723
|
+
case 1:
|
|
724
|
+
currentUniqueDeviceId = _context6.sent;
|
|
725
|
+
oldUniqueDeviceId = _this2._systemSelectedSpeakerDeviceId;
|
|
726
|
+
if (currentUniqueDeviceId) {
|
|
727
|
+
if (currentUniqueDeviceId !== oldUniqueDeviceId) {
|
|
728
|
+
deviceInfo = {
|
|
729
|
+
deviceId: currentUniqueDeviceId.split('-')[0],
|
|
730
|
+
deviceName: currentUniqueDeviceId.split('-')[1]
|
|
731
|
+
};
|
|
732
|
+
_this2.rtcClientObservable.notifyObservers('onSystemSelectedSpeakerChanged', deviceInfo);
|
|
733
|
+
_this2._systemSelectedSpeakerDeviceId = currentUniqueDeviceId;
|
|
734
|
+
}
|
|
735
|
+
} else {
|
|
736
|
+
_this2.logger.error('deviceInfo is empty, no device selected');
|
|
737
|
+
}
|
|
738
|
+
case 2:
|
|
739
|
+
case "end":
|
|
740
|
+
return _context6.stop();
|
|
741
|
+
}
|
|
742
|
+
}, _callee6);
|
|
743
|
+
}));
|
|
744
|
+
return function createExecuteTask() {
|
|
745
|
+
return _ref5.apply(this, arguments);
|
|
746
|
+
};
|
|
747
|
+
}();
|
|
748
|
+
return _schedule.AgoraScheduler.shared.addPollingTask(createExecuteTask, this._taskInterval, true, function () {
|
|
749
|
+
return _schedule.ActionWhenTaskFail.CONTINUE;
|
|
750
|
+
});
|
|
751
|
+
}
|
|
752
|
+
}, {
|
|
753
|
+
key: "_getSystemSelectedUniqueDeviceId",
|
|
754
|
+
value: function () {
|
|
755
|
+
var _getSystemSelectedUniqueDeviceId2 = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee7() {
|
|
756
|
+
var deviceInfo;
|
|
757
|
+
return _regenerator["default"].wrap(function (_context7) {
|
|
758
|
+
while (1) switch (_context7.prev = _context7.next) {
|
|
759
|
+
case 0:
|
|
760
|
+
_context7.next = 1;
|
|
761
|
+
return this._getSystemSelectedSpeaker();
|
|
762
|
+
case 1:
|
|
763
|
+
deviceInfo = _context7.sent;
|
|
764
|
+
if (!deviceInfo) {
|
|
765
|
+
_context7.next = 2;
|
|
766
|
+
break;
|
|
767
|
+
}
|
|
768
|
+
return _context7.abrupt("return", "".concat(deviceInfo.deviceId, "-").concat(deviceInfo.deviceName));
|
|
769
|
+
case 2:
|
|
770
|
+
return _context7.abrupt("return", undefined);
|
|
771
|
+
case 3:
|
|
772
|
+
case "end":
|
|
773
|
+
return _context7.stop();
|
|
774
|
+
}
|
|
775
|
+
}, _callee7, this);
|
|
776
|
+
}));
|
|
777
|
+
function _getSystemSelectedUniqueDeviceId() {
|
|
778
|
+
return _getSystemSelectedUniqueDeviceId2.apply(this, arguments);
|
|
779
|
+
}
|
|
780
|
+
return _getSystemSelectedUniqueDeviceId;
|
|
781
|
+
}()
|
|
782
|
+
}, {
|
|
783
|
+
key: "_getSystemSelectedSpeaker",
|
|
784
|
+
value: function _getSystemSelectedSpeaker() {
|
|
785
|
+
var device = this._rtcEngine.getAudioDeviceManager().getPlaybackDefaultDevice();
|
|
786
|
+
var deviceInfo = device.deviceId && device.deviceName ? {
|
|
787
|
+
deviceId: device.deviceId,
|
|
788
|
+
deviceName: device.deviceName
|
|
789
|
+
} : undefined;
|
|
790
|
+
return Promise.resolve(deviceInfo);
|
|
791
|
+
}
|
|
727
792
|
}]);
|
|
728
793
|
}(_rtc.AgoraRtcClient);
|
|
729
794
|
_AgoraRtcClientImpl = AgoraRtcClientImpl;
|
|
@@ -46,7 +46,10 @@ export declare class AgoraRtcSourceManagerImpl extends AgoraRtcSourceManager {
|
|
|
46
46
|
adjustMicrophoneVolume(deviceId: string, volume: number): number;
|
|
47
47
|
getCameraList(): Promise<AgoraRtcDeviceInfo[]>;
|
|
48
48
|
getMicrophoneList(): Promise<AgoraRtcDeviceInfo[]>;
|
|
49
|
-
getSystemSelectedMicrophone(): Promise<
|
|
49
|
+
getSystemSelectedMicrophone(): Promise<{
|
|
50
|
+
deviceId: string;
|
|
51
|
+
deviceName: string;
|
|
52
|
+
} | undefined>;
|
|
50
53
|
getSystemSelectedSpeaker(): AgoraRtcDeviceInfo;
|
|
51
54
|
getWindowList(thumbSize?: Size, iconSize?: Size): Promise<AgoraRtcWindowInfo[]>;
|
|
52
55
|
getDisplayList(thumbSize?: Size, iconSize?: Size): Promise<AgoraRtcDisplayInfo[]>;
|
|
@@ -68,4 +71,7 @@ export declare class AgoraRtcSourceManagerImpl extends AgoraRtcSourceManager {
|
|
|
68
71
|
private _bindDeviceIdToSourceType;
|
|
69
72
|
private _unbindDeviceIdToSourceType;
|
|
70
73
|
private _handleVolumeIndicatorUpdated;
|
|
74
|
+
private _createSystemSelectedDevicePolling;
|
|
75
|
+
private _getSystemSelectedUniqueDeviceId;
|
|
76
|
+
private _getSystemSelectedMicrophone;
|
|
71
77
|
}
|
|
@@ -119,6 +119,8 @@ var _loopbackMixer = require("./loopback-mixer");
|
|
|
119
119
|
var _sourceManager = require("../../../core/rtc/source-manager");
|
|
120
120
|
var _logger = require("../../../core/utilities/logger");
|
|
121
121
|
var _constant = require("../../../constant");
|
|
122
|
+
var _schedule = require("agora-foundation/lib/schedule");
|
|
123
|
+
var _scheduler = require("agora-foundation/lib/schedule/scheduler");
|
|
122
124
|
var _AgoraRtcSourceManagerImpl;
|
|
123
125
|
var _initProto;
|
|
124
126
|
function _callSuper(t, o, e) { return o = (0, _getPrototypeOf2["default"])(o), (0, _possibleConstructorReturn2["default"])(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], (0, _getPrototypeOf2["default"])(t).constructor) : o.apply(t, e)); }
|
|
@@ -155,6 +157,8 @@ var AgoraRtcSourceManagerImpl = exports.AgoraRtcSourceManagerImpl = /*#__PURE__*
|
|
|
155
157
|
(0, _defineProperty2["default"])(_this, "_microphoneList", new Map());
|
|
156
158
|
(0, _defineProperty2["default"])(_this, "_systemSelectedMicrophoneDeviceId", DEFAULT_MICROPHONE_DEVICE_ID);
|
|
157
159
|
(0, _defineProperty2["default"])(_this, "_systemMicrophoneChangeObservationEnabled", true);
|
|
160
|
+
// @internal
|
|
161
|
+
(0, _defineProperty2["default"])(_this, "_taskInterval", _scheduler.Duration.second(1));
|
|
158
162
|
_this._rtcEngine = _rtcEngine;
|
|
159
163
|
_this._config = _config;
|
|
160
164
|
_this._handleVideoDeviceChanged = _this._handleVideoDeviceChanged.bind(_this);
|
|
@@ -171,7 +175,7 @@ var AgoraRtcSourceManagerImpl = exports.AgoraRtcSourceManagerImpl = /*#__PURE__*
|
|
|
171
175
|
_rtcEngine.addListener('onAudioVolumeIndication', _this._handleVolumeIndicatorUpdated);
|
|
172
176
|
_this._loopbackAudioMixer = new _loopbackMixer.AgoraRtcLoopbackAudioMixer(_this._rtcEngine);
|
|
173
177
|
_rtcEngine.addListener('onLocalAudioStateChanged', _this._handleLocalAudioStateChanged);
|
|
174
|
-
_this.
|
|
178
|
+
_this._getSystemSelectedMicrophone().then(function (deviceInfo) {
|
|
175
179
|
if (deviceInfo) {
|
|
176
180
|
_this._systemSelectedMicrophoneDeviceId = deviceInfo.deviceId;
|
|
177
181
|
}
|
|
@@ -182,6 +186,7 @@ var AgoraRtcSourceManagerImpl = exports.AgoraRtcSourceManagerImpl = /*#__PURE__*
|
|
|
182
186
|
return (0, _createClass2["default"])(AgoraRtcSourceManagerImpl, [{
|
|
183
187
|
key: "release",
|
|
184
188
|
value: function release() {
|
|
189
|
+
var _this$_microphoneTask;
|
|
185
190
|
this._rtcEngine.removeListener('onVideoDeviceStateChanged', this._handleVideoDeviceChanged);
|
|
186
191
|
this._rtcEngine.removeListener('onAudioDeviceStateChanged', this._handleAudioDeviceChanged);
|
|
187
192
|
this._rtcEngine.removeListener('onLocalVideoStateChanged', this._handleLocalVideoStateChanged);
|
|
@@ -189,6 +194,8 @@ var AgoraRtcSourceManagerImpl = exports.AgoraRtcSourceManagerImpl = /*#__PURE__*
|
|
|
189
194
|
this._rtcEngine.removeListener('onAudioVolumeIndication', this._handleVolumeIndicatorUpdated);
|
|
190
195
|
this._rtcEngine.removeListener('onLocalAudioStateChanged', this._handleLocalAudioStateChanged);
|
|
191
196
|
this._systemSelectedMicrophoneDeviceId = DEFAULT_MICROPHONE_DEVICE_ID;
|
|
197
|
+
(_this$_microphoneTask = this._microphoneTask) === null || _this$_microphoneTask === void 0 || _this$_microphoneTask.stop();
|
|
198
|
+
this._microphoneTask = undefined;
|
|
192
199
|
}
|
|
193
200
|
}, {
|
|
194
201
|
key: "getLoopbackDeviceId",
|
|
@@ -497,12 +504,7 @@ var AgoraRtcSourceManagerImpl = exports.AgoraRtcSourceManagerImpl = /*#__PURE__*
|
|
|
497
504
|
}, {
|
|
498
505
|
key: "getSystemSelectedMicrophone",
|
|
499
506
|
value: function getSystemSelectedMicrophone() {
|
|
500
|
-
|
|
501
|
-
var deviceInfo = {
|
|
502
|
-
deviceId: device.deviceId,
|
|
503
|
-
deviceName: device.deviceName
|
|
504
|
-
};
|
|
505
|
-
return Promise.resolve(deviceInfo);
|
|
507
|
+
return this._getSystemSelectedMicrophone();
|
|
506
508
|
}
|
|
507
509
|
}, {
|
|
508
510
|
key: "getSystemSelectedSpeaker",
|
|
@@ -614,8 +616,16 @@ var AgoraRtcSourceManagerImpl = exports.AgoraRtcSourceManagerImpl = /*#__PURE__*
|
|
|
614
616
|
}, {
|
|
615
617
|
key: "observeSystemSelectedMicrophoneChanged",
|
|
616
618
|
value: function observeSystemSelectedMicrophoneChanged(enable) {
|
|
617
|
-
|
|
618
|
-
|
|
619
|
+
if (enable) {
|
|
620
|
+
if (!this._microphoneTask) {
|
|
621
|
+
this._microphoneTask = this._createSystemSelectedDevicePolling();
|
|
622
|
+
}
|
|
623
|
+
if (this._microphoneTask.isStopped) {
|
|
624
|
+
this._microphoneTask.start();
|
|
625
|
+
}
|
|
626
|
+
} else {
|
|
627
|
+
var _this$_microphoneTask2;
|
|
628
|
+
(_this$_microphoneTask2 = this._microphoneTask) === null || _this$_microphoneTask2 === void 0 || _this$_microphoneTask2.stop();
|
|
619
629
|
this._systemSelectedMicrophoneDeviceId = DEFAULT_MICROPHONE_DEVICE_ID;
|
|
620
630
|
}
|
|
621
631
|
return _constant.AgoraRtcErrorCode.SUCCESS;
|
|
@@ -705,77 +715,49 @@ var AgoraRtcSourceManagerImpl = exports.AgoraRtcSourceManagerImpl = /*#__PURE__*
|
|
|
705
715
|
key: "_handleAudioDeviceChanged",
|
|
706
716
|
value: function () {
|
|
707
717
|
var _handleAudioDeviceChanged2 = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee(deviceId, deviceType, deviceState) {
|
|
708
|
-
var audioRecordingDevices, oldMicList, newMicList, _diffMap2, addedList, removedList, deviceInfoList, _deviceInfoList2
|
|
718
|
+
var audioRecordingDevices, oldMicList, newMicList, _diffMap2, addedList, removedList, deviceInfoList, _deviceInfoList2;
|
|
709
719
|
return _regenerator["default"].wrap(function (_context) {
|
|
710
720
|
while (1) switch (_context.prev = _context.next) {
|
|
711
721
|
case 0:
|
|
712
|
-
if (
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
};
|
|
726
|
-
newMicList.set(device.deviceId, deviceInfo);
|
|
727
|
-
}
|
|
728
|
-
});
|
|
729
|
-
_diffMap2 = (0, _utils.diffMap)(oldMicList, newMicList), addedList = _diffMap2.addedList, removedList = _diffMap2.removedList;
|
|
730
|
-
if (addedList.length > 0) {
|
|
731
|
-
deviceInfoList = addedList.map(function (deviceId) {
|
|
732
|
-
var _newMicList$get;
|
|
733
|
-
return {
|
|
734
|
-
deviceId: deviceId,
|
|
735
|
-
deviceName: ((_newMicList$get = newMicList.get(deviceId)) === null || _newMicList$get === void 0 ? void 0 : _newMicList$get.deviceName) || ''
|
|
736
|
-
};
|
|
722
|
+
if (deviceType === 1 /* recording devices */) {
|
|
723
|
+
audioRecordingDevices = this._rtcEngine.getAudioDeviceManager().enumerateRecordingDevices();
|
|
724
|
+
oldMicList = this._microphoneList;
|
|
725
|
+
newMicList = new Map();
|
|
726
|
+
this._microphoneList = newMicList;
|
|
727
|
+
audioRecordingDevices.forEach(function (device) {
|
|
728
|
+
if (device.deviceId && device.deviceName) {
|
|
729
|
+
var deviceInfo = {
|
|
730
|
+
deviceId: device.deviceId,
|
|
731
|
+
deviceName: device.deviceName
|
|
732
|
+
};
|
|
733
|
+
newMicList.set(device.deviceId, deviceInfo);
|
|
734
|
+
}
|
|
737
735
|
});
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
};
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
736
|
+
_diffMap2 = (0, _utils.diffMap)(oldMicList, newMicList), addedList = _diffMap2.addedList, removedList = _diffMap2.removedList;
|
|
737
|
+
if (addedList.length > 0) {
|
|
738
|
+
deviceInfoList = addedList.map(function (deviceId) {
|
|
739
|
+
var _newMicList$get;
|
|
740
|
+
return {
|
|
741
|
+
deviceId: deviceId,
|
|
742
|
+
deviceName: ((_newMicList$get = newMicList.get(deviceId)) === null || _newMicList$get === void 0 ? void 0 : _newMicList$get.deviceName) || ''
|
|
743
|
+
};
|
|
744
|
+
});
|
|
745
|
+
this.observable.notifyObservers('onMicrophoneListAdded', deviceInfoList);
|
|
746
|
+
}
|
|
747
|
+
if (removedList.length > 0) {
|
|
748
|
+
_deviceInfoList2 = removedList.map(function (deviceId) {
|
|
749
|
+
var _oldMicList$get;
|
|
750
|
+
return {
|
|
751
|
+
deviceId: deviceId,
|
|
752
|
+
deviceName: ((_oldMicList$get = oldMicList.get(deviceId)) === null || _oldMicList$get === void 0 ? void 0 : _oldMicList$get.deviceName) || ''
|
|
753
|
+
};
|
|
754
|
+
});
|
|
755
|
+
this.observable.notifyObservers('onMicrophoneListRemoved', _deviceInfoList2);
|
|
756
|
+
}
|
|
757
|
+
} else {
|
|
758
|
+
this.logger.debug("audio device changed, deviceType: ".concat(deviceType, ","));
|
|
753
759
|
}
|
|
754
|
-
_context.next = 1;
|
|
755
|
-
return this.getSystemSelectedMicrophone();
|
|
756
760
|
case 1:
|
|
757
|
-
deviceInfo = _context.sent;
|
|
758
|
-
if (!deviceInfo) {
|
|
759
|
-
_context.next = 2;
|
|
760
|
-
break;
|
|
761
|
-
}
|
|
762
|
-
if (deviceInfo.deviceId !== this._systemSelectedMicrophoneDeviceId) {
|
|
763
|
-
this.observable.notifyObservers('onSystemSelectedMicrophoneChanged', {
|
|
764
|
-
deviceId: deviceInfo.deviceId,
|
|
765
|
-
deviceName: deviceInfo.deviceName
|
|
766
|
-
});
|
|
767
|
-
this._systemSelectedMicrophoneDeviceId = deviceInfo.deviceId;
|
|
768
|
-
}
|
|
769
|
-
_context.next = 3;
|
|
770
|
-
break;
|
|
771
|
-
case 2:
|
|
772
|
-
throw new Error('deviceInfo is empty, no microphone device selected');
|
|
773
|
-
case 3:
|
|
774
|
-
_context.next = 5;
|
|
775
|
-
break;
|
|
776
|
-
case 4:
|
|
777
|
-
this.logger.debug("audio device changed, deviceType: ".concat(deviceType, ","));
|
|
778
|
-
case 5:
|
|
779
761
|
case "end":
|
|
780
762
|
return _context.stop();
|
|
781
763
|
}
|
|
@@ -892,13 +874,31 @@ var AgoraRtcSourceManagerImpl = exports.AgoraRtcSourceManagerImpl = /*#__PURE__*
|
|
|
892
874
|
res = this._rtcEngine.stopCameraCapture((0, _utils.convertSourceIndexToSourceType)(sourceIndex));
|
|
893
875
|
return res;
|
|
894
876
|
}
|
|
877
|
+
// @bound
|
|
878
|
+
// private _startMicrophoneCapture(deviceId: string) {
|
|
879
|
+
// this._currentMicrophoneDeviceId = deviceId;
|
|
880
|
+
// this._rtcEngine.getAudioDeviceManager().setRecordingDevice(deviceId);
|
|
881
|
+
// const status = this.microphoneDeviceStatusMapping.get(deviceId) || 0;
|
|
882
|
+
|
|
883
|
+
// if (status > 0) {
|
|
884
|
+
// return 0;
|
|
885
|
+
// } else {
|
|
886
|
+
// this.logger.info('startRecordingDeviceTest');
|
|
887
|
+
// return this._rtcEngine
|
|
888
|
+
// .getAudioDeviceManager()
|
|
889
|
+
// .startRecordingDeviceTest(VOLUME_INDICATION_INTERVAL);
|
|
890
|
+
// }
|
|
891
|
+
// }
|
|
895
892
|
}, {
|
|
896
893
|
key: "_startMicrophoneCapture",
|
|
897
894
|
value: function _startMicrophoneCapture(deviceId) {
|
|
898
895
|
this._currentMicrophoneDeviceId = deviceId;
|
|
899
896
|
this._rtcEngine.getAudioDeviceManager().setRecordingDevice(deviceId);
|
|
900
897
|
var status = this.microphoneDeviceStatusMapping.get(deviceId) || 0;
|
|
901
|
-
|
|
898
|
+
|
|
899
|
+
// 检查设备是否已经在进行录音测试
|
|
900
|
+
var isAlreadyTesting = (status & _type2.AgoraElectronRtcDeviceStatusFlag.TESTING) !== 0;
|
|
901
|
+
if (isAlreadyTesting) {
|
|
902
902
|
return 0;
|
|
903
903
|
} else {
|
|
904
904
|
return this._rtcEngine.getAudioDeviceManager().startRecordingDeviceTest(_utils.VOLUME_INDICATION_INTERVAL);
|
|
@@ -964,10 +964,91 @@ var AgoraRtcSourceManagerImpl = exports.AgoraRtcSourceManagerImpl = /*#__PURE__*
|
|
|
964
964
|
}
|
|
965
965
|
}
|
|
966
966
|
}
|
|
967
|
+
}, {
|
|
968
|
+
key: "_createSystemSelectedDevicePolling",
|
|
969
|
+
value: function _createSystemSelectedDevicePolling() {
|
|
970
|
+
var _this5 = this;
|
|
971
|
+
var createExecuteTask = /*#__PURE__*/function () {
|
|
972
|
+
var _ref0 = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee2() {
|
|
973
|
+
var currentUniqueDeviceId, oldUniqueDeviceId, deviceInfo;
|
|
974
|
+
return _regenerator["default"].wrap(function (_context2) {
|
|
975
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
976
|
+
case 0:
|
|
977
|
+
_context2.next = 1;
|
|
978
|
+
return _this5._getSystemSelectedUniqueDeviceId();
|
|
979
|
+
case 1:
|
|
980
|
+
currentUniqueDeviceId = _context2.sent;
|
|
981
|
+
oldUniqueDeviceId = _this5._systemSelectedMicrophoneDeviceId;
|
|
982
|
+
if (currentUniqueDeviceId) {
|
|
983
|
+
if (currentUniqueDeviceId !== oldUniqueDeviceId) {
|
|
984
|
+
deviceInfo = {
|
|
985
|
+
deviceId: currentUniqueDeviceId.split('-')[0],
|
|
986
|
+
deviceName: currentUniqueDeviceId.split('-')[1]
|
|
987
|
+
};
|
|
988
|
+
_this5.observable.notifyObservers('onSystemSelectedMicrophoneChanged', deviceInfo);
|
|
989
|
+
_this5._systemSelectedMicrophoneDeviceId = currentUniqueDeviceId;
|
|
990
|
+
}
|
|
991
|
+
} else {
|
|
992
|
+
_this5.logger.error('deviceInfo is empty, no device selected');
|
|
993
|
+
}
|
|
994
|
+
case 2:
|
|
995
|
+
case "end":
|
|
996
|
+
return _context2.stop();
|
|
997
|
+
}
|
|
998
|
+
}, _callee2);
|
|
999
|
+
}));
|
|
1000
|
+
return function createExecuteTask() {
|
|
1001
|
+
return _ref0.apply(this, arguments);
|
|
1002
|
+
};
|
|
1003
|
+
}();
|
|
1004
|
+
return _schedule.AgoraScheduler.shared.addPollingTask(createExecuteTask, this._taskInterval, true, function () {
|
|
1005
|
+
return _schedule.ActionWhenTaskFail.CONTINUE;
|
|
1006
|
+
});
|
|
1007
|
+
}
|
|
1008
|
+
}, {
|
|
1009
|
+
key: "_getSystemSelectedUniqueDeviceId",
|
|
1010
|
+
value: function () {
|
|
1011
|
+
var _getSystemSelectedUniqueDeviceId2 = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee3() {
|
|
1012
|
+
var deviceInfo;
|
|
1013
|
+
return _regenerator["default"].wrap(function (_context3) {
|
|
1014
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
1015
|
+
case 0:
|
|
1016
|
+
_context3.next = 1;
|
|
1017
|
+
return this._getSystemSelectedMicrophone();
|
|
1018
|
+
case 1:
|
|
1019
|
+
deviceInfo = _context3.sent;
|
|
1020
|
+
if (!deviceInfo) {
|
|
1021
|
+
_context3.next = 2;
|
|
1022
|
+
break;
|
|
1023
|
+
}
|
|
1024
|
+
return _context3.abrupt("return", "".concat(deviceInfo.deviceId, "-").concat(deviceInfo.deviceName));
|
|
1025
|
+
case 2:
|
|
1026
|
+
return _context3.abrupt("return", undefined);
|
|
1027
|
+
case 3:
|
|
1028
|
+
case "end":
|
|
1029
|
+
return _context3.stop();
|
|
1030
|
+
}
|
|
1031
|
+
}, _callee3, this);
|
|
1032
|
+
}));
|
|
1033
|
+
function _getSystemSelectedUniqueDeviceId() {
|
|
1034
|
+
return _getSystemSelectedUniqueDeviceId2.apply(this, arguments);
|
|
1035
|
+
}
|
|
1036
|
+
return _getSystemSelectedUniqueDeviceId;
|
|
1037
|
+
}()
|
|
1038
|
+
}, {
|
|
1039
|
+
key: "_getSystemSelectedMicrophone",
|
|
1040
|
+
value: function _getSystemSelectedMicrophone() {
|
|
1041
|
+
var device = this._rtcEngine.getAudioDeviceManager().getRecordingDefaultDevice();
|
|
1042
|
+
var deviceInfo = device.deviceId && device.deviceName ? {
|
|
1043
|
+
deviceId: device.deviceId,
|
|
1044
|
+
deviceName: device.deviceName
|
|
1045
|
+
} : undefined;
|
|
1046
|
+
return Promise.resolve(deviceInfo);
|
|
1047
|
+
}
|
|
967
1048
|
}]);
|
|
968
1049
|
}(_sourceManager.AgoraRtcSourceManager);
|
|
969
1050
|
_AgoraRtcSourceManagerImpl = AgoraRtcSourceManagerImpl;
|
|
970
|
-
var _applyDecs$e = _applyDecs(_AgoraRtcSourceManagerImpl, [[_decorator.trace, 2, "setCameraCaptureParams"], [_decorator.trace, 2, "openCamera"], [_decorator.trace, 2, "closeCamera"], [_decorator.trace, 2, "startCameraTest"], [_decorator.trace, 2, "stopCameraTest"], [_decorator.trace, 2, "openMicrophone"], [_decorator.trace, 2, "closeMicrophone"], [_decorator.trace, 2, "startMicrophoneTest"], [_decorator.trace, 2, "stopMicrophoneTest"], [_decorator.trace, 2, "startScreenCaptureByDisplayId"], [_decorator.trace, 2, "startScreenCaptureByWindowId"], [_decorator.trace, 2, "stopScreenCapture"], [_decorator.trace, 2, "startLoopbackRecording"], [_decorator.trace, 2, "stopLoopbackRecording"], [_decorator.trace, 2, "adjustLoopbackVolume"], [_decorator.trace, 2, "adjustMicrophoneVolume"], [_decorator.trace, 2, "getWindowList"], [_decorator.trace, 2, "getDisplayList"], [_decorator.bound, 2, "setMicrophoneKeepRecording"], [_decorator.bound, 2, "_handleVideoSourceVideoStateChanged"], [_decorator.bound, 2, "_handleLocalAudioStateChanged"], [_decorator.bound, 2, "_handleVideoDeviceChanged"], [_decorator.bound, 2, "_handleAudioDeviceChanged"], [_decorator.bound, 2, "_handleLocalVideoStateChanged"], [_decorator.bound, 2, "_handleLocalAudioError"], [_decorator.bound, 2, "_initializeDeviceList"], [_decorator.bound, 2, "_pickCurrentWindowId"], [_decorator.bound, 2, "_startCameraCapture"], [_decorator.bound, 2, "_stopCameraCapture"], [_decorator.bound, 2, "
|
|
1051
|
+
var _applyDecs$e = _applyDecs(_AgoraRtcSourceManagerImpl, [[_decorator.trace, 2, "setCameraCaptureParams"], [_decorator.trace, 2, "openCamera"], [_decorator.trace, 2, "closeCamera"], [_decorator.trace, 2, "startCameraTest"], [_decorator.trace, 2, "stopCameraTest"], [_decorator.trace, 2, "openMicrophone"], [_decorator.trace, 2, "closeMicrophone"], [_decorator.trace, 2, "startMicrophoneTest"], [_decorator.trace, 2, "stopMicrophoneTest"], [_decorator.trace, 2, "startScreenCaptureByDisplayId"], [_decorator.trace, 2, "startScreenCaptureByWindowId"], [_decorator.trace, 2, "stopScreenCapture"], [_decorator.trace, 2, "startLoopbackRecording"], [_decorator.trace, 2, "stopLoopbackRecording"], [_decorator.trace, 2, "adjustLoopbackVolume"], [_decorator.trace, 2, "adjustMicrophoneVolume"], [_decorator.trace, 2, "getWindowList"], [_decorator.trace, 2, "getDisplayList"], [_decorator.bound, 2, "setMicrophoneKeepRecording"], [_decorator.bound, 2, "_handleVideoSourceVideoStateChanged"], [_decorator.bound, 2, "_handleLocalAudioStateChanged"], [_decorator.bound, 2, "_handleVideoDeviceChanged"], [_decorator.bound, 2, "_handleAudioDeviceChanged"], [_decorator.bound, 2, "_handleLocalVideoStateChanged"], [_decorator.bound, 2, "_handleLocalAudioError"], [_decorator.bound, 2, "_initializeDeviceList"], [_decorator.bound, 2, "_pickCurrentWindowId"], [_decorator.bound, 2, "_startCameraCapture"], [_decorator.bound, 2, "_stopCameraCapture"], [_decorator.bound, 2, "_stopMicrophoneCapture"], [_decorator.bound, 2, "_generateVideoSourceIndex"], [_decorator.bound, 2, "_bindDeviceIdToSourceType"], [_decorator.bound, 2, "_unbindDeviceIdToSourceType"], [_decorator.bound, 2, "_handleVolumeIndicatorUpdated"]], [], 0, void 0, _sourceManager.AgoraRtcSourceManager).e;
|
|
971
1052
|
var _applyDecs$e2 = (0, _slicedToArray2["default"])(_applyDecs$e, 1);
|
|
972
1053
|
_initProto = _applyDecs$e2[0];
|
|
973
1054
|
_applyDecs$e;
|
|
@@ -3,6 +3,8 @@
|
|
|
3
3
|
require("core-js/modules/es.symbol.js");
|
|
4
4
|
require("core-js/modules/es.symbol.description.js");
|
|
5
5
|
require("core-js/modules/es.symbol.to-primitive.js");
|
|
6
|
+
require("core-js/modules/es.error.cause.js");
|
|
7
|
+
require("core-js/modules/es.error.to-string.js");
|
|
6
8
|
require("core-js/modules/es.array.filter.js");
|
|
7
9
|
require("core-js/modules/es.array.is-array.js");
|
|
8
10
|
require("core-js/modules/es.array.push.js");
|
|
@@ -25,8 +27,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
25
27
|
});
|
|
26
28
|
exports.AgoraRtcWebAdapterImp = void 0;
|
|
27
29
|
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
28
|
-
require("core-js/modules/es.error.cause.js");
|
|
29
|
-
require("core-js/modules/es.error.to-string.js");
|
|
30
30
|
require("core-js/modules/es.array.concat.js");
|
|
31
31
|
require("core-js/modules/es.array.for-each.js");
|
|
32
32
|
require("core-js/modules/es.array.includes.js");
|
|
@@ -481,24 +481,20 @@ var AgoraRtcWebAdapterImp = exports.AgoraRtcWebAdapterImp = /*#__PURE__*/functio
|
|
|
481
481
|
case 1:
|
|
482
482
|
currentUniqueDeviceId = _context.sent;
|
|
483
483
|
oldUniqueDeviceId = _this4._systemSelectedUniqueDeviceId[type];
|
|
484
|
-
if (
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
}
|
|
494
|
-
|
|
495
|
-
_this4.
|
|
484
|
+
if (currentUniqueDeviceId) {
|
|
485
|
+
if (currentUniqueDeviceId !== oldUniqueDeviceId) {
|
|
486
|
+
observerKey = isSpeaker ? 'onSystemSelectedSpeakerChanged' : 'onSystemSelectedMicrophoneChanged';
|
|
487
|
+
deviceInfo = {
|
|
488
|
+
deviceId: currentUniqueDeviceId.split('-')[0],
|
|
489
|
+
deviceName: currentUniqueDeviceId.split('-')[1]
|
|
490
|
+
};
|
|
491
|
+
_this4.rtcClientObservable.notifyObservers(observerKey, deviceInfo);
|
|
492
|
+
_this4._systemSelectedUniqueDeviceId[type] = currentUniqueDeviceId;
|
|
493
|
+
}
|
|
494
|
+
} else {
|
|
495
|
+
_this4.logger.error('deviceInfo is empty, no device selected');
|
|
496
496
|
}
|
|
497
|
-
_context.next = 3;
|
|
498
|
-
break;
|
|
499
497
|
case 2:
|
|
500
|
-
throw new Error('deviceInfo is empty, no device selected');
|
|
501
|
-
case 3:
|
|
502
498
|
case "end":
|
|
503
499
|
return _context.stop();
|
|
504
500
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "agora-rte-sdk",
|
|
3
|
-
"version": "3.7.
|
|
3
|
+
"version": "3.7.2",
|
|
4
4
|
"description": "SDK for building interactive scenarios",
|
|
5
5
|
"author": "agora.io",
|
|
6
6
|
"license": "ISC",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"@types/sinon": "^17.0.2",
|
|
32
32
|
"@types/ua-parser-js": "^0.7.35",
|
|
33
33
|
"agora-token": "^2.0.3",
|
|
34
|
-
"agora-toolchain": "~3.7.
|
|
34
|
+
"agora-toolchain": "~3.7.2",
|
|
35
35
|
"babel-jest": "^29.7.0",
|
|
36
36
|
"core-js": "^3.33.3",
|
|
37
37
|
"dotenv": "^16.3.1",
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
"agora-extension-ai-denoiser": "^1.0.0",
|
|
53
53
|
"agora-extension-beauty-effect": "^1.0.1-beta",
|
|
54
54
|
"agora-extension-virtual-background": "^2.1.0",
|
|
55
|
-
"agora-foundation": "~3.7.
|
|
55
|
+
"agora-foundation": "~3.7.2",
|
|
56
56
|
"agora-rtc-sdk-ng": "4.23.3",
|
|
57
57
|
"agora-rtm": "2.2.2-2",
|
|
58
58
|
"await-to-js": "^3.0.0",
|