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
|
@@ -23,28 +23,36 @@ export interface AgoraRteScreenTrack extends AgoraRteObservableTrack<AgoraRteScr
|
|
|
23
23
|
* Sets the capture parameters for the screen.
|
|
24
24
|
* @param params The parameters for the video capture.
|
|
25
25
|
*/
|
|
26
|
-
startPreview(config: AgoraRteVideoRenderConfig, view: unknown):
|
|
26
|
+
startPreview(config: AgoraRteVideoRenderConfig, view: unknown): number;
|
|
27
27
|
/**
|
|
28
28
|
* Stops the screen video track for the specified source.
|
|
29
29
|
* @returns A promise that resolves when the stop is successful.
|
|
30
30
|
*/
|
|
31
|
-
stopPreview():
|
|
31
|
+
stopPreview(): number;
|
|
32
32
|
/**
|
|
33
33
|
* Sets the capture parameters for the screen.
|
|
34
34
|
* @param params The parameters for the video capture.
|
|
35
35
|
*/
|
|
36
|
-
setCaptureParams(params: AgoraRteScreenCaptureParams):
|
|
36
|
+
setCaptureParams(params: AgoraRteScreenCaptureParams): number;
|
|
37
37
|
/**
|
|
38
38
|
* Starts the screen video track with the specified type and parameters.
|
|
39
39
|
* @param type The type of screen capture.
|
|
40
40
|
* @param excludeWindowList The list of window IDs to exclude from the screen capture.
|
|
41
41
|
* @returns A promise that resolves when the start is successful.
|
|
42
42
|
*/
|
|
43
|
-
start(type: AgoraRteScreenCaptureType, excludeWindowList: string[]):
|
|
43
|
+
start(type: AgoraRteScreenCaptureType, excludeWindowList: string[]): number;
|
|
44
44
|
/**
|
|
45
45
|
* Stops the screen video track for the specified source.
|
|
46
46
|
* @param type The type of screen capture.
|
|
47
47
|
* @returns A promise that resolves when the stop is successful.
|
|
48
48
|
*/
|
|
49
|
-
stop():
|
|
49
|
+
stop(): number;
|
|
50
|
+
/**
|
|
51
|
+
* Updates the screen capture exclude window list.
|
|
52
|
+
* @param excludeWindowList The list of window to exclude from the screen capture.
|
|
53
|
+
* @returns number
|
|
54
|
+
* 0: success
|
|
55
|
+
* < 0: failure
|
|
56
|
+
*/
|
|
57
|
+
updateExcludeWindows(excludeWindowList: string[]): number;
|
|
50
58
|
}
|
package/lib/core/media/screen.js
CHANGED
|
@@ -41,6 +41,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
41
41
|
value: true
|
|
42
42
|
});
|
|
43
43
|
exports.AgoraRteScreenTrackImpl = exports.AgoraRteScreenDummyTrackImpl = void 0;
|
|
44
|
+
require("core-js/modules/es.array.concat.js");
|
|
44
45
|
require("core-js/modules/es.function.bind.js");
|
|
45
46
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
46
47
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
@@ -55,8 +56,9 @@ var _baseTrack = require("./base-track");
|
|
|
55
56
|
var _type3 = require("./type");
|
|
56
57
|
var _logger = require("../utilities/logger");
|
|
57
58
|
var _imports = require("../../imports");
|
|
59
|
+
var _constant = require("../../constant");
|
|
58
60
|
var _ref, _AgoraRteScreenTrackImpl;
|
|
59
|
-
var _initProto;
|
|
61
|
+
var _initProto, _setCaptureParamsDecs, _startDecs, _updateExcludeWindowsDecs, _startPreviewDecs, _ref2;
|
|
60
62
|
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
63
|
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
62
64
|
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 +69,14 @@ function _checkInRHS(e) { if (Object(e) !== e) throw TypeError("right-hand side
|
|
|
67
69
|
/**
|
|
68
70
|
* Interface for a screen video track in Agora RTE SDK.
|
|
69
71
|
*/
|
|
72
|
+
_ref2 = (_setCaptureParamsDecs = (0, _imports.trace)(['params']), _startDecs = (0, _imports.trace)(['type', 'excludeWindowList']), _updateExcludeWindowsDecs = (0, _imports.trace)(['excludeWindowList']), _startPreviewDecs = (0, _imports.trace)(['config', 'view']), "logger");
|
|
70
73
|
//@internal
|
|
71
|
-
var AgoraRteScreenTrackImpl = exports.AgoraRteScreenTrackImpl = /*#__PURE__*/function (
|
|
74
|
+
var AgoraRteScreenTrackImpl = exports.AgoraRteScreenTrackImpl = /*#__PURE__*/function (_ref3) {
|
|
72
75
|
function AgoraRteScreenTrackImpl(_rtcClient, _sourceId) {
|
|
73
76
|
var _this;
|
|
74
77
|
(0, _classCallCheck2["default"])(this, AgoraRteScreenTrackImpl);
|
|
75
78
|
_this = _callSuper(this, AgoraRteScreenTrackImpl, [_rtcClient]);
|
|
76
|
-
(0, _defineProperty2["default"])(_this,
|
|
79
|
+
(0, _defineProperty2["default"])(_this, _ref2, (_initProto(_this), (0, _logger.createLogger)({
|
|
77
80
|
prefix: 'AgoraRteScreenTrackImpl'
|
|
78
81
|
})));
|
|
79
82
|
(0, _defineProperty2["default"])(_this, "_state", _type.AgoraRteMediaSourceState.CLOSE);
|
|
@@ -85,7 +88,7 @@ var AgoraRteScreenTrackImpl = exports.AgoraRteScreenTrackImpl = /*#__PURE__*/fun
|
|
|
85
88
|
});
|
|
86
89
|
return _this;
|
|
87
90
|
}
|
|
88
|
-
(0, _inherits2["default"])(AgoraRteScreenTrackImpl,
|
|
91
|
+
(0, _inherits2["default"])(AgoraRteScreenTrackImpl, _ref3);
|
|
89
92
|
return (0, _createClass2["default"])(AgoraRteScreenTrackImpl, [{
|
|
90
93
|
key: "getSourceId",
|
|
91
94
|
value: function getSourceId() {
|
|
@@ -105,6 +108,7 @@ var AgoraRteScreenTrackImpl = exports.AgoraRteScreenTrackImpl = /*#__PURE__*/fun
|
|
|
105
108
|
key: "setCaptureParams",
|
|
106
109
|
value: function setCaptureParams(params) {
|
|
107
110
|
this._params = params;
|
|
111
|
+
return _constant.AgoraRteReturnCode.SUCCESS;
|
|
108
112
|
}
|
|
109
113
|
}, {
|
|
110
114
|
key: "start",
|
|
@@ -112,15 +116,15 @@ var AgoraRteScreenTrackImpl = exports.AgoraRteScreenTrackImpl = /*#__PURE__*/fun
|
|
|
112
116
|
this._captureType = type;
|
|
113
117
|
if (type === _type2.AgoraRtcScreenCaptureType.SCREEN) {
|
|
114
118
|
if (this._params) {
|
|
115
|
-
this._rtcClient.sourceManager.startScreenCaptureByDisplayIdWithParams(this._sourceId, this._params, excludeWindowList);
|
|
119
|
+
return this._rtcClient.sourceManager.startScreenCaptureByDisplayIdWithParams(this._sourceId, this._params, excludeWindowList);
|
|
116
120
|
} else {
|
|
117
|
-
this._rtcClient.sourceManager.startScreenCaptureByDisplayId(this._sourceId, excludeWindowList);
|
|
121
|
+
return this._rtcClient.sourceManager.startScreenCaptureByDisplayId(this._sourceId, excludeWindowList);
|
|
118
122
|
}
|
|
119
123
|
} else {
|
|
120
124
|
if (this._params) {
|
|
121
|
-
this._rtcClient.sourceManager.startScreenCaptureByWindowIdWithParams(this._sourceId, this._params);
|
|
125
|
+
return this._rtcClient.sourceManager.startScreenCaptureByWindowIdWithParams(this._sourceId, this._params);
|
|
122
126
|
} else {
|
|
123
|
-
this._rtcClient.sourceManager.startScreenCaptureByWindowId(this._sourceId);
|
|
127
|
+
return this._rtcClient.sourceManager.startScreenCaptureByWindowId(this._sourceId);
|
|
124
128
|
}
|
|
125
129
|
}
|
|
126
130
|
}
|
|
@@ -129,18 +133,29 @@ var AgoraRteScreenTrackImpl = exports.AgoraRteScreenTrackImpl = /*#__PURE__*/fun
|
|
|
129
133
|
value: function stop() {
|
|
130
134
|
return this._rtcClient.sourceManager.stopScreenCapture(this._sourceId, this._captureType);
|
|
131
135
|
}
|
|
136
|
+
}, {
|
|
137
|
+
key: "updateExcludeWindows",
|
|
138
|
+
value: function updateExcludeWindows(excludeWindowList) {
|
|
139
|
+
if (this._captureType === _type2.AgoraRtcScreenCaptureType.SCREEN) {
|
|
140
|
+
return this._rtcClient.sourceManager.updateExcludeWindowsByDisplayId(this._sourceId, excludeWindowList);
|
|
141
|
+
} else {
|
|
142
|
+
this.logger.warn("updateExcludeWindows called with supported capture type: ".concat(_type2.AgoraRtcScreenCaptureType.SCREEN, ", but received: ").concat(this._captureType));
|
|
143
|
+
return 0;
|
|
144
|
+
}
|
|
145
|
+
}
|
|
132
146
|
}, {
|
|
133
147
|
key: "startPreview",
|
|
134
148
|
value: function startPreview(config, view) {
|
|
135
149
|
this._view = view;
|
|
136
|
-
this._rtcClient.startRenderScreenPreview(this._sourceId, view, _type2.AgoraRtcScreenCaptureType.SCREEN, config.renderMode, config.isMirror);
|
|
150
|
+
return this._rtcClient.startRenderScreenPreview(this._sourceId, view, _type2.AgoraRtcScreenCaptureType.SCREEN, config.renderMode, config.isMirror);
|
|
137
151
|
}
|
|
138
152
|
}, {
|
|
139
153
|
key: "stopPreview",
|
|
140
154
|
value: function stopPreview() {
|
|
141
155
|
if (this._view) {
|
|
142
|
-
this._rtcClient.stopRenderScreenPreview(this._sourceId, this._view, _type2.AgoraRtcScreenCaptureType.SCREEN);
|
|
156
|
+
return this._rtcClient.stopRenderScreenPreview(this._sourceId, this._view, _type2.AgoraRtcScreenCaptureType.SCREEN);
|
|
143
157
|
}
|
|
158
|
+
return _constant.AgoraRteReturnCode.UNDEFINED;
|
|
144
159
|
}
|
|
145
160
|
}, {
|
|
146
161
|
key: "_handleScreenCaptureStateUpdated",
|
|
@@ -153,7 +168,7 @@ var AgoraRteScreenTrackImpl = exports.AgoraRteScreenTrackImpl = /*#__PURE__*/fun
|
|
|
153
168
|
}]);
|
|
154
169
|
}(_ref = _baseTrack.AgoraRteBaseTrack); // @internal
|
|
155
170
|
_AgoraRteScreenTrackImpl = AgoraRteScreenTrackImpl;
|
|
156
|
-
var _applyDecs$e = (0, _slicedToArray2["default"])(_applyDecs(_AgoraRteScreenTrackImpl, [[
|
|
171
|
+
var _applyDecs$e = (0, _slicedToArray2["default"])(_applyDecs(_AgoraRteScreenTrackImpl, [[_setCaptureParamsDecs, 2, "setCaptureParams"], [_startDecs, 2, "start"], [_imports.trace, 2, "stop"], [_updateExcludeWindowsDecs, 2, "updateExcludeWindows"], [_startPreviewDecs, 2, "startPreview"], [_imports.trace, 2, "stopPreview"]], [], 0, void 0, _ref).e, 1);
|
|
157
172
|
_initProto = _applyDecs$e[0];
|
|
158
173
|
var AgoraRteScreenDummyTrackImpl = exports.AgoraRteScreenDummyTrackImpl = /*#__PURE__*/function () {
|
|
159
174
|
function AgoraRteScreenDummyTrackImpl() {
|
|
@@ -182,18 +197,33 @@ var AgoraRteScreenDummyTrackImpl = exports.AgoraRteScreenDummyTrackImpl = /*#__P
|
|
|
182
197
|
}
|
|
183
198
|
}, {
|
|
184
199
|
key: "startPreview",
|
|
185
|
-
value: function startPreview(config, view) {
|
|
200
|
+
value: function startPreview(config, view) {
|
|
201
|
+
return 0;
|
|
202
|
+
}
|
|
186
203
|
}, {
|
|
187
204
|
key: "stopPreview",
|
|
188
|
-
value: function stopPreview() {
|
|
205
|
+
value: function stopPreview() {
|
|
206
|
+
return 0;
|
|
207
|
+
}
|
|
189
208
|
}, {
|
|
190
209
|
key: "setCaptureParams",
|
|
191
|
-
value: function setCaptureParams(params) {
|
|
210
|
+
value: function setCaptureParams(params) {
|
|
211
|
+
return 0;
|
|
212
|
+
}
|
|
192
213
|
}, {
|
|
193
214
|
key: "start",
|
|
194
|
-
value: function start(type, excludeWindowList) {
|
|
215
|
+
value: function start(type, excludeWindowList) {
|
|
216
|
+
return 0;
|
|
217
|
+
}
|
|
195
218
|
}, {
|
|
196
219
|
key: "stop",
|
|
197
|
-
value: function stop() {
|
|
220
|
+
value: function stop() {
|
|
221
|
+
return 0;
|
|
222
|
+
}
|
|
223
|
+
}, {
|
|
224
|
+
key: "updateExcludeWindows",
|
|
225
|
+
value: function updateExcludeWindows(excludeWindowList) {
|
|
226
|
+
return 0;
|
|
227
|
+
}
|
|
198
228
|
}]);
|
|
199
229
|
}();
|
package/lib/core/media/type.d.ts
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
|
-
import { AgoraRteMediaSourceState } from '../../type';
|
|
2
|
-
import { AgoraRtcAudioOutputRouting, AgoraRtcAudioRawDataConfig, AgoraRtcBeautyOptions, AgoraRtcCameraCaptureParams, AgoraRtcDeviceInfo, AgoraRtcDimensions, AgoraRtcRenderMode, AgoraRtcScreenCaptureParams, AgoraRtcVirtualBackgroundOptions } from '../rtc/type';
|
|
1
|
+
import { AgoraRteAudioSourceType, AgoraRteMediaSourceState, AgoraRteVideoSourceType } from '../../type';
|
|
2
|
+
import { AgoraRtcAudioOutputRouting, AgoraRtcAudioRawDataConfig, AgoraRtcBeautyOptions, AgoraRtcCameraCaptureParams, AgoraRtcCapability, AgoraRtcDeviceInfo, AgoraRtcDimensions, AgoraRtcDisplayInfo, AgoraRtcRenderMode, AgoraRtcScreenCaptureParams, AgoraRtcVirtualBackgroundOptions, AgoraRtcWindowInfo } from '../rtc/type';
|
|
3
|
+
import { AgoraRteCameraTrack } from './camera';
|
|
4
|
+
import { AgoraRteLoopbackTrack } from './loopback';
|
|
5
|
+
import { AgoraRteMicrophoneTrack } from './microphone';
|
|
6
|
+
import { AgoraRteScreenTrack } from './screen';
|
|
3
7
|
/**
|
|
4
8
|
* 音频的输出位置
|
|
5
9
|
*/
|
|
@@ -65,6 +69,159 @@ export type AgoraRteMediaControlObserver = Partial<{
|
|
|
65
69
|
onSystemSelectedSpeakerChanged(speaker: AgoraRtcDeviceInfo): void;
|
|
66
70
|
onSystemSelectedMicrophoneChanged(microphone: AgoraRtcDeviceInfo): void;
|
|
67
71
|
}>;
|
|
72
|
+
export interface AgoraRteMediaControlInternalObsever extends AgoraRteMediaControlObserver {
|
|
73
|
+
onTrackVideoStateUpdated?: (sourceId: string, sourceType: AgoraRteVideoSourceType, state: AgoraRteMediaSourceState) => void;
|
|
74
|
+
onTrackAudioStateUpdated?: (sourceId: string, sourceType: AgoraRteAudioSourceType, state: AgoraRteMediaSourceState) => void;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Interface for the Agora Real-Time Engagement Media Control.
|
|
78
|
+
*/
|
|
79
|
+
export interface AgoraRteMediaControl {
|
|
80
|
+
/**
|
|
81
|
+
* Retrieves a list of available loopback devices.
|
|
82
|
+
* @returns An array of available loopback devices.
|
|
83
|
+
*/
|
|
84
|
+
getLoopbackList(): AgoraRtcDeviceInfo[];
|
|
85
|
+
/**
|
|
86
|
+
* Retrieves a list of available cameras.
|
|
87
|
+
* @returns An array of available cameras.
|
|
88
|
+
*/
|
|
89
|
+
getCameraList(): Promise<AgoraRtcDeviceInfo[]>;
|
|
90
|
+
/**
|
|
91
|
+
* Retrieves a list of available microphones.
|
|
92
|
+
* @returns An array of available microphones.
|
|
93
|
+
*/
|
|
94
|
+
getMicrophoneList(): Promise<AgoraRtcDeviceInfo[]>;
|
|
95
|
+
/**
|
|
96
|
+
* Retrieves a list of available speakers.
|
|
97
|
+
* @returns An array of available speakers.
|
|
98
|
+
*/
|
|
99
|
+
getSpeakerList(): Promise<AgoraRtcDeviceInfo[]>;
|
|
100
|
+
/**
|
|
101
|
+
* Retrieves the system-selected microphone.
|
|
102
|
+
* @returns The system-selected microphone.
|
|
103
|
+
*/
|
|
104
|
+
getSystemSelectedMicrophone(): Promise<AgoraRtcDeviceInfo | undefined>;
|
|
105
|
+
/**
|
|
106
|
+
* Retrieves the system-selected speaker.
|
|
107
|
+
* @returns The system-selected speaker.
|
|
108
|
+
*/
|
|
109
|
+
getSystemSelectedSpeaker(): Promise<AgoraRtcDeviceInfo | undefined>;
|
|
110
|
+
/**
|
|
111
|
+
* Retrieves a list of available windows for screen sharing.
|
|
112
|
+
* Only available in Electron, in browsers this method returns an empty array.
|
|
113
|
+
* @returns A promise that resolves to an array of available windows.
|
|
114
|
+
*/
|
|
115
|
+
getWindowList(): Promise<AgoraRtcWindowInfo[]>;
|
|
116
|
+
/**
|
|
117
|
+
* Retrieves a list of available displays for screen sharing.
|
|
118
|
+
* Only available in Electron, in browsers this method returns an empty array.
|
|
119
|
+
* @returns A promise that resolves to an array of available displays.
|
|
120
|
+
*/
|
|
121
|
+
getDisplayList(): Promise<AgoraRtcDisplayInfo[]>;
|
|
122
|
+
/**
|
|
123
|
+
* Retrieves the camera video track for a specific device.
|
|
124
|
+
* @param deviceId The ID of the device.
|
|
125
|
+
* @returns The camera video track.
|
|
126
|
+
*/
|
|
127
|
+
getCameraTrack(deviceId: string): AgoraRteCameraTrack;
|
|
128
|
+
/**
|
|
129
|
+
* Retrieves the microphone audio track for a specific device.
|
|
130
|
+
* @param deviceId The ID of the device.
|
|
131
|
+
* @returns The microphone audio track.
|
|
132
|
+
*/
|
|
133
|
+
getMicrophoneTrack(deviceId: string): AgoraRteMicrophoneTrack;
|
|
134
|
+
/**
|
|
135
|
+
* Retrieves the screen video track for a specific source.
|
|
136
|
+
* @param sourceId The ID of the source.
|
|
137
|
+
* @returns The screen video track.
|
|
138
|
+
*/
|
|
139
|
+
getScreenTrack(sourceId: string): AgoraRteScreenTrack;
|
|
140
|
+
/**
|
|
141
|
+
* Retrieves the loopback audio track for a specific source.
|
|
142
|
+
* @param sourceId The ID of the source.
|
|
143
|
+
* @returns The loopback audio track.
|
|
144
|
+
*/
|
|
145
|
+
getLoopbackTrack(sourceId: string): AgoraRteLoopbackTrack;
|
|
146
|
+
/**
|
|
147
|
+
* Sets a speaker for audio playback.
|
|
148
|
+
* @param deviceId The ID of the speaker device.
|
|
149
|
+
*/
|
|
150
|
+
setSelectedSpeaker(deviceId: string): number;
|
|
151
|
+
/**
|
|
152
|
+
* Enable/Disable speaker playback.
|
|
153
|
+
* @param enable Whether to enable speaker playback.
|
|
154
|
+
*/
|
|
155
|
+
setEnableSpeaker(enable: boolean): void;
|
|
156
|
+
/**
|
|
157
|
+
* Get the current audio output routing of the SDK
|
|
158
|
+
*/
|
|
159
|
+
getAudioOutputRouting(): AgoraRtcAudioOutputRouting;
|
|
160
|
+
/**
|
|
161
|
+
* Starts a speaker test.
|
|
162
|
+
* @param url The URL of the audio file for the test.
|
|
163
|
+
*/
|
|
164
|
+
startSpeakerTest(url: string): number;
|
|
165
|
+
/**
|
|
166
|
+
* Stops a speaker test.
|
|
167
|
+
*/
|
|
168
|
+
stopSpeakerTest(): number;
|
|
169
|
+
/**
|
|
170
|
+
* Adjusts the playback audio volume.
|
|
171
|
+
* @param volume
|
|
172
|
+
*/
|
|
173
|
+
adjustAudioOutputVolume(volume: number): number;
|
|
174
|
+
/**
|
|
175
|
+
* Check if the media control supports the specified capability.
|
|
176
|
+
* @param capability
|
|
177
|
+
*/
|
|
178
|
+
isCapabilitySupported(capability: AgoraRtcCapability): boolean;
|
|
179
|
+
/**
|
|
180
|
+
* Set the volume of the selected speaker
|
|
181
|
+
* @param volume The volume to set
|
|
182
|
+
*/
|
|
183
|
+
setSelectedSpeakerVolume(volume: number): number;
|
|
184
|
+
/**
|
|
185
|
+
* Get the volume of the selected speaker
|
|
186
|
+
*/
|
|
187
|
+
getSelectedSpeakerVolume(): number;
|
|
188
|
+
/**
|
|
189
|
+
* Disable AGC
|
|
190
|
+
* @returns 0 if the AGC is disabled; otherwise,
|
|
191
|
+
* 1 if the AGC is not supported
|
|
192
|
+
*/
|
|
193
|
+
disableAGC(): number;
|
|
194
|
+
/**
|
|
195
|
+
* Enable AGC
|
|
196
|
+
* @returns 0 if the AGC is enabled; otherwise,
|
|
197
|
+
* 1 if the AGC is not supported
|
|
198
|
+
*/
|
|
199
|
+
enableAGC(): number;
|
|
200
|
+
/**
|
|
201
|
+
* Observe the system selected speaker
|
|
202
|
+
* @param enable
|
|
203
|
+
*/
|
|
204
|
+
observeSystemSelectedSpeakerChanged(enable: boolean): number;
|
|
205
|
+
/**
|
|
206
|
+
* Observe the system selected microphone
|
|
207
|
+
* @param enable
|
|
208
|
+
*/
|
|
209
|
+
observeSystemSelectedMicrophoneChanged(enable: boolean): number;
|
|
210
|
+
/**
|
|
211
|
+
* Adds an observer to be notified of media device events.
|
|
212
|
+
* @param observer The observer to add.
|
|
213
|
+
*/
|
|
214
|
+
addObserver(observer: AgoraRteMediaControlObserver): void;
|
|
215
|
+
/**
|
|
216
|
+
* Removes an observer from the media device events.
|
|
217
|
+
* @param observer The observer to remove.
|
|
218
|
+
*/
|
|
219
|
+
removeObserver(observer: AgoraRteMediaControlObserver): void;
|
|
220
|
+
/**
|
|
221
|
+
* Releases the resources used by the media control.
|
|
222
|
+
*/
|
|
223
|
+
release(): number;
|
|
224
|
+
}
|
|
68
225
|
export type AgoraRteObservableTrack<T> = {
|
|
69
226
|
addObserver(observer: T): void;
|
|
70
227
|
removeObserver(observer: T): void;
|
package/lib/core/media/type.js
CHANGED
|
@@ -64,4 +64,7 @@ var AgoraRteMediaPublishState = exports.AgoraRteMediaPublishState = /*#__PURE__*
|
|
|
64
64
|
AgoraRteMediaPublishState[AgoraRteMediaPublishState["UNPUBLISHED"] = 0] = "UNPUBLISHED";
|
|
65
65
|
AgoraRteMediaPublishState[AgoraRteMediaPublishState["PUBLISHED"] = 1] = "PUBLISHED";
|
|
66
66
|
return AgoraRteMediaPublishState;
|
|
67
|
-
}({});
|
|
67
|
+
}({});
|
|
68
|
+
/**
|
|
69
|
+
* Interface for the Agora Real-Time Engagement Media Control.
|
|
70
|
+
*/
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { AgoraObservable } from '../../imports';
|
|
2
|
-
import { AgoraRteSyncDataStore } from './sequence-msg/data';
|
|
3
|
-
import { AgoraRteSequenceMessage, AgoraRteMessageHandlerObserver, AgoraRteSequenceMessageInUser, AgoraRteSequenceMessageOutUser } from './type';
|
|
4
|
-
import { AgoraRteSyncSnapshotData } from './struct';
|
|
5
|
-
import { AgoraRteServiceApi } from '../services/api';
|
|
6
2
|
import { AgoraRtmClient } from '../rtm';
|
|
7
3
|
import { AgoraRtmChannelClient } from '../rtm/channel';
|
|
8
4
|
import { AgoraRteMediaStreamInfo, AgoraRteUserInfo } from '../scene/type';
|
|
5
|
+
import { AgoraRteServiceApi } from '../services/api';
|
|
6
|
+
import { AgoraRteSyncDataStore } from './sequence-msg/data';
|
|
7
|
+
import { AgoraRteSyncSnapshotData } from './struct';
|
|
8
|
+
import { AgoraRteMessageHandlerObserver, AgoraRteSequenceMessage, AgoraRteSequenceMessageInUser, AgoraRteSequenceMessageOutUser } from './type';
|
|
9
9
|
export declare class AgoraRteMessageHandle {
|
|
10
10
|
protected readonly logger: import("agora-foundation/lib/logger/type").Logger;
|
|
11
11
|
protected readonly observable: AgoraObservable<Partial<{
|
|
@@ -90,15 +90,15 @@ var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/cl
|
|
|
90
90
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
91
91
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
92
92
|
var _imports = require("../../imports");
|
|
93
|
+
var _type = require("../rtm/type");
|
|
94
|
+
var _clone = require("../utilities/clone");
|
|
95
|
+
var _diff = require("../utilities/diff");
|
|
96
|
+
var _logger = require("../utilities/logger");
|
|
93
97
|
var _data = require("./sequence-msg/data");
|
|
94
|
-
var
|
|
98
|
+
var _messageParser = require("./sequence-msg/message-parser");
|
|
95
99
|
var _struct = require("./struct");
|
|
96
100
|
var _synchronizer = require("./synchronizer");
|
|
97
|
-
var
|
|
98
|
-
var _type2 = require("../rtm/type");
|
|
99
|
-
var _clone = require("../utilities/clone");
|
|
100
|
-
var _logger = require("../utilities/logger");
|
|
101
|
-
var _diff = require("../utilities/diff");
|
|
101
|
+
var _type2 = require("./type");
|
|
102
102
|
function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; }
|
|
103
103
|
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
104
104
|
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
@@ -116,7 +116,7 @@ var AgoraRteMessageHandle = exports.AgoraRteMessageHandle = /*#__PURE__*/functio
|
|
|
116
116
|
}));
|
|
117
117
|
(0, _defineProperty2["default"])(this, "observable", new _imports.AgoraObservable());
|
|
118
118
|
(0, _defineProperty2["default"])(this, "_timestampGap", 0);
|
|
119
|
-
(0, _defineProperty2["default"])(this, "_rtmConnectionState",
|
|
119
|
+
(0, _defineProperty2["default"])(this, "_rtmConnectionState", _type.AgoraRtmConnectionState.DISCONNECTED);
|
|
120
120
|
this._onSeqMessage = this._onSeqMessage.bind(this);
|
|
121
121
|
this.handleSeqMessage = this.handleSeqMessage.bind(this);
|
|
122
122
|
this._handleUserSubscribe = this._handleUserSubscribe.bind(this);
|
|
@@ -131,15 +131,53 @@ var AgoraRteMessageHandle = exports.AgoraRteMessageHandle = /*#__PURE__*/functio
|
|
|
131
131
|
this._channelMessageSynchronizer = new _synchronizer.AgoraRteSynchronizerManager({
|
|
132
132
|
apiService: apiService,
|
|
133
133
|
sceneId: sceneId,
|
|
134
|
-
sequenceType:
|
|
134
|
+
sequenceType: _type2.AgoraRteSequenceType.CHANNEL_SEQUENCE,
|
|
135
135
|
userId: userId
|
|
136
136
|
});
|
|
137
137
|
this._peerMessageSynchronizer = new _synchronizer.AgoraRteSynchronizerManager({
|
|
138
138
|
apiService: apiService,
|
|
139
139
|
sceneId: sceneId,
|
|
140
|
-
sequenceType:
|
|
140
|
+
sequenceType: _type2.AgoraRteSequenceType.PEER_SEQUENCE,
|
|
141
141
|
userId: userId
|
|
142
142
|
});
|
|
143
|
+
|
|
144
|
+
// this.addObserver(
|
|
145
|
+
// generateLogObserver(this.logger, [
|
|
146
|
+
// ['onCustomChannelMessageRecieved', ['message']],
|
|
147
|
+
|
|
148
|
+
// ['onLocalStreamAdded', ['streams', 'operator', 'cause']],
|
|
149
|
+
// ['onLocalStreamRemoved', ['streams', 'operator', 'cause']],
|
|
150
|
+
// ['onLocalStreamUpdated', ['streams', 'operator', 'cause']],
|
|
151
|
+
|
|
152
|
+
// ['onRemoteStreamAdded', ['streams', 'operator', 'cause']],
|
|
153
|
+
// ['onRemoteStreamRemoved', ['streams', 'operator', 'cause']],
|
|
154
|
+
// ['onRemoteStreamUpdated', ['streams', 'operator', 'cause']],
|
|
155
|
+
|
|
156
|
+
// [
|
|
157
|
+
// 'onLocalUserAdded',
|
|
158
|
+
// ['user', 'addedStreamsData', 'removedStreamsData', 'updatedStreamsData'],
|
|
159
|
+
// ],
|
|
160
|
+
// ['onLocalUserRemoved', ['user']],
|
|
161
|
+
|
|
162
|
+
// ['onRemoteUsersAdded', ['users']],
|
|
163
|
+
// ['onRemoteUsersRemoved', ['removedUsers', 'removedStreamsData']],
|
|
164
|
+
|
|
165
|
+
// ['onRoomPropertyDeleted', ['changedKeys', 'operator', 'cause']],
|
|
166
|
+
// ['onRoomPropertyUpdated', ['changeProperties', 'changedKeys', 'operator', 'cause']],
|
|
167
|
+
// ['onSnapshotUpdated', ['snapshot']],
|
|
168
|
+
// ['onTimeStampGapUpdate', ['gap']],
|
|
169
|
+
// ['onUserCountUpdated', ['total']],
|
|
170
|
+
|
|
171
|
+
// ['onUserPropertyDeleted', ['userUuid', 'changedKeys', 'operator', 'cause']],
|
|
172
|
+
// ['onUserPropertyListUpdated', ['changedProperties', 'operator', 'cause']],
|
|
173
|
+
// ['onUserPropertyUpdated', ['userUuid', 'userProperties', 'operator', 'cause']],
|
|
174
|
+
|
|
175
|
+
// ['onUserSubscribe', ['subscribeUsers', 'addedStreamsData', 'operator', 'cause']],
|
|
176
|
+
// ['onUserUnsubscribe', ['unsubscribeUsers', 'removedStreamsData', 'operator', 'cause']],
|
|
177
|
+
// ['onUserUpdated', ['user', 'operator', 'cause']],
|
|
178
|
+
// ]),
|
|
179
|
+
// );
|
|
180
|
+
|
|
143
181
|
this._addMessageEventListeners();
|
|
144
182
|
this._addConnectionEventListeners();
|
|
145
183
|
this.logger.info('initialized, sceneId:', this.sceneId);
|
|
@@ -197,7 +235,7 @@ var AgoraRteMessageHandle = exports.AgoraRteMessageHandle = /*#__PURE__*/functio
|
|
|
197
235
|
}, {
|
|
198
236
|
key: "_onConnectionStateUpdated",
|
|
199
237
|
value: function _onConnectionStateUpdated(state) {
|
|
200
|
-
if ((this._rtmConnectionState ===
|
|
238
|
+
if ((this._rtmConnectionState === _type.AgoraRtmConnectionState.RECONNECTING || this._rtmConnectionState === _type.AgoraRtmConnectionState.CONNECTING) && state === _type.AgoraRtmConnectionState.CONNECTED) {
|
|
201
239
|
var syncCount = 100;
|
|
202
240
|
this.logger.info("RTM connection state updated to connected, start sync sequence for last ".concat(syncCount));
|
|
203
241
|
this._channelMessageSynchronizer.syncSequence(syncCount);
|
|
@@ -264,7 +302,7 @@ var AgoraRteMessageHandle = exports.AgoraRteMessageHandle = /*#__PURE__*/functio
|
|
|
264
302
|
messageSynchronizer.addTasks(tasks);
|
|
265
303
|
} else {
|
|
266
304
|
tasks.forEach(function (task) {
|
|
267
|
-
if (task.cmd ===
|
|
305
|
+
if (task.cmd === _type2.AgoraRteServerMessageCmd.MESSAGE_EXTENSION) {
|
|
268
306
|
_this2._handleCustomMessage(task);
|
|
269
307
|
}
|
|
270
308
|
});
|
|
@@ -306,36 +344,36 @@ var AgoraRteMessageHandle = exports.AgoraRteMessageHandle = /*#__PURE__*/functio
|
|
|
306
344
|
key: "_handleSimpleMessage",
|
|
307
345
|
value: function _handleSimpleMessage(task, cmd) {
|
|
308
346
|
switch (cmd) {
|
|
309
|
-
case
|
|
347
|
+
case _type2.AgoraRteServerMessageCmd.ROOM_PROPERTY:
|
|
310
348
|
// room property change struct aligns with properties so use the same handling func
|
|
311
349
|
this._handleRoomProperties(task);
|
|
312
350
|
break;
|
|
313
|
-
case
|
|
351
|
+
case _type2.AgoraRteServerMessageCmd.ROOM_PROPERTIES:
|
|
314
352
|
this._handleRoomProperties(task);
|
|
315
353
|
break;
|
|
316
|
-
case
|
|
354
|
+
case _type2.AgoraRteServerMessageCmd.USER_IN_OUT:
|
|
317
355
|
this._handleUserInOut(task);
|
|
318
356
|
break;
|
|
319
|
-
case
|
|
357
|
+
case _type2.AgoraRteServerMessageCmd.USER_INFO:
|
|
320
358
|
this._handleUserInfo(task);
|
|
321
359
|
break;
|
|
322
|
-
case
|
|
360
|
+
case _type2.AgoraRteServerMessageCmd.USER_PROPERTY:
|
|
323
361
|
this._handleUserProperty(task);
|
|
324
362
|
break;
|
|
325
|
-
case
|
|
326
|
-
case
|
|
363
|
+
case _type2.AgoraRteServerMessageCmd.USER_PROPERTIES:
|
|
364
|
+
case _type2.AgoraRteServerMessageCmd.USER_PRIVATE_PROPERTIES:
|
|
327
365
|
this._handleUserProperties(task);
|
|
328
366
|
break;
|
|
329
|
-
case
|
|
367
|
+
case _type2.AgoraRteServerMessageCmd.USER_SUBSCRIBE:
|
|
330
368
|
this._handleUserSubscribe(task);
|
|
331
369
|
break;
|
|
332
|
-
case
|
|
370
|
+
case _type2.AgoraRteServerMessageCmd.STREAM_IN_OUT:
|
|
333
371
|
this._handleStreamInOut(task);
|
|
334
372
|
break;
|
|
335
|
-
case
|
|
373
|
+
case _type2.AgoraRteServerMessageCmd.STREAMS_IN_OUT:
|
|
336
374
|
this._handleStreamsInOut(task);
|
|
337
375
|
break;
|
|
338
|
-
case
|
|
376
|
+
case _type2.AgoraRteServerMessageCmd.MESSAGE_EXTENSION:
|
|
339
377
|
this._handleCustomMessage(task);
|
|
340
378
|
break;
|
|
341
379
|
default:
|
|
@@ -346,7 +384,7 @@ var AgoraRteMessageHandle = exports.AgoraRteMessageHandle = /*#__PURE__*/functio
|
|
|
346
384
|
key: "_handleBatchMessage",
|
|
347
385
|
value: function _handleBatchMessage(task, cmd) {
|
|
348
386
|
switch (cmd) {
|
|
349
|
-
case
|
|
387
|
+
case _type2.AgoraRteServerMessageCmd.USER_PROPERTIES:
|
|
350
388
|
this._handleUserPropertyList(task);
|
|
351
389
|
break;
|
|
352
390
|
}
|
|
@@ -440,7 +478,7 @@ var AgoraRteMessageHandle = exports.AgoraRteMessageHandle = /*#__PURE__*/functio
|
|
|
440
478
|
var changedKeys = Array.from(new Set(Object.keys(changeProperties).map(function (k) {
|
|
441
479
|
return k.split('.')[0];
|
|
442
480
|
})));
|
|
443
|
-
if (action ===
|
|
481
|
+
if (action === _type2.AgoraRteSequenceMessagePropertiesAction.UPSERT) {
|
|
444
482
|
this.observable.notifyObservers('onRoomPropertyUpdated', changeProperties, changedKeys,
|
|
445
483
|
// FIXME: get real connector
|
|
446
484
|
_struct.AgoraRteUser.fromSeqData(_objectSpread({}, operator)), cause);
|
|
@@ -473,7 +511,7 @@ var AgoraRteMessageHandle = exports.AgoraRteMessageHandle = /*#__PURE__*/functio
|
|
|
473
511
|
} else {
|
|
474
512
|
user = _struct.AgoraRteUser.fromSeqData(u);
|
|
475
513
|
}
|
|
476
|
-
if (u.subscribe ===
|
|
514
|
+
if (u.subscribe === _type2.AgoraRteSequenceMessageSubscribeUserState.SUBSCRIBE) {
|
|
477
515
|
_this4._dataStore.setUser(user.userId, user);
|
|
478
516
|
var _u$streams = u.streams,
|
|
479
517
|
streams = _u$streams === void 0 ? [] : _u$streams;
|
|
@@ -485,7 +523,7 @@ var AgoraRteMessageHandle = exports.AgoraRteMessageHandle = /*#__PURE__*/functio
|
|
|
485
523
|
_this4._dataStore.setStream(stream.streamId, stream);
|
|
486
524
|
});
|
|
487
525
|
subscribeUsersData.push(user);
|
|
488
|
-
} else if (u.subscribe ===
|
|
526
|
+
} else if (u.subscribe === _type2.AgoraRteSequenceMessageSubscribeUserState.UNSUBSCRIBE) {
|
|
489
527
|
var _streams = _this4._dataStore.findUserStreams(u.userUuid);
|
|
490
528
|
var streamUuids = _streams.map(function (stream) {
|
|
491
529
|
return stream.streamId;
|
|
@@ -728,7 +766,7 @@ var AgoraRteMessageHandle = exports.AgoraRteMessageHandle = /*#__PURE__*/functio
|
|
|
728
766
|
}
|
|
729
767
|
var mergedProperties = this._mergeProperties((_user$userProperties2 = user.userProperties) !== null && _user$userProperties2 !== void 0 ? _user$userProperties2 : {}, changeProperties);
|
|
730
768
|
user.setUserProperties(mergedProperties);
|
|
731
|
-
if (action ===
|
|
769
|
+
if (action === _type2.AgoraRteSequenceMessagePropertiesAction.UPSERT) {
|
|
732
770
|
this.observable.notifyObservers('onUserPropertyUpdated', userUuid, changeProperties,
|
|
733
771
|
// FIXME: get real connector
|
|
734
772
|
_struct.AgoraRteUser.fromSeqData(_objectSpread({}, operator)), cause);
|
|
@@ -849,7 +887,7 @@ var AgoraRteMessageHandle = exports.AgoraRteMessageHandle = /*#__PURE__*/functio
|
|
|
849
887
|
value: function release() {
|
|
850
888
|
this._removeConnectionEventListeners();
|
|
851
889
|
this._removeMessageEventListeners();
|
|
852
|
-
this._rtmConnectionState =
|
|
890
|
+
this._rtmConnectionState = _type.AgoraRtmConnectionState.DISCONNECTED;
|
|
853
891
|
this._channelMessageSynchronizer.release();
|
|
854
892
|
this._peerMessageSynchronizer.release();
|
|
855
893
|
}
|
|
@@ -7,19 +7,21 @@ export declare class AgoraRteSyncDataStore {
|
|
|
7
7
|
private _streams;
|
|
8
8
|
private _roomProperties;
|
|
9
9
|
get users(): Immutable.Map<string, AgoraRteUser>;
|
|
10
|
-
setUsers(users: Record<string, AgoraRteUser>):
|
|
11
|
-
setUser(key: string, user: AgoraRteUser):
|
|
12
|
-
deleteUser(key: string):
|
|
10
|
+
setUsers(users: Record<string, AgoraRteUser>): number;
|
|
11
|
+
setUser(key: string, user: AgoraRteUser): number;
|
|
12
|
+
deleteUser(key: string): number;
|
|
13
13
|
findUser(userUuid: string): AgoraRteUser | undefined;
|
|
14
14
|
get roomProperties(): Record<string, unknown>;
|
|
15
15
|
setRoomProperties(roomProperties: Record<string, unknown>): void;
|
|
16
16
|
get streams(): Immutable.Map<string, AgoraRteMediaStream>;
|
|
17
|
-
setStreams(streams: Record<string, AgoraRteMediaStream>):
|
|
17
|
+
setStreams(streams: Record<string, AgoraRteMediaStream>): number;
|
|
18
18
|
findUserStreams(userId: string): AgoraRteMediaStream[];
|
|
19
|
-
setStream(key: string, stream: AgoraRteMediaStream):
|
|
20
|
-
deleteStream(key: string):
|
|
21
|
-
deleteStreams(keys: string[]):
|
|
19
|
+
setStream(key: string, stream: AgoraRteMediaStream): number;
|
|
20
|
+
deleteStream(key: string): number;
|
|
21
|
+
deleteStreams(keys: string[]): number;
|
|
22
22
|
findStream(streamUuid: string): AgoraRteMediaStream | undefined;
|
|
23
23
|
get userCount(): number;
|
|
24
24
|
setUserCount(userCount: number): void;
|
|
25
|
+
getRoomPropertiesDeepCloneByKeyPath(keyPath: string): unknown;
|
|
26
|
+
getUserPropertiesDeepCloneByKeyPath(userId: string, keyPath: string): unknown;
|
|
25
27
|
}
|