agora-rte-sdk 3.8.2 → 3.9.0-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.
- package/lib/constant.d.ts +9 -0
- package/lib/constant.js +13 -2
- package/lib/core/engine/ap-detector.d.ts +4 -4
- package/lib/core/engine/ap-detector.js +33 -20
- package/lib/core/engine/index.d.ts +19 -11
- package/lib/core/engine/index.js +132 -48
- package/lib/core/engine/plugin.js +2 -2
- package/lib/core/engine/type.d.ts +29 -0
- package/lib/core/engine/type.js +6 -0
- package/lib/core/media/camera.d.ts +8 -8
- package/lib/core/media/camera.js +38 -21
- package/lib/core/media/effect-enhancer.d.ts +5 -6
- package/lib/core/media/effect-enhancer.js +6 -16
- package/lib/core/media/index.d.ts +1 -155
- package/lib/core/media/index.js +44 -15
- package/lib/core/media/loopback.d.ts +3 -3
- package/lib/core/media/loopback.js +18 -11
- package/lib/core/media/microphone.d.ts +6 -6
- package/lib/core/media/microphone.js +32 -16
- package/lib/core/media/screen.d.ts +13 -5
- package/lib/core/media/screen.js +46 -16
- package/lib/core/media/type.d.ts +159 -2
- package/lib/core/media/type.js +4 -1
- package/lib/core/processor/message-handler.d.ts +4 -4
- package/lib/core/processor/message-handler.js +66 -28
- package/lib/core/processor/sequence-msg/data.d.ts +9 -7
- package/lib/core/processor/sequence-msg/data.js +26 -3
- package/lib/core/processor/struct.js +2 -2
- package/lib/core/processor/synchronizer/synchronizer-manager.d.ts +10 -0
- package/lib/core/processor/synchronizer/synchronizer-manager.js +43 -4
- package/lib/core/rtc/capture-enhancement.d.ts +4 -14
- package/lib/core/rtc/channel.d.ts +4 -4
- package/lib/core/rtc/constant.d.ts +1 -5
- package/lib/core/rtc/constant.js +2 -8
- package/lib/core/rtc/publish-pool.d.ts +20 -8
- package/lib/core/rtc/publish-pool.js +272 -3
- package/lib/core/rtc/publisher.d.ts +20 -14
- package/lib/core/rtc/publisher.js +151 -7
- package/lib/core/rtc/source-manager.d.ts +12 -2
- package/lib/core/rtc/subscriber.d.ts +14 -6
- package/lib/core/rtc/subscriber.js +171 -4
- package/lib/core/rtc/type.d.ts +6 -17
- package/lib/core/rtc/type.js +10 -26
- package/lib/core/rtm/channel.d.ts +3 -3
- package/lib/core/rtm/client.d.ts +4 -4
- package/lib/core/rtm/type.d.ts +1 -2
- package/lib/core/scene/helpers/ap-detect.d.ts +5 -0
- package/lib/core/scene/helpers/ap-detect.js +153 -0
- package/lib/core/scene/helpers/join.d.ts +8 -0
- package/lib/core/scene/helpers/join.js +105 -0
- package/lib/core/scene/helpers/rtc-event.d.ts +4 -0
- package/lib/core/scene/helpers/rtc-event.js +36 -0
- package/lib/core/scene/helpers/stream-publish-handlers.d.ts +15 -0
- package/lib/core/scene/helpers/stream-publish-handlers.js +121 -0
- package/lib/core/scene/helpers/stream-type.d.ts +7 -0
- package/lib/core/scene/{helper.js → helpers/stream-type.js} +3 -32
- package/lib/core/scene/index.d.ts +69 -187
- package/lib/core/scene/index.js +813 -1368
- package/lib/core/scene/local-user.d.ts +19 -85
- package/lib/core/scene/local-user.js +151 -152
- package/lib/core/scene/state-sync.d.ts +5 -7
- package/lib/core/scene/state-sync.js +20 -43
- package/lib/core/scene/stream-player.d.ts +9 -8
- package/lib/core/scene/stream-player.js +13 -10
- package/lib/core/scene/type.d.ts +359 -9
- package/lib/core/services/api.d.ts +9 -0
- package/lib/core/services/api.js +96 -58
- package/lib/core/services/auth-headers.d.ts +1 -0
- package/lib/core/services/auth-headers.js +5 -2
- package/lib/core/services/client.d.ts +3 -0
- package/lib/core/services/client.js +14 -2
- package/lib/core/services/type.d.ts +1 -0
- package/lib/core/type.d.ts +1 -0
- package/lib/core/type.js +6 -0
- package/lib/core/utilities/abort-manager.d.ts +18 -0
- package/lib/core/utilities/abort-manager.js +154 -0
- package/lib/core/utilities/error.d.ts +5 -36
- package/lib/core/utilities/error.js +23 -92
- package/lib/core/utilities/join-manager.d.ts +54 -0
- package/lib/core/utilities/join-manager.js +198 -0
- package/lib/core/utilities/logger.d.ts +2 -0
- package/lib/core/utilities/logger.js +8 -13
- package/lib/core/utilities/package-info.d.ts +1 -0
- package/lib/core/utilities/package-info.js +6 -4
- package/lib/core/utilities/property-extract.d.ts +2 -0
- package/lib/core/utilities/property-extract.js +79 -0
- package/lib/core/utilities/weak-invoker.d.ts +11 -0
- package/lib/core/utilities/weak-invoker.js +121 -0
- package/lib/imports.d.ts +6 -4
- package/lib/imports.js +42 -17
- package/lib/index.d.ts +7 -5
- package/lib/index.js +6 -5
- package/lib/plugin/restful-client/index.d.ts +1 -1
- package/lib/plugin/restful-client/index.js +11 -10
- package/lib/plugin/rtc/electron/camera-preview-task-manager.d.ts +14 -0
- package/lib/plugin/rtc/electron/camera-preview-task-manager.js +125 -0
- package/lib/plugin/rtc/electron/canvas-helper.d.ts +2 -2
- package/lib/plugin/rtc/electron/canvas-helper.js +15 -12
- package/lib/plugin/rtc/electron/canvas-tag-pool.d.ts +4 -4
- package/lib/plugin/rtc/electron/canvas-tag-pool.js +21 -13
- package/lib/plugin/rtc/electron/capture-enhancement.d.ts +3 -5
- package/lib/plugin/rtc/electron/capture-enhancement.js +45 -29
- package/lib/plugin/rtc/electron/channel.d.ts +13 -16
- package/lib/plugin/rtc/electron/channel.js +48 -57
- package/lib/plugin/rtc/electron/client.d.ts +8 -4
- package/lib/plugin/rtc/electron/client.js +107 -72
- package/lib/plugin/rtc/electron/constants.d.ts +12 -1
- package/lib/plugin/rtc/electron/constants.js +94 -26
- package/lib/plugin/rtc/electron/desc-type.js +1 -1
- package/lib/plugin/rtc/electron/downloadALD.js +9 -7
- package/lib/plugin/rtc/electron/publish-pool.d.ts +9 -17
- package/lib/plugin/rtc/electron/publish-pool.js +110 -256
- package/lib/plugin/rtc/electron/publisher.d.ts +9 -21
- package/lib/plugin/rtc/electron/publisher.js +80 -254
- package/lib/plugin/rtc/electron/source-manager.d.ts +22 -16
- package/lib/plugin/rtc/electron/source-manager.js +345 -215
- package/lib/plugin/rtc/electron/source-state-control/loopback-state-control.d.ts +1 -5
- package/lib/plugin/rtc/electron/source-state-control/loopback-state-control.js +2 -18
- package/lib/plugin/rtc/electron/source-state-control/media-state-control.d.ts +18 -0
- package/lib/plugin/rtc/electron/source-state-control/{camera-state-control.js → media-state-control.js} +50 -104
- package/lib/plugin/rtc/electron/source-state-control/microphone-state-control.d.ts +4 -10
- package/lib/plugin/rtc/electron/source-state-control/microphone-state-control.js +5 -26
- package/lib/plugin/rtc/electron/source-state-control/source-state-control.d.ts +30 -26
- package/lib/plugin/rtc/electron/source-state-control/source-state-control.js +68 -110
- package/lib/plugin/rtc/electron/subscriber.d.ts +7 -16
- package/lib/plugin/rtc/electron/subscriber.js +34 -112
- package/lib/plugin/rtc/electron/type.d.ts +7 -3
- package/lib/plugin/rtc/electron/type.js +8 -2
- package/lib/plugin/rtc/electron/utils.d.ts +9 -6
- package/lib/plugin/rtc/electron/utils.js +37 -9
- package/lib/plugin/rtc/web/assembler.d.ts +2 -1
- package/lib/plugin/rtc/web/assembler.js +9 -2
- package/lib/plugin/rtc/web/audio-player.d.ts +1 -1
- package/lib/plugin/rtc/web/audio-player.js +13 -8
- package/lib/plugin/rtc/web/canvas-helper.d.ts +1 -1
- package/lib/plugin/rtc/web/canvas-helper.js +3 -1
- package/lib/plugin/rtc/web/capture-enhancement.d.ts +3 -5
- package/lib/plugin/rtc/web/capture-enhancement.js +14 -20
- package/lib/plugin/rtc/web/channel.d.ts +17 -13
- package/lib/plugin/rtc/web/channel.js +221 -124
- package/lib/plugin/rtc/web/client.d.ts +5 -3
- package/lib/plugin/rtc/web/client.js +49 -21
- package/lib/plugin/rtc/web/convert-type.d.ts +3 -0
- package/lib/plugin/rtc/web/convert-type.js +22 -0
- package/lib/plugin/rtc/web/device.js +2 -3
- package/lib/plugin/rtc/web/effect-enabler.js +3 -3
- package/lib/plugin/rtc/web/extension.d.ts +1 -1
- package/lib/plugin/rtc/web/extension.js +4 -1
- package/lib/plugin/rtc/web/publish-pool.d.ts +4 -17
- package/lib/plugin/rtc/web/publish-pool.js +41 -194
- package/lib/plugin/rtc/web/publish.d.ts +9 -8
- package/lib/plugin/rtc/web/publish.js +71 -27
- package/lib/plugin/rtc/web/publisher.d.ts +20 -12
- package/lib/plugin/rtc/web/publisher.js +118 -69
- package/lib/plugin/rtc/web/source-manager.d.ts +1 -0
- package/lib/plugin/rtc/web/source-manager.js +15 -9
- package/lib/plugin/rtc/web/subscribe.d.ts +10 -10
- package/lib/plugin/rtc/web/subscribe.js +26 -14
- package/lib/plugin/rtc/web/subscriber.d.ts +5 -10
- package/lib/plugin/rtc/web/subscriber.js +21 -82
- package/lib/plugin/rtc/web/track-control/camera.d.ts +1 -1
- package/lib/plugin/rtc/web/track-control/camera.js +4 -1
- package/lib/plugin/rtc/web/track-control/screen.d.ts +1 -1
- package/lib/plugin/rtc/web/track-control/screen.js +4 -1
- package/lib/plugin/rtm/channel.d.ts +8 -5
- package/lib/plugin/rtm/channel.js +113 -49
- package/lib/plugin/rtm/client.d.ts +10 -5
- package/lib/plugin/rtm/client.js +120 -61
- package/lib/plugin/rtm/utils.js +1 -1
- package/lib/plugin/synchronizer-worker/worker.js +71 -7
- package/lib/type.d.ts +0 -5
- package/lib-es/constant.js +12 -1
- package/lib-es/core/engine/ap-detector.js +36 -22
- package/lib-es/core/engine/index.js +134 -50
- package/lib-es/core/engine/plugin.js +1 -1
- package/lib-es/core/engine/type.js +1 -0
- package/lib-es/core/media/camera.js +38 -22
- package/lib-es/core/media/effect-enhancer.js +6 -16
- package/lib-es/core/media/index.js +44 -17
- package/lib-es/core/media/loopback.js +18 -12
- package/lib-es/core/media/microphone.js +32 -17
- package/lib-es/core/media/screen.js +46 -17
- package/lib-es/core/media/type.js +5 -1
- package/lib-es/core/processor/message-handler.js +44 -6
- package/lib-es/core/processor/sequence-msg/data.js +27 -4
- package/lib-es/core/processor/struct.js +1 -1
- package/lib-es/core/processor/synchronizer/synchronizer-manager.js +43 -4
- package/lib-es/core/rtc/constant.js +1 -7
- package/lib-es/core/rtc/publish-pool.js +274 -4
- package/lib-es/core/rtc/publisher.js +153 -9
- package/lib-es/core/rtc/subscriber.js +172 -4
- package/lib-es/core/rtc/type.js +9 -25
- package/lib-es/core/scene/helpers/ap-detect.js +143 -0
- package/lib-es/core/scene/helpers/join.js +97 -0
- package/lib-es/core/scene/helpers/rtc-event.js +29 -0
- package/lib-es/core/scene/helpers/stream-publish-handlers.js +112 -0
- package/lib-es/core/scene/helpers/stream-type.js +43 -0
- package/lib-es/core/scene/index.js +817 -1373
- package/lib-es/core/scene/local-user.js +144 -146
- package/lib-es/core/scene/state-sync.js +19 -42
- package/lib-es/core/scene/stream-player.js +13 -10
- package/lib-es/core/services/api.js +97 -59
- package/lib-es/core/services/auth-headers.js +4 -1
- package/lib-es/core/services/client.js +13 -1
- package/lib-es/core/type.js +1 -0
- package/lib-es/core/utilities/abort-manager.js +146 -0
- package/lib-es/core/utilities/error.js +22 -91
- package/lib-es/core/utilities/join-manager.js +190 -0
- package/lib-es/core/utilities/logger.js +8 -13
- package/lib-es/core/utilities/package-info.js +5 -3
- package/lib-es/core/utilities/property-extract.js +71 -0
- package/lib-es/core/utilities/weak-invoker.js +113 -0
- package/lib-es/imports.js +9 -5
- package/lib-es/index.js +3 -2
- package/lib-es/plugin/restful-client/index.js +5 -4
- package/lib-es/plugin/rtc/electron/camera-preview-task-manager.js +117 -0
- package/lib-es/plugin/rtc/electron/canvas-helper.js +15 -12
- package/lib-es/plugin/rtc/electron/canvas-tag-pool.js +21 -13
- package/lib-es/plugin/rtc/electron/capture-enhancement.js +46 -30
- package/lib-es/plugin/rtc/electron/channel.js +49 -58
- package/lib-es/plugin/rtc/electron/client.js +107 -72
- package/lib-es/plugin/rtc/electron/constants.js +93 -25
- package/lib-es/plugin/rtc/electron/desc-type.js +1 -1
- package/lib-es/plugin/rtc/electron/downloadALD.js +10 -8
- package/lib-es/plugin/rtc/electron/publish-pool.js +111 -257
- package/lib-es/plugin/rtc/electron/publisher.js +51 -226
- package/lib-es/plugin/rtc/electron/source-manager.js +348 -218
- package/lib-es/plugin/rtc/electron/source-state-control/loopback-state-control.js +2 -18
- package/lib-es/plugin/rtc/electron/source-state-control/{camera-state-control.js → media-state-control.js} +64 -118
- package/lib-es/plugin/rtc/electron/source-state-control/microphone-state-control.js +5 -26
- package/lib-es/plugin/rtc/electron/source-state-control/source-state-control.js +69 -109
- package/lib-es/plugin/rtc/electron/subscriber.js +38 -116
- package/lib-es/plugin/rtc/electron/type.js +7 -1
- package/lib-es/plugin/rtc/electron/utils.js +37 -9
- package/lib-es/plugin/rtc/web/assembler.js +9 -2
- package/lib-es/plugin/rtc/web/audio-player.js +14 -9
- package/lib-es/plugin/rtc/web/canvas-helper.js +3 -1
- package/lib-es/plugin/rtc/web/capture-enhancement.js +14 -20
- package/lib-es/plugin/rtc/web/channel.js +234 -137
- package/lib-es/plugin/rtc/web/client.js +50 -22
- package/lib-es/plugin/rtc/web/convert-type.js +15 -0
- package/lib-es/plugin/rtc/web/device.js +3 -4
- package/lib-es/plugin/rtc/web/effect-enabler.js +3 -3
- package/lib-es/plugin/rtc/web/extension.js +4 -1
- package/lib-es/plugin/rtc/web/publish-pool.js +45 -198
- package/lib-es/plugin/rtc/web/publish.js +71 -27
- package/lib-es/plugin/rtc/web/publisher.js +122 -72
- package/lib-es/plugin/rtc/web/source-manager.js +16 -10
- package/lib-es/plugin/rtc/web/subscribe.js +26 -14
- package/lib-es/plugin/rtc/web/subscriber.js +25 -86
- package/lib-es/plugin/rtc/web/track-control/camera.js +4 -1
- package/lib-es/plugin/rtc/web/track-control/screen.js +4 -1
- package/lib-es/plugin/rtm/channel.js +112 -48
- package/lib-es/plugin/rtm/client.js +116 -57
- package/lib-es/plugin/rtm/utils.js +1 -1
- package/lib-es/plugin/synchronizer-worker/worker.js +71 -7
- package/package.json +4 -4
- package/lib/core/scene/helper.d.ts +0 -10
- package/lib/plugin/rtc/electron/source-state-control/camera-state-control.d.ts +0 -28
- package/lib/plugin/rtc/electron/source-state-control/screen-state-control.d.ts +0 -31
- package/lib/plugin/rtc/electron/source-state-control/screen-state-control.js +0 -213
- package/lib/plugin/rtc/electron/source-state-control/window-state-control.d.ts +0 -31
- package/lib/plugin/rtc/electron/source-state-control/window-state-control.js +0 -213
- package/lib-es/core/scene/helper.js +0 -72
- package/lib-es/plugin/rtc/electron/source-state-control/screen-state-control.js +0 -206
- package/lib-es/plugin/rtc/electron/source-state-control/window-state-control.js +0 -206
|
@@ -5,7 +5,7 @@ import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
|
5
5
|
import _createClass from "@babel/runtime/helpers/createClass";
|
|
6
6
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
7
7
|
var _AgoraRteApDetectorImpl;
|
|
8
|
-
var _initProto;
|
|
8
|
+
var _initProto, _restartDecs, _startDecs, _executeDetectDecs, _ref;
|
|
9
9
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
10
10
|
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; }
|
|
11
11
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
@@ -66,9 +66,10 @@ import "core-js/modules/esnext.map.update.js";
|
|
|
66
66
|
import "core-js/modules/esnext.symbol.metadata.js";
|
|
67
67
|
import "core-js/modules/web.dom-collections.for-each.js";
|
|
68
68
|
import "core-js/modules/web.dom-collections.iterator.js";
|
|
69
|
-
import {
|
|
70
|
-
import {
|
|
71
|
-
import {
|
|
69
|
+
import { DetailErrorCode, ErrorModuleCode } from '../../imports';
|
|
70
|
+
import { AgoraObservable, fetch, isElectron, isEmpty, jsonstring, trace } from '../../imports';
|
|
71
|
+
import { generateRteClientErrorNew as generateRteClientError } from '../utilities/error';
|
|
72
|
+
import { createLogger, generateLogObserver } from '../utilities/logger';
|
|
72
73
|
var DEFAULT_FETCH_URL_TIMEOUT = 300; // milliseconds
|
|
73
74
|
|
|
74
75
|
// 用于判断是否是IP地址,简单的正则表达式判断示例,可根据实际完善
|
|
@@ -106,8 +107,9 @@ export var transformUrlToRequestUrl = function transformUrlToRequestUrl(url, isE
|
|
|
106
107
|
}
|
|
107
108
|
};
|
|
108
109
|
var generateApDetectorError = function generateApDetectorError(code, message) {
|
|
109
|
-
return generateRteClientError(
|
|
110
|
+
return generateRteClientError(ErrorModuleCode.RTE_AP_DETECTOR, code, message);
|
|
110
111
|
};
|
|
112
|
+
_ref = (_restartDecs = trace(['success', 'failure']), _startDecs = trace(['success', 'failure']), _executeDetectDecs = trace(['success', 'failure', 'type', 'successNotifyName', 'failureNotifyName']), "logger");
|
|
111
113
|
export var AgoraRteApDetectorImpl = /*#__PURE__*/function () {
|
|
112
114
|
// ==================== 构造函数 ====================
|
|
113
115
|
/**
|
|
@@ -119,7 +121,7 @@ export var AgoraRteApDetectorImpl = /*#__PURE__*/function () {
|
|
|
119
121
|
*/
|
|
120
122
|
function AgoraRteApDetectorImpl(internalRtcConfig, externalRtcConfig, detectTimeout, isRedetect) {
|
|
121
123
|
_classCallCheck(this, AgoraRteApDetectorImpl);
|
|
122
|
-
_defineProperty(this,
|
|
124
|
+
_defineProperty(this, _ref, (_initProto(this), createLogger({
|
|
123
125
|
prefix: 'AgoraRteApDetectorImpl'
|
|
124
126
|
})));
|
|
125
127
|
// ==================== 私有属性 ====================
|
|
@@ -241,17 +243,23 @@ export var AgoraRteApDetectorImpl = /*#__PURE__*/function () {
|
|
|
241
243
|
}, {
|
|
242
244
|
key: "restart",
|
|
243
245
|
value: function () {
|
|
244
|
-
var _restart = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(
|
|
245
|
-
var
|
|
246
|
+
var _restart = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
247
|
+
var success,
|
|
248
|
+
failure,
|
|
249
|
+
errorMsg,
|
|
250
|
+
error,
|
|
251
|
+
_args = arguments;
|
|
246
252
|
return _regeneratorRuntime.wrap(function (_context) {
|
|
247
253
|
while (1) switch (_context.prev = _context.next) {
|
|
248
254
|
case 0:
|
|
255
|
+
success = _args.length > 0 && _args[0] !== undefined ? _args[0] : function () {};
|
|
256
|
+
failure = _args.length > 1 && _args[1] !== undefined ? _args[1] : function () {};
|
|
249
257
|
if (this._isRedetect) {
|
|
250
258
|
_context.next = 1;
|
|
251
259
|
break;
|
|
252
260
|
}
|
|
253
261
|
errorMsg = 'restart: redetect is disabled, please check the isRedetect config';
|
|
254
|
-
error = generateApDetectorError(
|
|
262
|
+
error = generateApDetectorError(DetailErrorCode.UNDEFINED_ERROR, errorMsg);
|
|
255
263
|
this.logger.error(errorMsg);
|
|
256
264
|
failure(error);
|
|
257
265
|
this._apDetectorObserver.notifyObservers('onRedetectionFailure');
|
|
@@ -267,7 +275,7 @@ export var AgoraRteApDetectorImpl = /*#__PURE__*/function () {
|
|
|
267
275
|
}
|
|
268
276
|
}, _callee, this);
|
|
269
277
|
}));
|
|
270
|
-
function restart(
|
|
278
|
+
function restart() {
|
|
271
279
|
return _restart.apply(this, arguments);
|
|
272
280
|
}
|
|
273
281
|
return restart;
|
|
@@ -275,10 +283,15 @@ export var AgoraRteApDetectorImpl = /*#__PURE__*/function () {
|
|
|
275
283
|
}, {
|
|
276
284
|
key: "start",
|
|
277
285
|
value: function () {
|
|
278
|
-
var _start = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2(
|
|
286
|
+
var _start = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
|
|
287
|
+
var success,
|
|
288
|
+
failure,
|
|
289
|
+
_args2 = arguments;
|
|
279
290
|
return _regeneratorRuntime.wrap(function (_context2) {
|
|
280
291
|
while (1) switch (_context2.prev = _context2.next) {
|
|
281
292
|
case 0:
|
|
293
|
+
success = _args2.length > 0 && _args2[0] !== undefined ? _args2[0] : function () {};
|
|
294
|
+
failure = _args2.length > 1 && _args2[1] !== undefined ? _args2[1] : function () {};
|
|
282
295
|
_context2.next = 1;
|
|
283
296
|
return this._executeDetect(success, failure, 'start', 'onDetectionSuccess', 'onDetectionFailure');
|
|
284
297
|
case 1:
|
|
@@ -289,7 +302,7 @@ export var AgoraRteApDetectorImpl = /*#__PURE__*/function () {
|
|
|
289
302
|
}
|
|
290
303
|
}, _callee2, this);
|
|
291
304
|
}));
|
|
292
|
-
function start(
|
|
305
|
+
function start() {
|
|
293
306
|
return _start.apply(this, arguments);
|
|
294
307
|
}
|
|
295
308
|
return start;
|
|
@@ -318,7 +331,7 @@ export var AgoraRteApDetectorImpl = /*#__PURE__*/function () {
|
|
|
318
331
|
break;
|
|
319
332
|
}
|
|
320
333
|
errorMsg = "".concat(type, ": detection is already in progress, please do not call repeatedly");
|
|
321
|
-
error = generateApDetectorError(
|
|
334
|
+
error = generateApDetectorError(DetailErrorCode.UNDEFINED_ERROR, errorMsg);
|
|
322
335
|
this.logger.error(errorMsg);
|
|
323
336
|
failure(error);
|
|
324
337
|
this._apDetectorObserver.notifyObservers(failureNotifyName);
|
|
@@ -350,7 +363,7 @@ export var AgoraRteApDetectorImpl = /*#__PURE__*/function () {
|
|
|
350
363
|
return _context3.abrupt("return", true);
|
|
351
364
|
case 3:
|
|
352
365
|
_errorMsg = signal.aborted ? 'start: task is aborted' : 'start: no available access point detected';
|
|
353
|
-
_error = generateApDetectorError(
|
|
366
|
+
_error = generateApDetectorError(DetailErrorCode.AP_DETECT_FAILED, _errorMsg);
|
|
354
367
|
this.logger.error(_errorMsg);
|
|
355
368
|
failure(_error);
|
|
356
369
|
this._apDetectorObserver.notifyObservers(failureNotifyName);
|
|
@@ -361,7 +374,7 @@ export var AgoraRteApDetectorImpl = /*#__PURE__*/function () {
|
|
|
361
374
|
}
|
|
362
375
|
}, _callee3, this);
|
|
363
376
|
}));
|
|
364
|
-
function _executeDetect(
|
|
377
|
+
function _executeDetect(_x, _x2, _x3, _x4, _x5) {
|
|
365
378
|
return _executeDetect2.apply(this, arguments);
|
|
366
379
|
}
|
|
367
380
|
return _executeDetect;
|
|
@@ -419,7 +432,7 @@ export var AgoraRteApDetectorImpl = /*#__PURE__*/function () {
|
|
|
419
432
|
}
|
|
420
433
|
}, _callee4, this);
|
|
421
434
|
}));
|
|
422
|
-
function _runAllDetectTask(
|
|
435
|
+
function _runAllDetectTask(_x6) {
|
|
423
436
|
return _runAllDetectTask2.apply(this, arguments);
|
|
424
437
|
}
|
|
425
438
|
return _runAllDetectTask;
|
|
@@ -445,7 +458,7 @@ export var AgoraRteApDetectorImpl = /*#__PURE__*/function () {
|
|
|
445
458
|
workers = [];
|
|
446
459
|
currentIndex = 0;
|
|
447
460
|
createPromiseWorker = /*#__PURE__*/function () {
|
|
448
|
-
var
|
|
461
|
+
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee5() {
|
|
449
462
|
var url, result, _t;
|
|
450
463
|
return _regeneratorRuntime.wrap(function (_context5) {
|
|
451
464
|
while (1) switch (_context5.prev = _context5.next) {
|
|
@@ -457,6 +470,7 @@ export var AgoraRteApDetectorImpl = /*#__PURE__*/function () {
|
|
|
457
470
|
url = urlList[currentIndex];
|
|
458
471
|
currentIndex++;
|
|
459
472
|
_context5.prev = 1;
|
|
473
|
+
_this.logger.info('start to detect url: ' + url);
|
|
460
474
|
_context5.next = 2;
|
|
461
475
|
return _this._runOnceDetectTask(url);
|
|
462
476
|
case 2:
|
|
@@ -480,7 +494,7 @@ export var AgoraRteApDetectorImpl = /*#__PURE__*/function () {
|
|
|
480
494
|
}, _callee5, null, [[1, 3]]);
|
|
481
495
|
}));
|
|
482
496
|
return function createPromiseWorker() {
|
|
483
|
-
return
|
|
497
|
+
return _ref2.apply(this, arguments);
|
|
484
498
|
};
|
|
485
499
|
}();
|
|
486
500
|
for (i = 0; i < concurrency; i++) {
|
|
@@ -503,7 +517,7 @@ export var AgoraRteApDetectorImpl = /*#__PURE__*/function () {
|
|
|
503
517
|
}
|
|
504
518
|
}, _callee6, this);
|
|
505
519
|
}));
|
|
506
|
-
function _runBatchDetectTask(
|
|
520
|
+
function _runBatchDetectTask(_x7, _x8) {
|
|
507
521
|
return _runBatchDetectTask2.apply(this, arguments);
|
|
508
522
|
}
|
|
509
523
|
return _runBatchDetectTask;
|
|
@@ -535,7 +549,7 @@ export var AgoraRteApDetectorImpl = /*#__PURE__*/function () {
|
|
|
535
549
|
}
|
|
536
550
|
}, _callee7, this);
|
|
537
551
|
}));
|
|
538
|
-
function _runOnceDetectTask(
|
|
552
|
+
function _runOnceDetectTask(_x9) {
|
|
539
553
|
return _runOnceDetectTask2.apply(this, arguments);
|
|
540
554
|
}
|
|
541
555
|
return _runOnceDetectTask;
|
|
@@ -593,7 +607,7 @@ export var AgoraRteApDetectorImpl = /*#__PURE__*/function () {
|
|
|
593
607
|
}
|
|
594
608
|
}, _callee8, null, [[1, 6]]);
|
|
595
609
|
}));
|
|
596
|
-
function _fetchWithTimeoutAndCheck(
|
|
610
|
+
function _fetchWithTimeoutAndCheck(_x0, _x1) {
|
|
597
611
|
return _fetchWithTimeoutAndCheck2.apply(this, arguments);
|
|
598
612
|
}
|
|
599
613
|
return _fetchWithTimeoutAndCheck;
|
|
@@ -657,7 +671,7 @@ export var AgoraRteApDetectorImpl = /*#__PURE__*/function () {
|
|
|
657
671
|
}]);
|
|
658
672
|
}();
|
|
659
673
|
_AgoraRteApDetectorImpl = AgoraRteApDetectorImpl;
|
|
660
|
-
var _applyDecs$e = _applyDecs(_AgoraRteApDetectorImpl, [[trace, 2, "isDetectRequired"], [
|
|
674
|
+
var _applyDecs$e = _applyDecs(_AgoraRteApDetectorImpl, [[trace, 2, "isDetectRequired"], [_restartDecs, 2, "restart"], [_startDecs, 2, "start"], [_executeDetectDecs, 2, "_executeDetect"]], []).e;
|
|
661
675
|
var _applyDecs$e2 = _slicedToArray(_applyDecs$e, 1);
|
|
662
676
|
_initProto = _applyDecs$e2[0];
|
|
663
677
|
_applyDecs$e;
|
|
@@ -4,14 +4,15 @@ import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
|
4
4
|
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
5
5
|
import _createClass from "@babel/runtime/helpers/createClass";
|
|
6
6
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
7
|
-
var
|
|
8
|
-
var _initProto;
|
|
7
|
+
var _AgoraRteEngineImpl;
|
|
8
|
+
var _initProto, _createSceneDecs, _sendPeerMessageDecs, _setParametersDecs, _renewUserTokenDecs, _ref;
|
|
9
9
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
10
10
|
import "core-js/modules/es.symbol.js";
|
|
11
11
|
import "core-js/modules/es.symbol.description.js";
|
|
12
12
|
import "core-js/modules/es.symbol.to-primitive.js";
|
|
13
13
|
import "core-js/modules/es.error.cause.js";
|
|
14
14
|
import "core-js/modules/es.error.to-string.js";
|
|
15
|
+
import "core-js/modules/es.array.concat.js";
|
|
15
16
|
import "core-js/modules/es.array.for-each.js";
|
|
16
17
|
import "core-js/modules/es.array.is-array.js";
|
|
17
18
|
import "core-js/modules/es.array.iterator.js";
|
|
@@ -58,9 +59,9 @@ function _checkInRHS(e) { if (Object(e) !== e) throw TypeError("right-hand side
|
|
|
58
59
|
import { AgoraRteMediaControlImpl } from '../media';
|
|
59
60
|
import { AgoraRequestScheduler, bound, trace } from '../../imports';
|
|
60
61
|
import { cloneDeep } from '../utilities/clone';
|
|
61
|
-
import { AgoraRteConnectionState } from '../../type';
|
|
62
|
-
import { AgoraHttpAuthHeadersProviderImpl } from '../services/auth-headers';
|
|
63
|
-
import {
|
|
62
|
+
import { AgoraRteAudioSourceType, AgoraRteConnectionState, AgoraRteVideoSourceType } from '../../type';
|
|
63
|
+
import { AgoraHttpAuthHeadersProviderImpl, getAuthorization } from '../services/auth-headers';
|
|
64
|
+
import { AgoraRteSceneImpl } from '../scene';
|
|
64
65
|
import { getRegistry } from './registry';
|
|
65
66
|
import { getPluginManager } from './plugin';
|
|
66
67
|
import { AgoraRtmConnectionState } from '../rtm/type';
|
|
@@ -72,21 +73,33 @@ import { getApDetectIsRedetect, getApDetectTimeout, getRtcExternaApConfig, getRt
|
|
|
72
73
|
import { getVersion as _getVersion } from '../utilities/package-info';
|
|
73
74
|
import { AgoraRestfulClientImpl } from '../../plugin/restful-client';
|
|
74
75
|
import { AgoraRteMonitorImpl } from '../../plugin/monitor';
|
|
76
|
+
import { HTTP_HEADER_K_AUTHORIZATION } from '../utilities/constants';
|
|
75
77
|
import { AgoraRteApDetectorImpl } from './ap-detector';
|
|
76
78
|
import { createLogger } from '../utilities/logger';
|
|
79
|
+
import { WeakInvoker } from '../utilities/weak-invoker';
|
|
77
80
|
import { AgoraRteServerMessageCmd } from '../processor/type';
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
81
|
+
import { AgoraRteReturnCode } from '../../constant';
|
|
82
|
+
_ref = (_createSceneDecs = trace(['config']), _sendPeerMessageDecs = trace(['payload', 'cmd', 'guaranteedDelivery', 'receiverId']), _setParametersDecs = trace(['parameters']), _renewUserTokenDecs = trace(['token']), "logger");
|
|
83
|
+
export var AgoraRteEngineImpl = /*#__PURE__*/function () {
|
|
84
|
+
function AgoraRteEngineImpl(config) {
|
|
85
|
+
_classCallCheck(this, AgoraRteEngineImpl);
|
|
86
|
+
_defineProperty(this, _ref, (_initProto(this), createLogger({
|
|
82
87
|
prefix: 'AgoraRteEngine'
|
|
83
88
|
})));
|
|
84
89
|
_defineProperty(this, "_observable", new AgoraObservable());
|
|
90
|
+
_defineProperty(this, "_sceneRefs", new WeakInvoker());
|
|
85
91
|
_defineProperty(this, "_rtmClientObserver", {
|
|
86
92
|
onConnectionStateUpdated: this._handleConnectionStateUpdated.bind(this),
|
|
87
93
|
onPeerMessageReceived: this._handlePeerMessageReceived.bind(this),
|
|
88
94
|
onTokenWillExpire: this._handleTokenWillExpire.bind(this)
|
|
89
95
|
});
|
|
96
|
+
_defineProperty(this, "_sceneObserver", {
|
|
97
|
+
onCheckMediaSourceState: this._handleCheckMediaSourceState.bind(this)
|
|
98
|
+
});
|
|
99
|
+
_defineProperty(this, "_mediaControlObserver", {
|
|
100
|
+
onTrackAudioStateUpdated: this._handleTrackAudioStateUpdated.bind(this),
|
|
101
|
+
onTrackVideoStateUpdated: this._handleTrackVideoStateUpdated.bind(this)
|
|
102
|
+
});
|
|
90
103
|
_defineProperty(this, "_apDetector", this._createDefaultApDetector());
|
|
91
104
|
_defineProperty(this, "_pluginManager", getPluginManager());
|
|
92
105
|
_defineProperty(this, "_requestScheduler", new AgoraRequestScheduler());
|
|
@@ -103,10 +116,10 @@ export var AgoraRteEngine = /*#__PURE__*/function () {
|
|
|
103
116
|
this._rtcClient = getRegistry('web-rtc-client');
|
|
104
117
|
}
|
|
105
118
|
this._rtmClient = getRegistry('rtm-client');
|
|
106
|
-
|
|
107
|
-
this._mediaControl
|
|
119
|
+
this._mediaControl = new AgoraRteMediaControlImpl();
|
|
120
|
+
this._mediaControl.addObserver(this._mediaControlObserver);
|
|
108
121
|
if (this._rtcClient) {
|
|
109
|
-
|
|
122
|
+
this._mediaControl.setRtcClient(this._rtcClient);
|
|
110
123
|
}
|
|
111
124
|
if (this._rtmClient) {
|
|
112
125
|
this._rtmClient.addObserver(this._rtmClientObserver);
|
|
@@ -117,23 +130,22 @@ export var AgoraRteEngine = /*#__PURE__*/function () {
|
|
|
117
130
|
});
|
|
118
131
|
this._restfulClient = new AgoraRestfulClientImpl(this._httpAuthHeadersProvider, getSharedDomainHolder(this._config.rteRegion), this._requestScheduler);
|
|
119
132
|
this._apiService = new AgoraRteServiceApi(this._restfulClient, this._config.appId, this._config.rteRegion, !isEndpointRegionDisabled(config.parameters));
|
|
120
|
-
|
|
133
|
+
this._monitor = new AgoraRteMonitorImpl({
|
|
121
134
|
appId: this._config.appId,
|
|
122
135
|
appVersion: this.getVersion()
|
|
123
136
|
}, this._httpAuthHeadersProvider, this._config.userId, this._apiService);
|
|
124
|
-
this._monitor = monitor;
|
|
125
137
|
if (this._rtcClient) {
|
|
126
|
-
|
|
138
|
+
this._monitor.observeRtcEvents(this._rtcClient);
|
|
127
139
|
}
|
|
128
140
|
if (this._rtmClient) {
|
|
129
|
-
|
|
141
|
+
this._monitor.observeRtmEvents(this._rtmClient);
|
|
130
142
|
}
|
|
131
143
|
this._updateApDetector(config.parameters);
|
|
132
144
|
if (config.parameters) {
|
|
133
145
|
this._initializeParameters(config.parameters);
|
|
134
146
|
}
|
|
135
147
|
}
|
|
136
|
-
return _createClass(
|
|
148
|
+
return _createClass(AgoraRteEngineImpl, [{
|
|
137
149
|
key: "rtcClient",
|
|
138
150
|
get: function get() {
|
|
139
151
|
if (!this._rtcClient) {
|
|
@@ -210,7 +222,7 @@ export var AgoraRteEngine = /*#__PURE__*/function () {
|
|
|
210
222
|
}, {
|
|
211
223
|
key: "createScene",
|
|
212
224
|
value: function createScene(config) {
|
|
213
|
-
var rteScene = new
|
|
225
|
+
var rteScene = new AgoraRteSceneImpl(config.sceneId, {
|
|
214
226
|
rtcClient: this.rtcClient,
|
|
215
227
|
rtmClient: this.rtmClient,
|
|
216
228
|
apDetector: this._apDetector,
|
|
@@ -219,28 +231,18 @@ export var AgoraRteEngine = /*#__PURE__*/function () {
|
|
|
219
231
|
region: this._config.rteRegion,
|
|
220
232
|
userId: this._config.userId
|
|
221
233
|
});
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
onMicrophoneStateUpdated: rteScene.onMicrophoneAudioStateUpdated,
|
|
225
|
-
onLoopbackRecordingStateUpdated: rteScene.onLoopbackAudioStateUpdated,
|
|
226
|
-
onScreenCaptureStateUpdated: rteScene.onScreenCaptureVideoStateUpdated
|
|
227
|
-
});
|
|
234
|
+
rteScene.addObserver(this._sceneObserver);
|
|
235
|
+
this._sceneRefs.add(rteScene);
|
|
228
236
|
return rteScene;
|
|
229
237
|
}
|
|
230
238
|
}, {
|
|
231
239
|
key: "getMediaControl",
|
|
232
240
|
value: function getMediaControl() {
|
|
233
|
-
if (!this._mediaControl) {
|
|
234
|
-
throw new Error('mediaControl is not initialized');
|
|
235
|
-
}
|
|
236
241
|
return this._mediaControl;
|
|
237
242
|
}
|
|
238
243
|
}, {
|
|
239
244
|
key: "getMonitor",
|
|
240
245
|
value: function getMonitor() {
|
|
241
|
-
if (!this._monitor) {
|
|
242
|
-
throw new Error('monitor is not initialized');
|
|
243
|
-
}
|
|
244
246
|
return this._monitor;
|
|
245
247
|
}
|
|
246
248
|
}, {
|
|
@@ -260,6 +262,8 @@ export var AgoraRteEngine = /*#__PURE__*/function () {
|
|
|
260
262
|
}
|
|
261
263
|
});
|
|
262
264
|
case 1:
|
|
265
|
+
return _context3.abrupt("return", AgoraRteReturnCode.SUCCESS);
|
|
266
|
+
case 2:
|
|
263
267
|
case "end":
|
|
264
268
|
return _context3.stop();
|
|
265
269
|
}
|
|
@@ -279,18 +283,26 @@ export var AgoraRteEngine = /*#__PURE__*/function () {
|
|
|
279
283
|
this._setRtcRtmParameters(parameters);
|
|
280
284
|
this._updateApDetector(parameters);
|
|
281
285
|
this._pluginManager.updateParameters(parameters);
|
|
286
|
+
return AgoraRteReturnCode.SUCCESS;
|
|
282
287
|
} catch (e) {
|
|
283
288
|
this.logger.warn('setParameters failed', e);
|
|
289
|
+
return AgoraRteReturnCode.UNDEFINED;
|
|
284
290
|
}
|
|
285
291
|
}
|
|
286
292
|
}, {
|
|
287
293
|
key: "renewUserToken",
|
|
288
294
|
value: function renewUserToken(token) {
|
|
289
|
-
this.
|
|
295
|
+
this._httpAuthHeadersProvider.putHeaders(_defineProperty({}, HTTP_HEADER_K_AUTHORIZATION, getAuthorization(token)));
|
|
296
|
+
return this.rtmClient.renewToken(token);
|
|
290
297
|
}
|
|
291
298
|
}, {
|
|
292
299
|
key: "release",
|
|
293
300
|
value: function release() {
|
|
301
|
+
var _this = this;
|
|
302
|
+
this._sceneRefs.invoke(function (scene) {
|
|
303
|
+
scene.removeObserver(_this._sceneObserver);
|
|
304
|
+
});
|
|
305
|
+
this._sceneRefs.cleanup();
|
|
294
306
|
this._pluginManager.callRelease();
|
|
295
307
|
if (this._monitor) {
|
|
296
308
|
this._monitor.release();
|
|
@@ -299,6 +311,8 @@ export var AgoraRteEngine = /*#__PURE__*/function () {
|
|
|
299
311
|
this._mediaControl.release();
|
|
300
312
|
}
|
|
301
313
|
// restoreConsoleHijack();
|
|
314
|
+
|
|
315
|
+
return AgoraRteReturnCode.SUCCESS;
|
|
302
316
|
}
|
|
303
317
|
}, {
|
|
304
318
|
key: "addObserver",
|
|
@@ -354,21 +368,21 @@ export var AgoraRteEngine = /*#__PURE__*/function () {
|
|
|
354
368
|
}, {
|
|
355
369
|
key: "_handlePeerMessageReceived",
|
|
356
370
|
value: function _handlePeerMessageReceived(userId, message) {
|
|
357
|
-
var
|
|
358
|
-
var
|
|
359
|
-
list =
|
|
360
|
-
fromRoomUuid =
|
|
371
|
+
var _this2 = this;
|
|
372
|
+
var _ref2 = JSON.parse(message),
|
|
373
|
+
list = _ref2.list,
|
|
374
|
+
fromRoomUuid = _ref2.fromRoomUuid;
|
|
361
375
|
if (fromRoomUuid !== undefined) {
|
|
362
376
|
return;
|
|
363
377
|
}
|
|
364
|
-
list.forEach(function (
|
|
365
|
-
var cmd =
|
|
366
|
-
ts =
|
|
367
|
-
|
|
368
|
-
payload =
|
|
369
|
-
fromUser =
|
|
378
|
+
list.forEach(function (_ref3) {
|
|
379
|
+
var cmd = _ref3.cmd,
|
|
380
|
+
ts = _ref3.ts,
|
|
381
|
+
_ref3$data = _ref3.data,
|
|
382
|
+
payload = _ref3$data.payload,
|
|
383
|
+
fromUser = _ref3$data.fromUser;
|
|
370
384
|
if (cmd === AgoraRteServerMessageCmd.MESSAGE_EXTENSION) {
|
|
371
|
-
|
|
385
|
+
_this2._observable.notifyObservers('onPeerMessageReceived', {
|
|
372
386
|
payload: payload,
|
|
373
387
|
timestamp: ts,
|
|
374
388
|
senderId: fromUser.userUuid,
|
|
@@ -389,18 +403,18 @@ export var AgoraRteEngine = /*#__PURE__*/function () {
|
|
|
389
403
|
}, {
|
|
390
404
|
key: "_setRtcRtmParameters",
|
|
391
405
|
value: function _setRtcRtmParameters(parameters) {
|
|
392
|
-
var
|
|
393
|
-
var
|
|
394
|
-
rtc =
|
|
395
|
-
rtm =
|
|
406
|
+
var _this3 = this;
|
|
407
|
+
var _ref4 = parameters,
|
|
408
|
+
rtc = _ref4.rtc,
|
|
409
|
+
rtm = _ref4.rtm;
|
|
396
410
|
if (rtc && this._rtcClient) {
|
|
397
411
|
rtc.forEach(function (param) {
|
|
398
|
-
|
|
412
|
+
_this3.rtcClient.setParameters(param);
|
|
399
413
|
});
|
|
400
414
|
}
|
|
401
415
|
if (rtm && this._rtmClient) {
|
|
402
416
|
rtm.forEach(function (param) {
|
|
403
|
-
|
|
417
|
+
_this3.rtmClient.setParameters(param);
|
|
404
418
|
});
|
|
405
419
|
}
|
|
406
420
|
}
|
|
@@ -441,10 +455,80 @@ export var AgoraRteEngine = /*#__PURE__*/function () {
|
|
|
441
455
|
value: function _createDefaultApDetector() {
|
|
442
456
|
return new AgoraRteApDetectorImpl();
|
|
443
457
|
}
|
|
458
|
+
}, {
|
|
459
|
+
key: "_handleTrackAudioStateUpdated",
|
|
460
|
+
value: function _handleTrackAudioStateUpdated(sourceId, sourceType, state) {
|
|
461
|
+
this._sceneRefs.invoke(function (scene) {
|
|
462
|
+
scene.onTrackAudioStateUpdated(sourceId, sourceType, state);
|
|
463
|
+
});
|
|
464
|
+
}
|
|
465
|
+
}, {
|
|
466
|
+
key: "_handleTrackVideoStateUpdated",
|
|
467
|
+
value: function _handleTrackVideoStateUpdated(sourceId, sourceType, state) {
|
|
468
|
+
this._sceneRefs.invoke(function (scene) {
|
|
469
|
+
scene.onTrackVideoStateUpdated(sourceId, sourceType, state);
|
|
470
|
+
});
|
|
471
|
+
}
|
|
472
|
+
}, {
|
|
473
|
+
key: "_handleCheckMediaSourceState",
|
|
474
|
+
value: function _handleCheckMediaSourceState(sceneId, stream, token) {
|
|
475
|
+
var _this4 = this;
|
|
476
|
+
// Helper function to update stream state
|
|
477
|
+
var updateStreamState = function updateStreamState(sourceId, currentState, sourceType, fieldName, streamType) {
|
|
478
|
+
_this4.logger.info("".concat(streamType, " source state changed for stream ").concat(stream.streamId, ", updating server ").concat(streamType, " source state, ").concat(sourceType, "SourceId: ").concat(sourceId, ", ").concat(sourceType, "SourceState: ").concat(currentState));
|
|
479
|
+
var updateData = {
|
|
480
|
+
roomUuid: sceneId,
|
|
481
|
+
userUuid: stream.owner.userId,
|
|
482
|
+
streamUuid: stream.streamId
|
|
483
|
+
};
|
|
484
|
+
updateData[fieldName] = currentState;
|
|
485
|
+
_this4._apiService.updateStreamWithToken(updateData, token);
|
|
486
|
+
};
|
|
487
|
+
|
|
488
|
+
// Handle microphone audio
|
|
489
|
+
if (stream.audioSourceType === AgoraRteAudioSourceType.MICROPHONE && stream.audioSourceId) {
|
|
490
|
+
var microphoneTrack = this._mediaControl.getMicrophoneTrack(stream.audioSourceId);
|
|
491
|
+
var correctAudioState = microphoneTrack.getState();
|
|
492
|
+
var needUpdateAudioState = correctAudioState !== stream.audioSourceState;
|
|
493
|
+
if (needUpdateAudioState) {
|
|
494
|
+
updateStreamState(stream.audioSourceId, correctAudioState, 'audio', 'audioSourceState', 'audio');
|
|
495
|
+
}
|
|
496
|
+
}
|
|
497
|
+
|
|
498
|
+
// Handle loopback audio
|
|
499
|
+
if (stream.audioSourceType === AgoraRteAudioSourceType.LOOPBACK && stream.audioSourceId) {
|
|
500
|
+
var loopbackTrack = this._mediaControl.getLoopbackTrack(stream.audioSourceId);
|
|
501
|
+
var _correctAudioState = loopbackTrack.getState();
|
|
502
|
+
var _needUpdateAudioState = _correctAudioState !== stream.audioSourceState;
|
|
503
|
+
if (_needUpdateAudioState) {
|
|
504
|
+
updateStreamState(stream.audioSourceId, _correctAudioState, 'audio', 'audioSourceState', 'audio');
|
|
505
|
+
}
|
|
506
|
+
}
|
|
507
|
+
|
|
508
|
+
// Handle camera video
|
|
509
|
+
if (stream.videoSourceType === AgoraRteVideoSourceType.CAMERA && stream.videoSourceId) {
|
|
510
|
+
var cameraTrack = this._mediaControl.getCameraTrack(stream.videoSourceId);
|
|
511
|
+
var correctVideoState = cameraTrack.getState();
|
|
512
|
+
var needUpdateVideoState = correctVideoState !== stream.videoSourceState;
|
|
513
|
+
if (needUpdateVideoState) {
|
|
514
|
+
updateStreamState(stream.videoSourceId, correctVideoState, 'video', 'videoSourceState', 'video');
|
|
515
|
+
}
|
|
516
|
+
}
|
|
517
|
+
|
|
518
|
+
// Handle screen share video
|
|
519
|
+
if (stream.videoSourceType === AgoraRteVideoSourceType.SCREEN && stream.videoSourceId) {
|
|
520
|
+
var screenTrack = this._mediaControl.getScreenTrack(stream.videoSourceId);
|
|
521
|
+
var _correctVideoState = screenTrack.getState();
|
|
522
|
+
var _needUpdateVideoState = _correctVideoState !== stream.videoSourceState;
|
|
523
|
+
if (_needUpdateVideoState) {
|
|
524
|
+
updateStreamState(stream.videoSourceId, _correctVideoState, 'video', 'videoSourceState', 'video');
|
|
525
|
+
}
|
|
526
|
+
}
|
|
527
|
+
}
|
|
444
528
|
}]);
|
|
445
529
|
}();
|
|
446
|
-
|
|
447
|
-
var _applyDecs$e = _applyDecs(
|
|
530
|
+
_AgoraRteEngineImpl = AgoraRteEngineImpl;
|
|
531
|
+
var _applyDecs$e = _applyDecs(_AgoraRteEngineImpl, [[trace, 2, "login"], [trace, 2, "logout"], [_createSceneDecs, 2, "createScene"], [_sendPeerMessageDecs, 2, "sendPeerMessage"], [_setParametersDecs, 2, "setParameters"], [_renewUserTokenDecs, 2, "renewUserToken"], [trace, 2, "release"], [bound, 2, "_updateApDetector"]], []).e;
|
|
448
532
|
var _applyDecs$e2 = _slicedToArray(_applyDecs$e, 1);
|
|
449
533
|
_initProto = _applyDecs$e2[0];
|
|
450
534
|
_applyDecs$e;
|
|
@@ -34,7 +34,7 @@ import "core-js/modules/esnext.set.union.v2.js";
|
|
|
34
34
|
import "core-js/modules/esnext.set.union.js";
|
|
35
35
|
import "core-js/modules/web.dom-collections.for-each.js";
|
|
36
36
|
import "core-js/modules/web.dom-collections.iterator.js";
|
|
37
|
-
import { getLogger } from '
|
|
37
|
+
import { getLogger } from '../utilities/logger';
|
|
38
38
|
var AgoraRtePluginManager = /*#__PURE__*/function () {
|
|
39
39
|
function AgoraRtePluginManager() {
|
|
40
40
|
_classCallCheck(this, AgoraRtePluginManager);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|