agora-rte-sdk 3.6.2 → 3.6.3
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/engine/ap-detector.d.ts +7 -1
- package/lib/core/engine/ap-detector.js +20 -7
- package/lib/core/engine/index.d.ts +3 -2
- package/lib/core/engine/index.js +31 -16
- package/lib/plugin/rtc/electron/channel.js +12 -12
- package/lib/plugin/rtc/electron/source-manager.js +19 -5
- package/lib/plugin/rtc/electron/subscriber.d.ts +1 -0
- package/lib/plugin/rtc/electron/subscriber.js +16 -4
- package/package.json +3 -3
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { AgoraRteError } from '../utilities/error';
|
|
2
|
+
export declare const DEFAULT_FETCH_URL_TIMEOUT = 300;
|
|
2
3
|
export interface AgoraRtcAccessPointConfig {
|
|
3
4
|
serverList: string[];
|
|
4
5
|
}
|
|
@@ -56,6 +57,10 @@ export interface AgoraRteApDetector {
|
|
|
56
57
|
* 获取可用IP列表
|
|
57
58
|
*/
|
|
58
59
|
getAvailableRtcAccessPointConfig(): AgoraRtcAccessPointConfig | null;
|
|
60
|
+
/**
|
|
61
|
+
* 设置config内的配置
|
|
62
|
+
*/
|
|
63
|
+
setConfig(detectTimeout: number, isRedetect: boolean, internalRtcConfig?: AgoraRtcAccessPointConfig, externalRtcConfig?: AgoraRtcAccessPointConfig): void;
|
|
59
64
|
/**
|
|
60
65
|
* 重新探测可用IP
|
|
61
66
|
*/
|
|
@@ -85,8 +90,9 @@ export declare class AgoraRteApDetectorImpl implements AgoraRteApDetector {
|
|
|
85
90
|
private _availableRtcAccessPointConfig;
|
|
86
91
|
private _startType;
|
|
87
92
|
get hasDetectingTask(): boolean;
|
|
88
|
-
|
|
93
|
+
private _finished;
|
|
89
94
|
constructor(internalRtcConfig: AgoraRtcAccessPointConfig, externalRtcConfig: AgoraRtcAccessPointConfig, detectTimeout?: number, isRedetect?: boolean);
|
|
95
|
+
setConfig(detectTimeout: number, isRedetect: boolean, internalRtcConfig?: AgoraRtcAccessPointConfig, externalRtcConfig?: AgoraRtcAccessPointConfig): void;
|
|
90
96
|
isDetecting(): boolean;
|
|
91
97
|
restart(): boolean;
|
|
92
98
|
start(): void;
|
|
@@ -42,7 +42,7 @@ var _typeof = require("@babel/runtime/helpers/typeof");
|
|
|
42
42
|
Object.defineProperty(exports, "__esModule", {
|
|
43
43
|
value: true
|
|
44
44
|
});
|
|
45
|
-
exports.transformUrlToRequestUrl = exports.isIP = exports.isDomainName = exports.AgoraRteApDetectorImpl = void 0;
|
|
45
|
+
exports.transformUrlToRequestUrl = exports.isIP = exports.isDomainName = exports.DEFAULT_FETCH_URL_TIMEOUT = exports.AgoraRteApDetectorImpl = void 0;
|
|
46
46
|
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
47
47
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
48
48
|
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
@@ -89,7 +89,7 @@ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e
|
|
|
89
89
|
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; }
|
|
90
90
|
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; }
|
|
91
91
|
// const NEED_DETECT_MAX_IP_COUNT = 5;
|
|
92
|
-
var DEFAULT_FETCH_URL_TIMEOUT = 300;
|
|
92
|
+
var DEFAULT_FETCH_URL_TIMEOUT = exports.DEFAULT_FETCH_URL_TIMEOUT = 300;
|
|
93
93
|
var ApStartType = /*#__PURE__*/function (ApStartType) {
|
|
94
94
|
ApStartType[ApStartType["start"] = 0] = "start";
|
|
95
95
|
ApStartType[ApStartType["resrart"] = 1] = "resrart";
|
|
@@ -143,7 +143,7 @@ var AgoraRteApDetectorImpl = exports.AgoraRteApDetectorImpl = /*#__PURE__*/funct
|
|
|
143
143
|
serverList: []
|
|
144
144
|
});
|
|
145
145
|
(0, _defineProperty2["default"])(this, "_startType", ApStartType.start);
|
|
146
|
-
(0, _defineProperty2["default"])(this, "
|
|
146
|
+
(0, _defineProperty2["default"])(this, "_finished", false);
|
|
147
147
|
this._apDetectTimeout = typeof detectTimeout === 'number' ? detectTimeout : DEFAULT_FETCH_URL_TIMEOUT;
|
|
148
148
|
this._init(internalRtcConfig, externalRtcConfig);
|
|
149
149
|
this._apDetectIsRedetect = typeof isRedetect === 'undefined' ? true : !!isRedetect;
|
|
@@ -153,6 +153,19 @@ var AgoraRteApDetectorImpl = exports.AgoraRteApDetectorImpl = /*#__PURE__*/funct
|
|
|
153
153
|
get: function get() {
|
|
154
154
|
return this._detectWorkMap.isDetecting;
|
|
155
155
|
}
|
|
156
|
+
}, {
|
|
157
|
+
key: "setConfig",
|
|
158
|
+
value: function setConfig(detectTimeout, isRedetect, internalRtcConfig, externalRtcConfig) {
|
|
159
|
+
this._apDetectTimeout = detectTimeout === 0 ? DEFAULT_FETCH_URL_TIMEOUT : detectTimeout;
|
|
160
|
+
this._apDetectIsRedetect = isRedetect;
|
|
161
|
+
if (internalRtcConfig) {
|
|
162
|
+
this._internalRtcConfig = internalRtcConfig;
|
|
163
|
+
}
|
|
164
|
+
if (externalRtcConfig) {
|
|
165
|
+
this._externalRtcConfig = externalRtcConfig;
|
|
166
|
+
}
|
|
167
|
+
this._finished = false;
|
|
168
|
+
}
|
|
156
169
|
}, {
|
|
157
170
|
key: "isDetecting",
|
|
158
171
|
value: function isDetecting() {
|
|
@@ -177,8 +190,8 @@ var AgoraRteApDetectorImpl = exports.AgoraRteApDetectorImpl = /*#__PURE__*/funct
|
|
|
177
190
|
_this$_externalRtcCon2,
|
|
178
191
|
_this = this;
|
|
179
192
|
this._startType = ApStartType.start;
|
|
180
|
-
if (this.
|
|
181
|
-
this.logger.warn("start function interrupted, finished: ".concat(this.
|
|
193
|
+
if (this._finished || this.hasDetectingTask) {
|
|
194
|
+
this.logger.warn("start function interrupted, finished: ".concat(this._finished, " , hasDetectingTask: ").concat(this.hasDetectingTask));
|
|
182
195
|
return;
|
|
183
196
|
}
|
|
184
197
|
var internalIpList = (_this$_internalRtcCon = (_this$_internalRtcCon2 = this._internalRtcConfig) === null || _this$_internalRtcCon2 === void 0 ? void 0 : _this$_internalRtcCon2.serverList) !== null && _this$_internalRtcCon !== void 0 ? _this$_internalRtcCon : [];
|
|
@@ -272,7 +285,7 @@ var AgoraRteApDetectorImpl = exports.AgoraRteApDetectorImpl = /*#__PURE__*/funct
|
|
|
272
285
|
}, {
|
|
273
286
|
key: "isFinished",
|
|
274
287
|
value: function isFinished() {
|
|
275
|
-
return this.
|
|
288
|
+
return this._finished;
|
|
276
289
|
}
|
|
277
290
|
}, {
|
|
278
291
|
key: "getAvailableRtcAccessPointConfig",
|
|
@@ -487,7 +500,7 @@ var AgoraRteApDetectorImpl = exports.AgoraRteApDetectorImpl = /*#__PURE__*/funct
|
|
|
487
500
|
}
|
|
488
501
|
}
|
|
489
502
|
this._detectWorkMap.isDetecting = false;
|
|
490
|
-
this.
|
|
503
|
+
this._finished = true;
|
|
491
504
|
this.logger.info('detection completed');
|
|
492
505
|
}
|
|
493
506
|
}, {
|
|
@@ -36,6 +36,7 @@ export declare class AgoraRteEngine {
|
|
|
36
36
|
private _handleTokenWillExpire;
|
|
37
37
|
private _handlePeerMessageReceived;
|
|
38
38
|
private _setupRteIpList;
|
|
39
|
-
private
|
|
40
|
-
private
|
|
39
|
+
private _updateApDetector;
|
|
40
|
+
private _validCfg;
|
|
41
|
+
private _createDefaultApDetector;
|
|
41
42
|
}
|
package/lib/core/engine/index.js
CHANGED
|
@@ -3,13 +3,11 @@
|
|
|
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.array.is-array.js");
|
|
7
6
|
require("core-js/modules/es.array.iterator.js");
|
|
8
7
|
require("core-js/modules/es.array.push.js");
|
|
9
8
|
require("core-js/modules/es.date.to-primitive.js");
|
|
10
9
|
require("core-js/modules/es.function.name.js");
|
|
11
10
|
require("core-js/modules/es.map.js");
|
|
12
|
-
require("core-js/modules/es.number.constructor.js");
|
|
13
11
|
require("core-js/modules/es.object.create.js");
|
|
14
12
|
require("core-js/modules/es.object.define-property.js");
|
|
15
13
|
require("core-js/modules/es.object.get-own-property-descriptor.js");
|
|
@@ -42,9 +40,12 @@ require("core-js/modules/es.error.cause.js");
|
|
|
42
40
|
require("core-js/modules/es.error.to-string.js");
|
|
43
41
|
require("core-js/modules/es.array.concat.js");
|
|
44
42
|
require("core-js/modules/es.array.for-each.js");
|
|
43
|
+
require("core-js/modules/es.array.is-array.js");
|
|
45
44
|
require("core-js/modules/es.date.to-json.js");
|
|
46
45
|
require("core-js/modules/es.function.bind.js");
|
|
47
46
|
require("core-js/modules/es.json.stringify.js");
|
|
47
|
+
require("core-js/modules/es.number.constructor.js");
|
|
48
|
+
require("core-js/modules/es.number.is-nan.js");
|
|
48
49
|
require("core-js/modules/es.object.keys.js");
|
|
49
50
|
require("core-js/modules/es.object.to-string.js");
|
|
50
51
|
require("core-js/modules/esnext.async-iterator.for-each.js");
|
|
@@ -96,6 +97,7 @@ var AgoraRteEngine = exports.AgoraRteEngine = /*#__PURE__*/function () {
|
|
|
96
97
|
onPeerMessageReceived: this._handlePeerMessageReceived.bind(this),
|
|
97
98
|
onTokenWillExpire: this._handleTokenWillExpire.bind(this)
|
|
98
99
|
});
|
|
100
|
+
(0, _defineProperty2["default"])(this, "_apDetector", this._createDefaultApDetector());
|
|
99
101
|
(0, _defineProperty2["default"])(this, "_pluginManager", (0, _plugin.getPluginManager)());
|
|
100
102
|
(0, _domainHolder.resetSharedDomainHolder)();
|
|
101
103
|
this._config = (0, _clone.cloneDeep)(config);
|
|
@@ -125,7 +127,7 @@ var AgoraRteEngine = exports.AgoraRteEngine = /*#__PURE__*/function () {
|
|
|
125
127
|
appId: this._config.appId,
|
|
126
128
|
appVersion: this.getVersion()
|
|
127
129
|
}, this._httpAuthHeadersProvider, this._rtcClient, this._rtmClient, this._config.userId, this._apiService);
|
|
128
|
-
this.
|
|
130
|
+
this._updateApDetector(config.parameters);
|
|
129
131
|
this._rtmClient.addObserver(this._rtmClientObserver);
|
|
130
132
|
if (config.parameters) {
|
|
131
133
|
this.setParameters(config.parameters);
|
|
@@ -243,7 +245,7 @@ var AgoraRteEngine = exports.AgoraRteEngine = /*#__PURE__*/function () {
|
|
|
243
245
|
var _this = this;
|
|
244
246
|
try {
|
|
245
247
|
this._setupRteIpList(parameters);
|
|
246
|
-
this.
|
|
248
|
+
this._updateApDetector(parameters);
|
|
247
249
|
var _ref = parameters,
|
|
248
250
|
rtc = _ref.rtc,
|
|
249
251
|
rtm = _ref.rtm;
|
|
@@ -358,25 +360,38 @@ var AgoraRteEngine = exports.AgoraRteEngine = /*#__PURE__*/function () {
|
|
|
358
360
|
}
|
|
359
361
|
}
|
|
360
362
|
}, {
|
|
361
|
-
key: "
|
|
362
|
-
value: function
|
|
363
|
-
this.logger.info("
|
|
364
|
-
this._apDetector = this._createApDetector(parameters);
|
|
365
|
-
}
|
|
366
|
-
}, {
|
|
367
|
-
key: "_createApDetector",
|
|
368
|
-
value: function _createApDetector(parameters) {
|
|
363
|
+
key: "_updateApDetector",
|
|
364
|
+
value: function _updateApDetector(parameters) {
|
|
365
|
+
this.logger.info("update ap detector");
|
|
369
366
|
var externalRtcConfig = (0, _imports.isElectron)() ? (0, _parameters.getRtcExternaApConfig)(parameters) : (0, _parameters.getRtcWebExternaApConfig)(parameters);
|
|
370
367
|
var internalRtcConfig = (0, _imports.isElectron)() ? (0, _parameters.getRtcInternaApConfig)(parameters) : (0, _parameters.getRtcWebInternaApConfig)(parameters);
|
|
371
|
-
var apDetectTimeout = (0, _parameters.getApDetectTimeout)(parameters);
|
|
368
|
+
var apDetectTimeout = Number((0, _parameters.getApDetectTimeout)(parameters));
|
|
372
369
|
var apDetectIsRedetect = (0, _parameters.getApDetectIsRedetect)(parameters);
|
|
373
|
-
|
|
374
|
-
|
|
370
|
+
var paramTimeout = Number.isNaN(apDetectTimeout) ? 0 : apDetectTimeout;
|
|
371
|
+
var paramIsRedetect = typeof apDetectIsRedetect === 'boolean' ? !!apDetectIsRedetect : true;
|
|
372
|
+
this.logger.info("create ap detector instance: external=".concat(JSON.stringify(externalRtcConfig), ", internal=").concat(JSON.stringify(internalRtcConfig), ", timeout=").concat(paramTimeout, ", isRedetect=").concat(paramIsRedetect));
|
|
373
|
+
if (this._validCfg(externalRtcConfig) || this._validCfg(internalRtcConfig)) {
|
|
374
|
+
this._apDetector.setConfig(paramTimeout, paramIsRedetect, internalRtcConfig, externalRtcConfig);
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
}, {
|
|
378
|
+
key: "_validCfg",
|
|
379
|
+
value: function _validCfg(cfg) {
|
|
380
|
+
return cfg && Array.isArray(cfg === null || cfg === void 0 ? void 0 : cfg.serverList) && cfg.serverList.length > 0;
|
|
381
|
+
}
|
|
382
|
+
}, {
|
|
383
|
+
key: "_createDefaultApDetector",
|
|
384
|
+
value: function _createDefaultApDetector() {
|
|
385
|
+
return new _apDetector.AgoraRteApDetectorImpl({
|
|
386
|
+
serverList: []
|
|
387
|
+
}, {
|
|
388
|
+
serverList: []
|
|
389
|
+
});
|
|
375
390
|
}
|
|
376
391
|
}]);
|
|
377
392
|
}();
|
|
378
393
|
_AgoraRteEngine = AgoraRteEngine;
|
|
379
|
-
var _applyDecs$e = _applyDecs(_AgoraRteEngine, [[_imports.trace, 2, "login"], [_imports.trace, 2, "logout"], [_imports.trace, 2, "createScene"], [_imports.trace, 2, "sendPeerMessage"], [_imports.trace, 2, "setParameters"], [_imports.trace, 2, "renewUserToken"], [_imports.trace, 2, "release"]], []).e;
|
|
394
|
+
var _applyDecs$e = _applyDecs(_AgoraRteEngine, [[_imports.trace, 2, "login"], [_imports.trace, 2, "logout"], [_imports.trace, 2, "createScene"], [_imports.trace, 2, "sendPeerMessage"], [_imports.trace, 2, "setParameters"], [_imports.trace, 2, "renewUserToken"], [_imports.trace, 2, "release"], [[_imports.trace, _imports.bound], 2, "_updateApDetector"]], []).e;
|
|
380
395
|
var _applyDecs$e2 = (0, _slicedToArray2["default"])(_applyDecs$e, 1);
|
|
381
396
|
_initProto = _applyDecs$e2[0];
|
|
382
397
|
_applyDecs$e;
|
|
@@ -239,14 +239,14 @@ var AgoraRtcChannelClientImpl = exports.AgoraRtcChannelClientImpl = /*#__PURE__*
|
|
|
239
239
|
_this2._rtcStatsTask = _schedule.AgoraScheduler.shared.addIntervalTask(function () {
|
|
240
240
|
_this2.observable.notifyObservers('onNetworkStatsUpdated', _this2._rtcStats, _this2._channelId);
|
|
241
241
|
}, _schedule.AgoraScheduler.Duration.second(2));
|
|
242
|
-
_this2.logger.
|
|
242
|
+
_this2.logger.info("join rtc channel success, streamId: ".concat(streamId, ", channelId: ").concat(_this2._channelId));
|
|
243
243
|
resolve();
|
|
244
244
|
};
|
|
245
245
|
_this2._joinSuccessCallback = _callback;
|
|
246
246
|
_this2._rtcEngine.addListener('onJoinChannelSuccess', _callback);
|
|
247
247
|
(0, _parameters2.setPresetParametersEx)(_this2._rtcEngine, _this2._rtcConnection);
|
|
248
248
|
if (_this2._parameters) {
|
|
249
|
-
_this2.logger.
|
|
249
|
+
_this2.logger.info("set parameters: ".concat(_this2._parameters, ", channelId: ").concat(_this2._channelId));
|
|
250
250
|
_this2._rtcEngine.setParametersEx(_this2._rtcConnection, _this2._parameters);
|
|
251
251
|
}
|
|
252
252
|
var ret = _this2._rtcEngine.joinChannelEx(token, _this2._rtcConnection, {
|
|
@@ -267,14 +267,16 @@ var AgoraRtcChannelClientImpl = exports.AgoraRtcChannelClientImpl = /*#__PURE__*
|
|
|
267
267
|
(0, _utils.setVideoEncoderConfig)(lowVideoEncoderConfig, _type.AgoraRtcVideoStreamType.LOW_STREAM, _this2._rtcEngine, _this2.rtcConnection, isHardEncode);
|
|
268
268
|
if (ret) {
|
|
269
269
|
_this2._rtcEngine.removeListener('onJoinChannelSuccess', _callback);
|
|
270
|
-
reject(new Error("join
|
|
270
|
+
reject(new Error("join channel failed, channelId: ".concat(_this2._channelId, ", error code: ").concat(ret)));
|
|
271
271
|
}
|
|
272
272
|
}), 15000 // TODO: define `timeout` constant in some files, don't hard code it
|
|
273
273
|
)["catch"](function (e) {
|
|
274
274
|
if (e.cause === 'timeout') {
|
|
275
275
|
_this2._clean();
|
|
276
|
-
|
|
276
|
+
_this2.logger.error("join rtc channel timeout, channelId: ".concat(_this2._channelId));
|
|
277
|
+
throw (0, _error.generateElectronRtcError)('10', "join rtc channel timeout", e);
|
|
277
278
|
}
|
|
279
|
+
_this2.logger.error("join rtc channel failed, channelId: ".concat(_this2._channelId));
|
|
278
280
|
throw (0, _error.generateElectronRtcError)('8', 'join rtc channel failed', e);
|
|
279
281
|
}));
|
|
280
282
|
case 16:
|
|
@@ -578,20 +580,18 @@ var AgoraRtcChannelClientImpl = exports.AgoraRtcChannelClientImpl = /*#__PURE__*
|
|
|
578
580
|
}, {
|
|
579
581
|
key: "_handleUserJoin",
|
|
580
582
|
value: function _handleUserJoin(connection, uid, elapsed) {
|
|
581
|
-
if (connection.localUid === this._rtcConnection.localUid) {
|
|
582
|
-
|
|
583
|
+
if (connection.localUid === this._rtcConnection.localUid && connection.channelId === this._channelId) {
|
|
584
|
+
this.logger.info("".concat(uid, " joined the channel ").concat(this._channelId, ", elapsed: ").concat(elapsed));
|
|
585
|
+
this.observable.notifyObservers('onRemoteStreamJoined', "".concat(uid), this._channelId);
|
|
583
586
|
}
|
|
584
|
-
this.logger.info("".concat(uid, " joined the channel ").concat(this._channelId, ", elapsed: ").concat(elapsed));
|
|
585
|
-
this.observable.notifyObservers('onRemoteStreamJoined', "".concat(uid), this._channelId);
|
|
586
587
|
}
|
|
587
588
|
}, {
|
|
588
589
|
key: "_handleUserLeave",
|
|
589
590
|
value: function _handleUserLeave(connection, uid, reason) {
|
|
590
|
-
if (connection.localUid === this._rtcConnection.localUid) {
|
|
591
|
-
|
|
591
|
+
if (connection.localUid === this._rtcConnection.localUid && connection.channelId === this._channelId) {
|
|
592
|
+
this.logger.info("".concat(uid, " left the channel ").concat(this._channelId, ", reason: ").concat(reason));
|
|
593
|
+
this.observable.notifyObservers('onRemoteStreamLeft', "".concat(uid), this._channelId);
|
|
592
594
|
}
|
|
593
|
-
this.logger.info("".concat(uid, " left the channel ").concat(this._channelId, ", reason: ").concat(reason));
|
|
594
|
-
this.observable.notifyObservers('onRemoteStreamLeft', "".concat(uid), this._channelId);
|
|
595
595
|
}
|
|
596
596
|
}, {
|
|
597
597
|
key: "_handleRemoteVideoStats",
|
|
@@ -310,9 +310,16 @@ var AgoraRtcSourceManagerImpl = exports.AgoraRtcSourceManagerImpl = /*#__PURE__*
|
|
|
310
310
|
}, {
|
|
311
311
|
key: "openMicrophone",
|
|
312
312
|
value: function openMicrophone(deviceId) {
|
|
313
|
-
var res =
|
|
313
|
+
var res = 0;
|
|
314
|
+
if (!this._microphoneKeepRecording) {
|
|
315
|
+
res = this._startMicrophoneCapture(deviceId);
|
|
316
|
+
if (res === 0) {
|
|
317
|
+
this._rtcEngine.enableLocalAudio(true);
|
|
318
|
+
}
|
|
319
|
+
} else {
|
|
320
|
+
this._currentMicrophoneDeviceId = deviceId;
|
|
321
|
+
}
|
|
314
322
|
if (res === 0) {
|
|
315
|
-
this._rtcEngine.enableLocalAudio(true);
|
|
316
323
|
var status = this.microphoneDeviceStatusMapping.get(deviceId) || 0;
|
|
317
324
|
this.microphoneDeviceStatusMapping.set(deviceId, status |= _type2.AgoraRtcDeviceStatusFlag.ON);
|
|
318
325
|
this.observable.notifyObservers('onMicrophoneStateUpdated', deviceId, _type.AgoraRtcMediaSourceState.OPEN);
|
|
@@ -328,6 +335,9 @@ var AgoraRtcSourceManagerImpl = exports.AgoraRtcSourceManagerImpl = /*#__PURE__*
|
|
|
328
335
|
if (!isTesting) {
|
|
329
336
|
res = this._stopMicrophoneCapture(deviceId);
|
|
330
337
|
}
|
|
338
|
+
} else {
|
|
339
|
+
// 设置为 undefined 无法在 LocalAudioStateChanged 时重启设备
|
|
340
|
+
// this._currentMicrophoneDeviceId = undefined;
|
|
331
341
|
}
|
|
332
342
|
var status = this.microphoneDeviceStatusMapping.get(deviceId) || 0;
|
|
333
343
|
this.microphoneDeviceStatusMapping.set(deviceId, status &= ~_type2.AgoraRtcDeviceStatusFlag.ON);
|
|
@@ -611,9 +621,13 @@ var AgoraRtcSourceManagerImpl = exports.AgoraRtcSourceManagerImpl = /*#__PURE__*
|
|
|
611
621
|
var deviceId = this._currentMicrophoneDeviceId;
|
|
612
622
|
if (!deviceId) return;
|
|
613
623
|
var microphoneStatus = this.microphoneDeviceStatusMapping.get(deviceId) || 0;
|
|
614
|
-
|
|
615
|
-
this.
|
|
616
|
-
|
|
624
|
+
var isMicrophoneOn = microphoneStatus === _type2.AgoraRtcDeviceStatusFlag.ON;
|
|
625
|
+
var isKeepRecording = this._microphoneKeepRecording;
|
|
626
|
+
// 停止发流时,麦克风会被关闭,以下两种情况需要保持麦克风开启
|
|
627
|
+
if (isMicrophoneOn || isKeepRecording) {
|
|
628
|
+
this._stopMicrophoneCapture(deviceId);
|
|
629
|
+
this._startMicrophoneCapture(deviceId);
|
|
630
|
+
}
|
|
617
631
|
}
|
|
618
632
|
}
|
|
619
633
|
}, {
|
|
@@ -15,6 +15,7 @@ export declare class AgoraRtcChannelSubscriberImpl extends AgoraRtcChannelSubscr
|
|
|
15
15
|
private _addListener;
|
|
16
16
|
private _removeListener;
|
|
17
17
|
private _subscribeRemoteVideoStream;
|
|
18
|
+
private _setRemoteVideoStreamType;
|
|
18
19
|
private _unsubscribeRemoteVideoStream;
|
|
19
20
|
private _subscribeRemoteAudioStream;
|
|
20
21
|
private _unsubscribeRemoteAudioStream;
|
|
@@ -78,10 +78,11 @@ var AgoraRtcChannelSubscriberImpl = exports.AgoraRtcChannelSubscriberImpl = /*#_
|
|
|
78
78
|
(0, _defineProperty2["default"])(_this, "_channelClientObserver", {
|
|
79
79
|
onRemoteStreamJoined: function onRemoteStreamJoined(streamId, channelId) {
|
|
80
80
|
if (channelId !== _this._connection.channelId) return;
|
|
81
|
+
if (_this._isPause) return;
|
|
81
82
|
var streamType = _this._videoMapping.get(streamId);
|
|
82
83
|
if (streamType !== undefined) {
|
|
83
84
|
_this._rtcEngine.muteRemoteVideoStreamEx(Number(streamId), false, _this._connection);
|
|
84
|
-
_this.
|
|
85
|
+
_this._setRemoteVideoStreamType(streamId, streamType);
|
|
85
86
|
}
|
|
86
87
|
if (_this._audioMapping.has(streamId)) {
|
|
87
88
|
_this._rtcEngine.muteRemoteAudioStreamEx(Number(streamId), false, _this._connection);
|
|
@@ -112,9 +113,14 @@ var AgoraRtcChannelSubscriberImpl = exports.AgoraRtcChannelSubscriberImpl = /*#_
|
|
|
112
113
|
}, {
|
|
113
114
|
key: "_subscribeRemoteVideoStream",
|
|
114
115
|
value: function _subscribeRemoteVideoStream(streamId, streamType) {
|
|
115
|
-
this.
|
|
116
|
+
this._setRemoteVideoStreamType(streamId, streamType);
|
|
116
117
|
return this._rtcEngine.muteRemoteVideoStreamEx(Number(streamId), false, this._connection);
|
|
117
118
|
}
|
|
119
|
+
}, {
|
|
120
|
+
key: "_setRemoteVideoStreamType",
|
|
121
|
+
value: function _setRemoteVideoStreamType(streamId, streamType) {
|
|
122
|
+
return this._rtcEngine.setRemoteVideoStreamTypeEx(Number(streamId), streamType === _type.AgoraRtcVideoStreamType.HIGH_STREAM ? 0 : 1, this._connection);
|
|
123
|
+
}
|
|
118
124
|
}, {
|
|
119
125
|
key: "_unsubscribeRemoteVideoStream",
|
|
120
126
|
value: function _unsubscribeRemoteVideoStream(streamId) {
|
|
@@ -142,6 +148,9 @@ var AgoraRtcChannelSubscriberImpl = exports.AgoraRtcChannelSubscriberImpl = /*#_
|
|
|
142
148
|
if (muted) {
|
|
143
149
|
return;
|
|
144
150
|
}
|
|
151
|
+
if (this._isPause) {
|
|
152
|
+
return;
|
|
153
|
+
}
|
|
145
154
|
if (this._audioMapping.has("".concat(uid))) {
|
|
146
155
|
this._rtcEngine.muteRemoteAudioStreamEx(uid, false, this._connection);
|
|
147
156
|
}
|
|
@@ -158,16 +167,19 @@ var AgoraRtcChannelSubscriberImpl = exports.AgoraRtcChannelSubscriberImpl = /*#_
|
|
|
158
167
|
if (muted) {
|
|
159
168
|
return;
|
|
160
169
|
}
|
|
161
|
-
if (
|
|
170
|
+
if (this._isPause) {
|
|
162
171
|
return;
|
|
163
172
|
}
|
|
164
|
-
this.
|
|
173
|
+
if (this._videoMapping.has("".concat(uid))) {
|
|
174
|
+
this._rtcEngine.muteRemoteVideoStreamEx(uid, false, this._connection);
|
|
175
|
+
}
|
|
165
176
|
}
|
|
166
177
|
}, {
|
|
167
178
|
key: "subscribeRemoteVideoStream",
|
|
168
179
|
value: function subscribeRemoteVideoStream(streamId, streamType) {
|
|
169
180
|
this._videoMapping.set(streamId, streamType);
|
|
170
181
|
if (this._isPause) {
|
|
182
|
+
this._setRemoteVideoStreamType(streamId, streamType);
|
|
171
183
|
return 0;
|
|
172
184
|
}
|
|
173
185
|
return this._subscribeRemoteVideoStream(streamId, streamType);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "agora-rte-sdk",
|
|
3
|
-
"version": "3.6.
|
|
3
|
+
"version": "3.6.3",
|
|
4
4
|
"description": "SDK for building interactive scenarios",
|
|
5
5
|
"author": "agora.io",
|
|
6
6
|
"license": "ISC",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"@types/sinon": "^17.0.2",
|
|
35
35
|
"@types/ua-parser-js": "^0.7.35",
|
|
36
36
|
"agora-token": "^2.0.3",
|
|
37
|
-
"agora-toolchain": "^3.6.
|
|
37
|
+
"agora-toolchain": "^3.6.3",
|
|
38
38
|
"babel-jest": "^29.7.0",
|
|
39
39
|
"core-js": "^3.33.3",
|
|
40
40
|
"dotenv": "^16.3.1",
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
"agora-extension-ai-denoiser": "^1.0.0",
|
|
56
56
|
"agora-extension-beauty-effect": "^1.0.1-beta",
|
|
57
57
|
"agora-extension-virtual-background": "^2.1.0",
|
|
58
|
-
"agora-foundation": "^3.6.
|
|
58
|
+
"agora-foundation": "^3.6.3",
|
|
59
59
|
"agora-rtc-sdk-ng": "4.23.3",
|
|
60
60
|
"agora-rtm": "2.2.2-2",
|
|
61
61
|
"await-to-js": "^3.0.0",
|