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
package/lib/core/engine/index.js
CHANGED
|
@@ -36,10 +36,11 @@ var _typeof = require("@babel/runtime/helpers/typeof");
|
|
|
36
36
|
Object.defineProperty(exports, "__esModule", {
|
|
37
37
|
value: true
|
|
38
38
|
});
|
|
39
|
-
exports.
|
|
39
|
+
exports.AgoraRteEngineImpl = void 0;
|
|
40
40
|
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
41
41
|
require("core-js/modules/es.error.cause.js");
|
|
42
42
|
require("core-js/modules/es.error.to-string.js");
|
|
43
|
+
require("core-js/modules/es.array.concat.js");
|
|
43
44
|
require("core-js/modules/es.array.for-each.js");
|
|
44
45
|
require("core-js/modules/es.date.to-json.js");
|
|
45
46
|
require("core-js/modules/es.function.bind.js");
|
|
@@ -70,28 +71,40 @@ var _parameters = require("../utilities/parameters");
|
|
|
70
71
|
var _packageInfo = require("../utilities/package-info");
|
|
71
72
|
var _restfulClient = require("../../plugin/restful-client");
|
|
72
73
|
var _monitor = require("../../plugin/monitor");
|
|
74
|
+
var _constants = require("../utilities/constants");
|
|
73
75
|
var _apDetector = require("./ap-detector");
|
|
74
76
|
var _logger = require("../utilities/logger");
|
|
77
|
+
var _weakInvoker = require("../utilities/weak-invoker");
|
|
75
78
|
var _type3 = require("../processor/type");
|
|
76
|
-
var
|
|
77
|
-
var
|
|
79
|
+
var _constant = require("../../constant");
|
|
80
|
+
var _AgoraRteEngineImpl;
|
|
81
|
+
var _initProto, _createSceneDecs, _sendPeerMessageDecs, _setParametersDecs, _renewUserTokenDecs, _ref;
|
|
78
82
|
function _applyDecs(e, t, r, n, o, a) { function i(e, t, r) { return function (n, o) { return r && r(n), e[t].call(n, o); }; } function c(e, t) { for (var r = 0; r < e.length; r++) e[r].call(t); return t; } function s(e, t, r, n) { if ("function" != typeof e && (n || void 0 !== e)) throw new TypeError(t + " must " + (r || "be") + " a function" + (n ? "" : " or undefined")); return e; } function applyDec(e, t, r, n, o, a, c, u, l, f, p, d, h) { function m(e) { if (!h(e)) throw new TypeError("Attempted to access private element on non-instance"); } var y, v = t[0], g = t[3], b = !u; if (!b) { r || Array.isArray(v) || (v = [v]); var w = {}, S = [], A = 3 === o ? "get" : 4 === o || d ? "set" : "value"; f ? (p || d ? w = { get: _setFunctionName(function () { return g(this); }, n, "get"), set: function set(e) { t[4](this, e); } } : w[A] = g, p || _setFunctionName(w[A], n, 2 === o ? "" : A)) : p || (w = Object.getOwnPropertyDescriptor(e, n)); } for (var P = e, j = v.length - 1; j >= 0; j -= r ? 2 : 1) { var D = v[j], E = r ? v[j - 1] : void 0, I = {}, O = { kind: ["field", "accessor", "method", "getter", "setter", "class"][o], name: n, metadata: a, addInitializer: function (e, t) { if (e.v) throw Error("attempted to call addInitializer after decoration was finished"); s(t, "An initializer", "be", !0), c.push(t); }.bind(null, I) }; try { if (b) (y = s(D.call(E, P, O), "class decorators", "return")) && (P = y);else { var k, F; O["static"] = l, O["private"] = f, f ? 2 === o ? k = function k(e) { return m(e), w.value; } : (o < 4 && (k = i(w, "get", m)), 3 !== o && (F = i(w, "set", m))) : (k = function k(e) { return e[n]; }, (o < 2 || 4 === o) && (F = function F(e, t) { e[n] = t; })); var N = O.access = { has: f ? h.bind() : function (e) { return n in e; } }; if (k && (N.get = k), F && (N.set = F), P = D.call(E, d ? { get: w.get, set: w.set } : w[A], O), d) { if ("object" == _typeof(P) && P) (y = s(P.get, "accessor.get")) && (w.get = y), (y = s(P.set, "accessor.set")) && (w.set = y), (y = s(P.init, "accessor.init")) && S.push(y);else if (void 0 !== P) throw new TypeError("accessor decorators must return an object with get, set, or init properties or void 0"); } else s(P, (p ? "field" : "method") + " decorators", "return") && (p ? S.push(P) : w[A] = P); } } finally { I.v = !0; } } return (p || d) && u.push(function (e, t) { for (var r = S.length - 1; r >= 0; r--) t = S[r].call(e, t); return t; }), p || b || (f ? d ? u.push(i(w, "get"), i(w, "set")) : u.push(2 === o ? w[A] : i.call.bind(w[A])) : Object.defineProperty(e, n, w)), P; } function u(e, t) { return Object.defineProperty(e, Symbol.metadata || Symbol["for"]("Symbol.metadata"), { configurable: !0, enumerable: !0, value: t }); } if (arguments.length >= 6) var l = a[Symbol.metadata || Symbol["for"]("Symbol.metadata")]; var f = Object.create(null == l ? null : l), p = function (e, t, r, n) { var o, a, i = [], s = function s(t) { return _checkInRHS(t) === e; }, u = new Map(); function l(e) { e && i.push(c.bind(null, e)); } for (var f = 0; f < t.length; f++) { var p = t[f]; if (Array.isArray(p)) { var d = p[1], h = p[2], m = p.length > 3, y = 16 & d, v = !!(8 & d), g = 0 == (d &= 7), b = h + "/" + v; if (!g && !m) { var w = u.get(b); if (!0 === w || 3 === w && 4 !== d || 4 === w && 3 !== d) throw Error("Attempted to decorate a public method/accessor that has the same name as a previously decorated public method/accessor. This is not currently supported by the decorators plugin. Property name was: " + h); u.set(b, !(d > 2) || d); } applyDec(v ? e : e.prototype, p, y, m ? "#" + h : _toPropertyKey(h), d, n, v ? a = a || [] : o = o || [], i, v, m, g, 1 === d, v && m ? s : r); } } return l(o), l(a), i; }(e, t, o, f); return r.length || u(e, f), { e: p, get c() { var t = []; return r.length && [u(applyDec(e, [r], n, e.name, 5, f, t), f), c.bind(null, t, e)]; } }; }
|
|
79
83
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
80
84
|
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
81
85
|
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; }
|
|
82
86
|
function _checkInRHS(e) { if (Object(e) !== e) throw TypeError("right-hand side of 'in' should be an object, got " + (null !== e ? _typeof(e) : "null")); return e; }
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
(0,
|
|
87
|
+
_ref = (_createSceneDecs = (0, _imports.trace)(['config']), _sendPeerMessageDecs = (0, _imports.trace)(['payload', 'cmd', 'guaranteedDelivery', 'receiverId']), _setParametersDecs = (0, _imports.trace)(['parameters']), _renewUserTokenDecs = (0, _imports.trace)(['token']), "logger");
|
|
88
|
+
var AgoraRteEngineImpl = exports.AgoraRteEngineImpl = /*#__PURE__*/function () {
|
|
89
|
+
function AgoraRteEngineImpl(config) {
|
|
90
|
+
(0, _classCallCheck2["default"])(this, AgoraRteEngineImpl);
|
|
91
|
+
(0, _defineProperty2["default"])(this, _ref, (_initProto(this), (0, _logger.createLogger)({
|
|
87
92
|
prefix: 'AgoraRteEngine'
|
|
88
93
|
})));
|
|
89
94
|
(0, _defineProperty2["default"])(this, "_observable", new _imports.AgoraObservable());
|
|
95
|
+
(0, _defineProperty2["default"])(this, "_sceneRefs", new _weakInvoker.WeakInvoker());
|
|
90
96
|
(0, _defineProperty2["default"])(this, "_rtmClientObserver", {
|
|
91
97
|
onConnectionStateUpdated: this._handleConnectionStateUpdated.bind(this),
|
|
92
98
|
onPeerMessageReceived: this._handlePeerMessageReceived.bind(this),
|
|
93
99
|
onTokenWillExpire: this._handleTokenWillExpire.bind(this)
|
|
94
100
|
});
|
|
101
|
+
(0, _defineProperty2["default"])(this, "_sceneObserver", {
|
|
102
|
+
onCheckMediaSourceState: this._handleCheckMediaSourceState.bind(this)
|
|
103
|
+
});
|
|
104
|
+
(0, _defineProperty2["default"])(this, "_mediaControlObserver", {
|
|
105
|
+
onTrackAudioStateUpdated: this._handleTrackAudioStateUpdated.bind(this),
|
|
106
|
+
onTrackVideoStateUpdated: this._handleTrackVideoStateUpdated.bind(this)
|
|
107
|
+
});
|
|
95
108
|
(0, _defineProperty2["default"])(this, "_apDetector", this._createDefaultApDetector());
|
|
96
109
|
(0, _defineProperty2["default"])(this, "_pluginManager", (0, _plugin.getPluginManager)());
|
|
97
110
|
(0, _defineProperty2["default"])(this, "_requestScheduler", new _imports.AgoraRequestScheduler());
|
|
@@ -108,10 +121,10 @@ var AgoraRteEngine = exports.AgoraRteEngine = /*#__PURE__*/function () {
|
|
|
108
121
|
this._rtcClient = (0, _registry.getRegistry)('web-rtc-client');
|
|
109
122
|
}
|
|
110
123
|
this._rtmClient = (0, _registry.getRegistry)('rtm-client');
|
|
111
|
-
|
|
112
|
-
this._mediaControl
|
|
124
|
+
this._mediaControl = new _media.AgoraRteMediaControlImpl();
|
|
125
|
+
this._mediaControl.addObserver(this._mediaControlObserver);
|
|
113
126
|
if (this._rtcClient) {
|
|
114
|
-
|
|
127
|
+
this._mediaControl.setRtcClient(this._rtcClient);
|
|
115
128
|
}
|
|
116
129
|
if (this._rtmClient) {
|
|
117
130
|
this._rtmClient.addObserver(this._rtmClientObserver);
|
|
@@ -122,23 +135,22 @@ var AgoraRteEngine = exports.AgoraRteEngine = /*#__PURE__*/function () {
|
|
|
122
135
|
});
|
|
123
136
|
this._restfulClient = new _restfulClient.AgoraRestfulClientImpl(this._httpAuthHeadersProvider, (0, _domainHolder.getSharedDomainHolder)(this._config.rteRegion), this._requestScheduler);
|
|
124
137
|
this._apiService = new _api.AgoraRteServiceApi(this._restfulClient, this._config.appId, this._config.rteRegion, !(0, _parameters.isEndpointRegionDisabled)(config.parameters));
|
|
125
|
-
|
|
138
|
+
this._monitor = new _monitor.AgoraRteMonitorImpl({
|
|
126
139
|
appId: this._config.appId,
|
|
127
140
|
appVersion: this.getVersion()
|
|
128
141
|
}, this._httpAuthHeadersProvider, this._config.userId, this._apiService);
|
|
129
|
-
this._monitor = monitor;
|
|
130
142
|
if (this._rtcClient) {
|
|
131
|
-
|
|
143
|
+
this._monitor.observeRtcEvents(this._rtcClient);
|
|
132
144
|
}
|
|
133
145
|
if (this._rtmClient) {
|
|
134
|
-
|
|
146
|
+
this._monitor.observeRtmEvents(this._rtmClient);
|
|
135
147
|
}
|
|
136
148
|
this._updateApDetector(config.parameters);
|
|
137
149
|
if (config.parameters) {
|
|
138
150
|
this._initializeParameters(config.parameters);
|
|
139
151
|
}
|
|
140
152
|
}
|
|
141
|
-
return (0, _createClass2["default"])(
|
|
153
|
+
return (0, _createClass2["default"])(AgoraRteEngineImpl, [{
|
|
142
154
|
key: "rtcClient",
|
|
143
155
|
get: function get() {
|
|
144
156
|
if (!this._rtcClient) {
|
|
@@ -215,7 +227,7 @@ var AgoraRteEngine = exports.AgoraRteEngine = /*#__PURE__*/function () {
|
|
|
215
227
|
}, {
|
|
216
228
|
key: "createScene",
|
|
217
229
|
value: function createScene(config) {
|
|
218
|
-
var rteScene = new _scene.
|
|
230
|
+
var rteScene = new _scene.AgoraRteSceneImpl(config.sceneId, {
|
|
219
231
|
rtcClient: this.rtcClient,
|
|
220
232
|
rtmClient: this.rtmClient,
|
|
221
233
|
apDetector: this._apDetector,
|
|
@@ -224,28 +236,18 @@ var AgoraRteEngine = exports.AgoraRteEngine = /*#__PURE__*/function () {
|
|
|
224
236
|
region: this._config.rteRegion,
|
|
225
237
|
userId: this._config.userId
|
|
226
238
|
});
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
onMicrophoneStateUpdated: rteScene.onMicrophoneAudioStateUpdated,
|
|
230
|
-
onLoopbackRecordingStateUpdated: rteScene.onLoopbackAudioStateUpdated,
|
|
231
|
-
onScreenCaptureStateUpdated: rteScene.onScreenCaptureVideoStateUpdated
|
|
232
|
-
});
|
|
239
|
+
rteScene.addObserver(this._sceneObserver);
|
|
240
|
+
this._sceneRefs.add(rteScene);
|
|
233
241
|
return rteScene;
|
|
234
242
|
}
|
|
235
243
|
}, {
|
|
236
244
|
key: "getMediaControl",
|
|
237
245
|
value: function getMediaControl() {
|
|
238
|
-
if (!this._mediaControl) {
|
|
239
|
-
throw new Error('mediaControl is not initialized');
|
|
240
|
-
}
|
|
241
246
|
return this._mediaControl;
|
|
242
247
|
}
|
|
243
248
|
}, {
|
|
244
249
|
key: "getMonitor",
|
|
245
250
|
value: function getMonitor() {
|
|
246
|
-
if (!this._monitor) {
|
|
247
|
-
throw new Error('monitor is not initialized');
|
|
248
|
-
}
|
|
249
251
|
return this._monitor;
|
|
250
252
|
}
|
|
251
253
|
}, {
|
|
@@ -265,6 +267,8 @@ var AgoraRteEngine = exports.AgoraRteEngine = /*#__PURE__*/function () {
|
|
|
265
267
|
}
|
|
266
268
|
});
|
|
267
269
|
case 1:
|
|
270
|
+
return _context3.abrupt("return", _constant.AgoraRteReturnCode.SUCCESS);
|
|
271
|
+
case 2:
|
|
268
272
|
case "end":
|
|
269
273
|
return _context3.stop();
|
|
270
274
|
}
|
|
@@ -284,18 +288,26 @@ var AgoraRteEngine = exports.AgoraRteEngine = /*#__PURE__*/function () {
|
|
|
284
288
|
this._setRtcRtmParameters(parameters);
|
|
285
289
|
this._updateApDetector(parameters);
|
|
286
290
|
this._pluginManager.updateParameters(parameters);
|
|
291
|
+
return _constant.AgoraRteReturnCode.SUCCESS;
|
|
287
292
|
} catch (e) {
|
|
288
293
|
this.logger.warn('setParameters failed', e);
|
|
294
|
+
return _constant.AgoraRteReturnCode.UNDEFINED;
|
|
289
295
|
}
|
|
290
296
|
}
|
|
291
297
|
}, {
|
|
292
298
|
key: "renewUserToken",
|
|
293
299
|
value: function renewUserToken(token) {
|
|
294
|
-
this.
|
|
300
|
+
this._httpAuthHeadersProvider.putHeaders((0, _defineProperty2["default"])({}, _constants.HTTP_HEADER_K_AUTHORIZATION, (0, _authHeaders.getAuthorization)(token)));
|
|
301
|
+
return this.rtmClient.renewToken(token);
|
|
295
302
|
}
|
|
296
303
|
}, {
|
|
297
304
|
key: "release",
|
|
298
305
|
value: function release() {
|
|
306
|
+
var _this = this;
|
|
307
|
+
this._sceneRefs.invoke(function (scene) {
|
|
308
|
+
scene.removeObserver(_this._sceneObserver);
|
|
309
|
+
});
|
|
310
|
+
this._sceneRefs.cleanup();
|
|
299
311
|
this._pluginManager.callRelease();
|
|
300
312
|
if (this._monitor) {
|
|
301
313
|
this._monitor.release();
|
|
@@ -304,6 +316,8 @@ var AgoraRteEngine = exports.AgoraRteEngine = /*#__PURE__*/function () {
|
|
|
304
316
|
this._mediaControl.release();
|
|
305
317
|
}
|
|
306
318
|
// restoreConsoleHijack();
|
|
319
|
+
|
|
320
|
+
return _constant.AgoraRteReturnCode.SUCCESS;
|
|
307
321
|
}
|
|
308
322
|
}, {
|
|
309
323
|
key: "addObserver",
|
|
@@ -359,21 +373,21 @@ var AgoraRteEngine = exports.AgoraRteEngine = /*#__PURE__*/function () {
|
|
|
359
373
|
}, {
|
|
360
374
|
key: "_handlePeerMessageReceived",
|
|
361
375
|
value: function _handlePeerMessageReceived(userId, message) {
|
|
362
|
-
var
|
|
363
|
-
var
|
|
364
|
-
list =
|
|
365
|
-
fromRoomUuid =
|
|
376
|
+
var _this2 = this;
|
|
377
|
+
var _ref2 = JSON.parse(message),
|
|
378
|
+
list = _ref2.list,
|
|
379
|
+
fromRoomUuid = _ref2.fromRoomUuid;
|
|
366
380
|
if (fromRoomUuid !== undefined) {
|
|
367
381
|
return;
|
|
368
382
|
}
|
|
369
|
-
list.forEach(function (
|
|
370
|
-
var cmd =
|
|
371
|
-
ts =
|
|
372
|
-
|
|
373
|
-
payload =
|
|
374
|
-
fromUser =
|
|
383
|
+
list.forEach(function (_ref3) {
|
|
384
|
+
var cmd = _ref3.cmd,
|
|
385
|
+
ts = _ref3.ts,
|
|
386
|
+
_ref3$data = _ref3.data,
|
|
387
|
+
payload = _ref3$data.payload,
|
|
388
|
+
fromUser = _ref3$data.fromUser;
|
|
375
389
|
if (cmd === _type3.AgoraRteServerMessageCmd.MESSAGE_EXTENSION) {
|
|
376
|
-
|
|
390
|
+
_this2._observable.notifyObservers('onPeerMessageReceived', {
|
|
377
391
|
payload: payload,
|
|
378
392
|
timestamp: ts,
|
|
379
393
|
senderId: fromUser.userUuid,
|
|
@@ -394,18 +408,18 @@ var AgoraRteEngine = exports.AgoraRteEngine = /*#__PURE__*/function () {
|
|
|
394
408
|
}, {
|
|
395
409
|
key: "_setRtcRtmParameters",
|
|
396
410
|
value: function _setRtcRtmParameters(parameters) {
|
|
397
|
-
var
|
|
398
|
-
var
|
|
399
|
-
rtc =
|
|
400
|
-
rtm =
|
|
411
|
+
var _this3 = this;
|
|
412
|
+
var _ref4 = parameters,
|
|
413
|
+
rtc = _ref4.rtc,
|
|
414
|
+
rtm = _ref4.rtm;
|
|
401
415
|
if (rtc && this._rtcClient) {
|
|
402
416
|
rtc.forEach(function (param) {
|
|
403
|
-
|
|
417
|
+
_this3.rtcClient.setParameters(param);
|
|
404
418
|
});
|
|
405
419
|
}
|
|
406
420
|
if (rtm && this._rtmClient) {
|
|
407
421
|
rtm.forEach(function (param) {
|
|
408
|
-
|
|
422
|
+
_this3.rtmClient.setParameters(param);
|
|
409
423
|
});
|
|
410
424
|
}
|
|
411
425
|
}
|
|
@@ -446,10 +460,80 @@ var AgoraRteEngine = exports.AgoraRteEngine = /*#__PURE__*/function () {
|
|
|
446
460
|
value: function _createDefaultApDetector() {
|
|
447
461
|
return new _apDetector.AgoraRteApDetectorImpl();
|
|
448
462
|
}
|
|
463
|
+
}, {
|
|
464
|
+
key: "_handleTrackAudioStateUpdated",
|
|
465
|
+
value: function _handleTrackAudioStateUpdated(sourceId, sourceType, state) {
|
|
466
|
+
this._sceneRefs.invoke(function (scene) {
|
|
467
|
+
scene.onTrackAudioStateUpdated(sourceId, sourceType, state);
|
|
468
|
+
});
|
|
469
|
+
}
|
|
470
|
+
}, {
|
|
471
|
+
key: "_handleTrackVideoStateUpdated",
|
|
472
|
+
value: function _handleTrackVideoStateUpdated(sourceId, sourceType, state) {
|
|
473
|
+
this._sceneRefs.invoke(function (scene) {
|
|
474
|
+
scene.onTrackVideoStateUpdated(sourceId, sourceType, state);
|
|
475
|
+
});
|
|
476
|
+
}
|
|
477
|
+
}, {
|
|
478
|
+
key: "_handleCheckMediaSourceState",
|
|
479
|
+
value: function _handleCheckMediaSourceState(sceneId, stream, token) {
|
|
480
|
+
var _this4 = this;
|
|
481
|
+
// Helper function to update stream state
|
|
482
|
+
var updateStreamState = function updateStreamState(sourceId, currentState, sourceType, fieldName, streamType) {
|
|
483
|
+
_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));
|
|
484
|
+
var updateData = {
|
|
485
|
+
roomUuid: sceneId,
|
|
486
|
+
userUuid: stream.owner.userId,
|
|
487
|
+
streamUuid: stream.streamId
|
|
488
|
+
};
|
|
489
|
+
updateData[fieldName] = currentState;
|
|
490
|
+
_this4._apiService.updateStreamWithToken(updateData, token);
|
|
491
|
+
};
|
|
492
|
+
|
|
493
|
+
// Handle microphone audio
|
|
494
|
+
if (stream.audioSourceType === _type.AgoraRteAudioSourceType.MICROPHONE && stream.audioSourceId) {
|
|
495
|
+
var microphoneTrack = this._mediaControl.getMicrophoneTrack(stream.audioSourceId);
|
|
496
|
+
var correctAudioState = microphoneTrack.getState();
|
|
497
|
+
var needUpdateAudioState = correctAudioState !== stream.audioSourceState;
|
|
498
|
+
if (needUpdateAudioState) {
|
|
499
|
+
updateStreamState(stream.audioSourceId, correctAudioState, 'audio', 'audioSourceState', 'audio');
|
|
500
|
+
}
|
|
501
|
+
}
|
|
502
|
+
|
|
503
|
+
// Handle loopback audio
|
|
504
|
+
if (stream.audioSourceType === _type.AgoraRteAudioSourceType.LOOPBACK && stream.audioSourceId) {
|
|
505
|
+
var loopbackTrack = this._mediaControl.getLoopbackTrack(stream.audioSourceId);
|
|
506
|
+
var _correctAudioState = loopbackTrack.getState();
|
|
507
|
+
var _needUpdateAudioState = _correctAudioState !== stream.audioSourceState;
|
|
508
|
+
if (_needUpdateAudioState) {
|
|
509
|
+
updateStreamState(stream.audioSourceId, _correctAudioState, 'audio', 'audioSourceState', 'audio');
|
|
510
|
+
}
|
|
511
|
+
}
|
|
512
|
+
|
|
513
|
+
// Handle camera video
|
|
514
|
+
if (stream.videoSourceType === _type.AgoraRteVideoSourceType.CAMERA && stream.videoSourceId) {
|
|
515
|
+
var cameraTrack = this._mediaControl.getCameraTrack(stream.videoSourceId);
|
|
516
|
+
var correctVideoState = cameraTrack.getState();
|
|
517
|
+
var needUpdateVideoState = correctVideoState !== stream.videoSourceState;
|
|
518
|
+
if (needUpdateVideoState) {
|
|
519
|
+
updateStreamState(stream.videoSourceId, correctVideoState, 'video', 'videoSourceState', 'video');
|
|
520
|
+
}
|
|
521
|
+
}
|
|
522
|
+
|
|
523
|
+
// Handle screen share video
|
|
524
|
+
if (stream.videoSourceType === _type.AgoraRteVideoSourceType.SCREEN && stream.videoSourceId) {
|
|
525
|
+
var screenTrack = this._mediaControl.getScreenTrack(stream.videoSourceId);
|
|
526
|
+
var _correctVideoState = screenTrack.getState();
|
|
527
|
+
var _needUpdateVideoState = _correctVideoState !== stream.videoSourceState;
|
|
528
|
+
if (_needUpdateVideoState) {
|
|
529
|
+
updateStreamState(stream.videoSourceId, _correctVideoState, 'video', 'videoSourceState', 'video');
|
|
530
|
+
}
|
|
531
|
+
}
|
|
532
|
+
}
|
|
449
533
|
}]);
|
|
450
534
|
}();
|
|
451
|
-
|
|
452
|
-
var _applyDecs$e = _applyDecs(
|
|
535
|
+
_AgoraRteEngineImpl = AgoraRteEngineImpl;
|
|
536
|
+
var _applyDecs$e = _applyDecs(_AgoraRteEngineImpl, [[_imports.trace, 2, "login"], [_imports.trace, 2, "logout"], [_createSceneDecs, 2, "createScene"], [_sendPeerMessageDecs, 2, "sendPeerMessage"], [_setParametersDecs, 2, "setParameters"], [_renewUserTokenDecs, 2, "renewUserToken"], [_imports.trace, 2, "release"], [_imports.bound, 2, "_updateApDetector"]], []).e;
|
|
453
537
|
var _applyDecs$e2 = (0, _slicedToArray2["default"])(_applyDecs$e, 1);
|
|
454
538
|
_initProto = _applyDecs$e2[0];
|
|
455
539
|
_applyDecs$e;
|
|
@@ -42,7 +42,7 @@ require("core-js/modules/web.dom-collections.iterator.js");
|
|
|
42
42
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
43
43
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
44
44
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
45
|
-
var
|
|
45
|
+
var _logger = require("../utilities/logger");
|
|
46
46
|
var AgoraRtePluginManager = /*#__PURE__*/function () {
|
|
47
47
|
function AgoraRtePluginManager() {
|
|
48
48
|
(0, _classCallCheck2["default"])(this, AgoraRtePluginManager);
|
|
@@ -86,7 +86,7 @@ var getPluginManager = exports.getPluginManager = function getPluginManager() {
|
|
|
86
86
|
return pluginManager;
|
|
87
87
|
};
|
|
88
88
|
var registerPlugin = exports.registerPlugin = function registerPlugin(plugin) {
|
|
89
|
-
var logger = (0,
|
|
89
|
+
var logger = (0, _logger.getLogger)();
|
|
90
90
|
logger.info('Register plugin:', plugin.name);
|
|
91
91
|
getPluginManager().registerPlugin(plugin);
|
|
92
92
|
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { AgoraRteReturnCode } from '../../constant';
|
|
2
|
+
import { AgoraRequestScheduler } from '../../imports';
|
|
3
|
+
import { AgoraRteConnectionState, AgoraRteMessage, AgoraRteSceneConfig } from '../../type';
|
|
4
|
+
import { AgoraRteMediaControl } from '../media/type';
|
|
5
|
+
import { AgoraRteMonitor } from '../monitor';
|
|
6
|
+
import { AgoraRteScene } from '../scene/type';
|
|
7
|
+
import { AgoraHttpAuthHeadersProvider } from '../services/type';
|
|
8
|
+
export interface AgoraRteEngineObserver {
|
|
9
|
+
onPeerMessageReceived?(message: AgoraRteMessage): void;
|
|
10
|
+
onConnectionStateUpdated?(state: AgoraRteConnectionState): void;
|
|
11
|
+
onUserTokenWillExpire?(): void;
|
|
12
|
+
}
|
|
13
|
+
export interface AgoraRteEngine {
|
|
14
|
+
login(): Promise<void>;
|
|
15
|
+
logout(): void;
|
|
16
|
+
getVersion(): string;
|
|
17
|
+
getDependencyVersions(): Record<string, string>;
|
|
18
|
+
createScene(config: AgoraRteSceneConfig): AgoraRteScene;
|
|
19
|
+
getMediaControl(): AgoraRteMediaControl;
|
|
20
|
+
getMonitor(): AgoraRteMonitor;
|
|
21
|
+
sendPeerMessage(payload: Record<string, unknown>, cmd: string, guaranteedDelivery: boolean, receiverId: string): Promise<AgoraRteReturnCode>;
|
|
22
|
+
setParameters(parameters: Record<string, unknown>): AgoraRteReturnCode;
|
|
23
|
+
renewUserToken(token: string): Promise<AgoraRteReturnCode>;
|
|
24
|
+
getHttpAuthHeadersProvider(): AgoraHttpAuthHeadersProvider;
|
|
25
|
+
getRequestScheduler(): AgoraRequestScheduler;
|
|
26
|
+
release(): void;
|
|
27
|
+
addObserver(observer: AgoraRteEngineObserver): void;
|
|
28
|
+
removeObserver(observer: AgoraRteEngineObserver): void;
|
|
29
|
+
}
|
|
@@ -23,35 +23,35 @@ export interface AgoraRteCameraTrack extends AgoraRteObservableTrack<AgoraRteCam
|
|
|
23
23
|
/**
|
|
24
24
|
* Starts the camera.
|
|
25
25
|
*/
|
|
26
|
-
start():
|
|
26
|
+
start(): number;
|
|
27
27
|
/**
|
|
28
28
|
* Stops the camera.
|
|
29
29
|
*/
|
|
30
|
-
stop():
|
|
30
|
+
stop(): number;
|
|
31
31
|
/**
|
|
32
32
|
* Starts the camera preview with the specified configuration and view.
|
|
33
33
|
* @param config The configuration for the video render.
|
|
34
34
|
* @param view The HTML element to render the video on.
|
|
35
35
|
*/
|
|
36
|
-
startPreview(config: AgoraRteVideoRenderConfig, view: unknown):
|
|
36
|
+
startPreview(config: AgoraRteVideoRenderConfig, view: unknown): number;
|
|
37
37
|
/**
|
|
38
38
|
* Stops the camera preview.
|
|
39
39
|
* @param view The HTML element to render the video on.
|
|
40
40
|
*/
|
|
41
|
-
stopPreview(view: unknown):
|
|
41
|
+
stopPreview(view: unknown): number;
|
|
42
42
|
/**
|
|
43
43
|
* Starts the camera test.
|
|
44
44
|
*/
|
|
45
|
-
startTest():
|
|
45
|
+
startTest(): number;
|
|
46
46
|
/**
|
|
47
47
|
* Stops the camera test.
|
|
48
48
|
*/
|
|
49
|
-
stopTest():
|
|
49
|
+
stopTest(): number;
|
|
50
50
|
/**
|
|
51
51
|
* Sets the capture parameters for the camera.
|
|
52
52
|
* @param params The parameters for the video capture.
|
|
53
53
|
*/
|
|
54
|
-
setCaptureParams(params: AgoraRteCameraCaptureParams):
|
|
54
|
+
setCaptureParams(params: AgoraRteCameraCaptureParams): number;
|
|
55
55
|
/**
|
|
56
56
|
* Switches the camera position.
|
|
57
57
|
* @returns The new camera position.
|
|
@@ -71,5 +71,5 @@ export interface AgoraRteCameraTrack extends AgoraRteObservableTrack<AgoraRteCam
|
|
|
71
71
|
* Sets the video orientation for the camera track.
|
|
72
72
|
* @param orientation The orientation to set.
|
|
73
73
|
*/
|
|
74
|
-
setVideoOrientation(orientation: AgoraRteVideoOrientation):
|
|
74
|
+
setVideoOrientation(orientation: AgoraRteVideoOrientation): number;
|
|
75
75
|
}
|
package/lib/core/media/camera.js
CHANGED
|
@@ -56,7 +56,7 @@ var _effectEnhancer = require("./effect-enhancer");
|
|
|
56
56
|
var _logger = require("../utilities/logger");
|
|
57
57
|
var _imports = require("../../imports");
|
|
58
58
|
var _ref, _AgoraRteCameraTrackImpl;
|
|
59
|
-
var _initProto;
|
|
59
|
+
var _initProto, _startPreviewDecs, _stopPreviewDecs, _setCaptureParamsDecs, _setVideoOrientationDecs, _ref2;
|
|
60
60
|
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)); }
|
|
61
61
|
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
62
62
|
function _applyDecs(e, t, r, n, o, a) { function i(e, t, r) { return function (n, o) { return r && r(n), e[t].call(n, o); }; } function c(e, t) { for (var r = 0; r < e.length; r++) e[r].call(t); return t; } function s(e, t, r, n) { if ("function" != typeof e && (n || void 0 !== e)) throw new TypeError(t + " must " + (r || "be") + " a function" + (n ? "" : " or undefined")); return e; } function applyDec(e, t, r, n, o, a, c, u, l, f, p, d, h) { function m(e) { if (!h(e)) throw new TypeError("Attempted to access private element on non-instance"); } var y, v = t[0], g = t[3], b = !u; if (!b) { r || Array.isArray(v) || (v = [v]); var w = {}, S = [], A = 3 === o ? "get" : 4 === o || d ? "set" : "value"; f ? (p || d ? w = { get: _setFunctionName(function () { return g(this); }, n, "get"), set: function set(e) { t[4](this, e); } } : w[A] = g, p || _setFunctionName(w[A], n, 2 === o ? "" : A)) : p || (w = Object.getOwnPropertyDescriptor(e, n)); } for (var P = e, j = v.length - 1; j >= 0; j -= r ? 2 : 1) { var D = v[j], E = r ? v[j - 1] : void 0, I = {}, O = { kind: ["field", "accessor", "method", "getter", "setter", "class"][o], name: n, metadata: a, addInitializer: function (e, t) { if (e.v) throw Error("attempted to call addInitializer after decoration was finished"); s(t, "An initializer", "be", !0), c.push(t); }.bind(null, I) }; try { if (b) (y = s(D.call(E, P, O), "class decorators", "return")) && (P = y);else { var k, F; O["static"] = l, O["private"] = f, f ? 2 === o ? k = function k(e) { return m(e), w.value; } : (o < 4 && (k = i(w, "get", m)), 3 !== o && (F = i(w, "set", m))) : (k = function k(e) { return e[n]; }, (o < 2 || 4 === o) && (F = function F(e, t) { e[n] = t; })); var N = O.access = { has: f ? h.bind() : function (e) { return n in e; } }; if (k && (N.get = k), F && (N.set = F), P = D.call(E, d ? { get: w.get, set: w.set } : w[A], O), d) { if ("object" == _typeof(P) && P) (y = s(P.get, "accessor.get")) && (w.get = y), (y = s(P.set, "accessor.set")) && (w.set = y), (y = s(P.init, "accessor.init")) && S.push(y);else if (void 0 !== P) throw new TypeError("accessor decorators must return an object with get, set, or init properties or void 0"); } else s(P, (p ? "field" : "method") + " decorators", "return") && (p ? S.push(P) : w[A] = P); } } finally { I.v = !0; } } return (p || d) && u.push(function (e, t) { for (var r = S.length - 1; r >= 0; r--) t = S[r].call(e, t); return t; }), p || b || (f ? d ? u.push(i(w, "get"), i(w, "set")) : u.push(2 === o ? w[A] : i.call.bind(w[A])) : Object.defineProperty(e, n, w)), P; } function u(e, t) { return Object.defineProperty(e, Symbol.metadata || Symbol["for"]("Symbol.metadata"), { configurable: !0, enumerable: !0, value: t }); } if (arguments.length >= 6) var l = a[Symbol.metadata || Symbol["for"]("Symbol.metadata")]; var f = Object.create(null == l ? null : l), p = function (e, t, r, n) { var o, a, i = [], s = function s(t) { return _checkInRHS(t) === e; }, u = new Map(); function l(e) { e && i.push(c.bind(null, e)); } for (var f = 0; f < t.length; f++) { var p = t[f]; if (Array.isArray(p)) { var d = p[1], h = p[2], m = p.length > 3, y = 16 & d, v = !!(8 & d), g = 0 == (d &= 7), b = h + "/" + v; if (!g && !m) { var w = u.get(b); if (!0 === w || 3 === w && 4 !== d || 4 === w && 3 !== d) throw Error("Attempted to decorate a public method/accessor that has the same name as a previously decorated public method/accessor. This is not currently supported by the decorators plugin. Property name was: " + h); u.set(b, !(d > 2) || d); } applyDec(v ? e : e.prototype, p, y, m ? "#" + h : _toPropertyKey(h), d, n, v ? a = a || [] : o = o || [], i, v, m, g, 1 === d, v && m ? s : r); } } return l(o), l(a), i; }(e, t, o, f); return r.length || u(e, f), { e: p, get c() { var t = []; return r.length && [u(applyDec(e, [r], n, e.name, 5, f, t), f), c.bind(null, t, e)]; } }; }
|
|
@@ -67,13 +67,14 @@ function _checkInRHS(e) { if (Object(e) !== e) throw TypeError("right-hand side
|
|
|
67
67
|
/**
|
|
68
68
|
* Interface for a video track from a camera in Agora RTE SDK.
|
|
69
69
|
*/
|
|
70
|
+
_ref2 = (_startPreviewDecs = (0, _imports.trace)(['config', 'view']), _stopPreviewDecs = (0, _imports.trace)(['view']), _setCaptureParamsDecs = (0, _imports.trace)(['params']), _setVideoOrientationDecs = (0, _imports.trace)(['orientation']), "logger");
|
|
70
71
|
//@internal
|
|
71
|
-
var AgoraRteCameraTrackImpl = exports.AgoraRteCameraTrackImpl = /*#__PURE__*/function (
|
|
72
|
+
var AgoraRteCameraTrackImpl = exports.AgoraRteCameraTrackImpl = /*#__PURE__*/function (_ref3) {
|
|
72
73
|
function AgoraRteCameraTrackImpl(_rtcClient, _deviceId) {
|
|
73
74
|
var _this;
|
|
74
75
|
(0, _classCallCheck2["default"])(this, AgoraRteCameraTrackImpl);
|
|
75
76
|
_this = _callSuper(this, AgoraRteCameraTrackImpl, [_rtcClient]);
|
|
76
|
-
(0, _defineProperty2["default"])(_this,
|
|
77
|
+
(0, _defineProperty2["default"])(_this, _ref2, (_initProto(_this), (0, _logger.createLogger)({
|
|
77
78
|
prefix: 'AgoraRteCameraTrackImpl'
|
|
78
79
|
})));
|
|
79
80
|
(0, _defineProperty2["default"])(_this, "_state", _type.AgoraRteMediaSourceState.CLOSE);
|
|
@@ -84,7 +85,7 @@ var AgoraRteCameraTrackImpl = exports.AgoraRteCameraTrackImpl = /*#__PURE__*/fun
|
|
|
84
85
|
});
|
|
85
86
|
return _this;
|
|
86
87
|
}
|
|
87
|
-
(0, _inherits2["default"])(AgoraRteCameraTrackImpl,
|
|
88
|
+
(0, _inherits2["default"])(AgoraRteCameraTrackImpl, _ref3);
|
|
88
89
|
return (0, _createClass2["default"])(AgoraRteCameraTrackImpl, [{
|
|
89
90
|
key: "getVideoEffectEnhancer",
|
|
90
91
|
value: function getVideoEffectEnhancer() {
|
|
@@ -119,42 +120,42 @@ var AgoraRteCameraTrackImpl = exports.AgoraRteCameraTrackImpl = /*#__PURE__*/fun
|
|
|
119
120
|
}, {
|
|
120
121
|
key: "start",
|
|
121
122
|
value: function start() {
|
|
122
|
-
this._rtcClient.sourceManager.openCamera(this._deviceId);
|
|
123
|
+
return this._rtcClient.sourceManager.openCamera(this._deviceId);
|
|
123
124
|
}
|
|
124
125
|
}, {
|
|
125
126
|
key: "stop",
|
|
126
127
|
value: function stop() {
|
|
127
|
-
this._rtcClient.sourceManager.closeCamera(this._deviceId);
|
|
128
|
+
return this._rtcClient.sourceManager.closeCamera(this._deviceId);
|
|
128
129
|
}
|
|
129
130
|
}, {
|
|
130
131
|
key: "startPreview",
|
|
131
132
|
value: function startPreview(config, view) {
|
|
132
|
-
this._rtcClient.startRenderCameraPreview(this._deviceId, view, config.renderMode, config.isMirror);
|
|
133
|
+
return this._rtcClient.startRenderCameraPreview(this._deviceId, view, config.renderMode, config.isMirror);
|
|
133
134
|
}
|
|
134
135
|
}, {
|
|
135
136
|
key: "stopPreview",
|
|
136
137
|
value: function stopPreview(view) {
|
|
137
|
-
this._rtcClient.stopRenderCameraPreview(this._deviceId, view);
|
|
138
|
+
return this._rtcClient.stopRenderCameraPreview(this._deviceId, view);
|
|
138
139
|
}
|
|
139
140
|
}, {
|
|
140
141
|
key: "startTest",
|
|
141
142
|
value: function startTest() {
|
|
142
|
-
this._rtcClient.sourceManager.startCameraTest(this._deviceId);
|
|
143
|
+
return this._rtcClient.sourceManager.startCameraTest(this._deviceId);
|
|
143
144
|
}
|
|
144
145
|
}, {
|
|
145
146
|
key: "stopTest",
|
|
146
147
|
value: function stopTest() {
|
|
147
|
-
this._rtcClient.sourceManager.stopCameraTest(this._deviceId);
|
|
148
|
+
return this._rtcClient.sourceManager.stopCameraTest(this._deviceId);
|
|
148
149
|
}
|
|
149
150
|
}, {
|
|
150
151
|
key: "setCaptureParams",
|
|
151
152
|
value: function setCaptureParams(params) {
|
|
152
|
-
this._rtcClient.sourceManager.setCameraCaptureParams(this._deviceId, params);
|
|
153
|
+
return this._rtcClient.sourceManager.setCameraCaptureParams(this._deviceId, params);
|
|
153
154
|
}
|
|
154
155
|
}, {
|
|
155
156
|
key: "setVideoOrientation",
|
|
156
157
|
value: function setVideoOrientation(orientation) {
|
|
157
|
-
this._rtcClient.sourceManager.setCameraVideoOrientation(this._deviceId, orientation);
|
|
158
|
+
return this._rtcClient.sourceManager.setCameraVideoOrientation(this._deviceId, orientation);
|
|
158
159
|
}
|
|
159
160
|
}, {
|
|
160
161
|
key: "_handleCameraStateUpdated",
|
|
@@ -167,7 +168,7 @@ var AgoraRteCameraTrackImpl = exports.AgoraRteCameraTrackImpl = /*#__PURE__*/fun
|
|
|
167
168
|
}]);
|
|
168
169
|
}(_ref = _baseTrack.AgoraRteBaseTrack); // @internal
|
|
169
170
|
_AgoraRteCameraTrackImpl = AgoraRteCameraTrackImpl;
|
|
170
|
-
var _applyDecs$e = (0, _slicedToArray2["default"])(_applyDecs(_AgoraRteCameraTrackImpl, [[_imports.trace, 2, "switchPosition"], [_imports.trace, 2, "start"], [_imports.trace, 2, "stop"], [
|
|
171
|
+
var _applyDecs$e = (0, _slicedToArray2["default"])(_applyDecs(_AgoraRteCameraTrackImpl, [[_imports.trace, 2, "switchPosition"], [_imports.trace, 2, "start"], [_imports.trace, 2, "stop"], [_startPreviewDecs, 2, "startPreview"], [_stopPreviewDecs, 2, "stopPreview"], [_imports.trace, 2, "startTest"], [_imports.trace, 2, "stopTest"], [_setCaptureParamsDecs, 2, "setCaptureParams"], [_setVideoOrientationDecs, 2, "setVideoOrientation"]], [], 0, void 0, _ref).e, 1);
|
|
171
172
|
_initProto = _applyDecs$e[0];
|
|
172
173
|
var AgoraRteCameraDummyTrackImpl = exports.AgoraRteCameraDummyTrackImpl = /*#__PURE__*/function () {
|
|
173
174
|
function AgoraRteCameraDummyTrackImpl() {
|
|
@@ -196,25 +197,39 @@ var AgoraRteCameraDummyTrackImpl = exports.AgoraRteCameraDummyTrackImpl = /*#__P
|
|
|
196
197
|
}
|
|
197
198
|
}, {
|
|
198
199
|
key: "start",
|
|
199
|
-
value: function start() {
|
|
200
|
+
value: function start() {
|
|
201
|
+
return 0;
|
|
202
|
+
}
|
|
200
203
|
}, {
|
|
201
204
|
key: "stop",
|
|
202
|
-
value: function stop() {
|
|
205
|
+
value: function stop() {
|
|
206
|
+
return 0;
|
|
207
|
+
}
|
|
203
208
|
}, {
|
|
204
209
|
key: "startPreview",
|
|
205
|
-
value: function startPreview(config, view) {
|
|
210
|
+
value: function startPreview(config, view) {
|
|
211
|
+
return 0;
|
|
212
|
+
}
|
|
206
213
|
}, {
|
|
207
214
|
key: "stopPreview",
|
|
208
|
-
value: function stopPreview(view) {
|
|
215
|
+
value: function stopPreview(view) {
|
|
216
|
+
return 0;
|
|
217
|
+
}
|
|
209
218
|
}, {
|
|
210
219
|
key: "startTest",
|
|
211
|
-
value: function startTest() {
|
|
220
|
+
value: function startTest() {
|
|
221
|
+
return 0;
|
|
222
|
+
}
|
|
212
223
|
}, {
|
|
213
224
|
key: "stopTest",
|
|
214
|
-
value: function stopTest() {
|
|
225
|
+
value: function stopTest() {
|
|
226
|
+
return 0;
|
|
227
|
+
}
|
|
215
228
|
}, {
|
|
216
229
|
key: "setCaptureParams",
|
|
217
|
-
value: function setCaptureParams(params) {
|
|
230
|
+
value: function setCaptureParams(params) {
|
|
231
|
+
return 0;
|
|
232
|
+
}
|
|
218
233
|
}, {
|
|
219
234
|
key: "switchPosition",
|
|
220
235
|
value: function switchPosition() {
|
|
@@ -232,6 +247,8 @@ var AgoraRteCameraDummyTrackImpl = exports.AgoraRteCameraDummyTrackImpl = /*#__P
|
|
|
232
247
|
}
|
|
233
248
|
}, {
|
|
234
249
|
key: "setVideoOrientation",
|
|
235
|
-
value: function setVideoOrientation(orientation) {
|
|
250
|
+
value: function setVideoOrientation(orientation) {
|
|
251
|
+
return 0;
|
|
252
|
+
}
|
|
236
253
|
}]);
|
|
237
254
|
}();
|
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
import { AgoraRtcClient } from '../rtc';
|
|
2
|
-
import {
|
|
2
|
+
import { AgoraRtcBeautyOptions, AgoraRtcVirtualBackgroundOptions } from '../rtc/type';
|
|
3
|
+
import { AgoraRteAiDenoiseLevel } from './type';
|
|
3
4
|
export declare class AgoraRteAudioEffectEnhancer {
|
|
4
5
|
private _rtcClient;
|
|
5
6
|
private _deviceId;
|
|
6
7
|
constructor(_rtcClient: AgoraRtcClient, _deviceId: string);
|
|
7
|
-
|
|
8
|
-
disableAiDenoiser(): number;
|
|
9
|
-
setAiDenoiseLevel(level: AgoraRtcAiDenoiseLevel): number;
|
|
8
|
+
setAiDenoiseLevel(level: AgoraRteAiDenoiseLevel): number;
|
|
10
9
|
enableHiFiMode(): number;
|
|
11
10
|
disableHiFiMode(): number;
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
enableAEC(): number;
|
|
12
|
+
disableAEC(): number;
|
|
14
13
|
enableStereoMode(): number;
|
|
15
14
|
disableStereoMode(): number;
|
|
16
15
|
enableOriginalSoundMode(): number;
|