fcr-core 3.10.2 → 3.10.5
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/engine/index.js +102 -108
- package/lib/imports.js +1 -0
- package/lib/media-control/desktop.js +22 -13
- package/lib/media-control/mobile.js +27 -19
- package/lib/media-control/type.d.ts +3 -3
- package/lib/monitor-control/index.js +17 -7
- package/lib/peer-session/index.js +120 -121
- package/lib/plugins/chat/chatroom.js +119 -96
- package/lib/plugins/chat/connector.js +69 -48
- package/lib/remote-control/index.js +194 -216
- package/lib/room-control/ability-control/index.js +20 -10
- package/lib/room-control/application-control/index.js +82 -75
- package/lib/room-control/group-control/index.js +31 -30
- package/lib/room-control/helpers/board-init-info-helper.js +16 -10
- package/lib/room-control/helpers/validation-helper.js +1 -1
- package/lib/room-control/index.js +70 -51
- package/lib/room-control/infinity-room-control/index.js +27 -19
- package/lib/room-control/interpreter-control/index.js +77 -65
- package/lib/room-control/interpreter-control/room.js +6 -4
- package/lib/room-control/join-before-host-waitingroom-control/index.js +6 -4
- package/lib/room-control/mainroom-control/index.js +37 -25
- package/lib/room-control/privilege-control/helper.js +28 -13
- package/lib/room-control/privilege-control/index.js +36 -28
- package/lib/room-control/room-connector-control/index.js +52 -49
- package/lib/room-control/room-connector-control/type.d.ts +1 -1
- package/lib/room-control/room-control-factory.js +10 -12
- package/lib/room-control/room-session/index.js +77 -74
- package/lib/room-control/shared-cache.js +63 -56
- package/lib/room-control/sharing-control/index.js +65 -57
- package/lib/room-control/stream-control/index.js +197 -193
- package/lib/room-control/stt-control/de-compress-gzip.js +10 -0
- package/lib/room-control/stt-control/index.js +93 -86
- package/lib/room-control/user-control/index.js +162 -155
- package/lib/room-control/waitingroom-control/index.js +18 -9
- package/lib/room-control/whiteboard-control/utils.js +4 -2
- package/lib/room-control/whiteboard-control-v1/board-subwindow.js +2 -1
- package/lib/room-control/whiteboard-control-v1/board-window.js +120 -103
- package/lib/room-control/whiteboard-control-v1/factory.js +7 -4
- package/lib/room-control/whiteboard-control-v1/index.js +80 -67
- package/lib/room-control/whiteboard-control-v1/mount-manager.js +4 -2
- package/lib/room-control/whiteboard-control-v1/utils.js +17 -14
- package/lib/room-control/whiteboard-control-v2/annotation-control/control.js +14 -10
- package/lib/room-control/whiteboard-control-v2/annotation-control/factory.js +17 -8
- package/lib/room-control/whiteboard-control-v2/base/index.js +61 -53
- package/lib/room-control/whiteboard-control-v2/base/main-window.js +39 -30
- package/lib/room-control/whiteboard-control-v2/utils.js +10 -10
- package/lib/room-control/whiteboard-control-v2/whiteboard-control/control.js +45 -33
- package/lib/room-control/whiteboard-control-v2/whiteboard-control/factory.js +27 -11
- package/lib/room-control/widget-control/index.js +43 -33
- package/lib/room-router/index.js +66 -58
- package/lib/schema.d.ts +15 -15
- package/lib/service/api.js +446 -548
- package/lib/struct.js +5 -2
- package/lib/utilities/abortable-retry.js +3 -0
- package/lib/utilities/collection.js +15 -11
- package/lib/utilities/error-helpers.js +34 -27
- package/lib/utilities/error.js +4 -3
- package/lib/utilities/join-helper.js +37 -31
- package/lib/utilities/logger.js +8 -5
- package/lib/utilities/parameters.js +21 -10
- package/lib/utilities/retry-helpers.js +1 -0
- package/lib/utilities/stream.js +16 -11
- package/lib/utilities/user.js +4 -3
- package/lib/utilities/validate-params.js +1 -1
- package/lib/utilities/video-encoder-config.js +10 -5
- package/lib-es/engine/index.js +102 -108
- package/lib-es/media-control/desktop.js +22 -13
- package/lib-es/media-control/mobile.js +27 -19
- package/lib-es/monitor-control/index.js +16 -7
- package/lib-es/peer-session/index.js +120 -121
- package/lib-es/plugins/chat/chatroom.js +118 -95
- package/lib-es/plugins/chat/connector.js +67 -47
- package/lib-es/remote-control/index.js +194 -216
- package/lib-es/room-control/ability-control/index.js +19 -10
- package/lib-es/room-control/application-control/index.js +81 -75
- package/lib-es/room-control/group-control/index.js +31 -30
- package/lib-es/room-control/helpers/board-init-info-helper.js +15 -10
- package/lib-es/room-control/helpers/validation-helper.js +1 -1
- package/lib-es/room-control/index.js +69 -51
- package/lib-es/room-control/infinity-room-control/index.js +26 -19
- package/lib-es/room-control/interpreter-control/index.js +77 -65
- package/lib-es/room-control/interpreter-control/room.js +5 -4
- package/lib-es/room-control/join-before-host-waitingroom-control/index.js +5 -4
- package/lib-es/room-control/mainroom-control/index.js +37 -25
- package/lib-es/room-control/privilege-control/helper.js +27 -13
- package/lib-es/room-control/privilege-control/index.js +36 -28
- package/lib-es/room-control/room-connector-control/index.js +52 -49
- package/lib-es/room-control/room-control-factory.js +10 -12
- package/lib-es/room-control/room-session/index.js +77 -74
- package/lib-es/room-control/shared-cache.js +62 -56
- package/lib-es/room-control/sharing-control/index.js +64 -57
- package/lib-es/room-control/stream-control/index.js +197 -193
- package/lib-es/room-control/stt-control/de-compress-gzip.js +10 -0
- package/lib-es/room-control/stt-control/index.js +93 -86
- package/lib-es/room-control/user-control/index.js +162 -155
- package/lib-es/room-control/waitingroom-control/index.js +18 -9
- package/lib-es/room-control/whiteboard-control/utils.js +4 -2
- package/lib-es/room-control/whiteboard-control-v1/board-subwindow.js +2 -1
- package/lib-es/room-control/whiteboard-control-v1/board-window.js +120 -103
- package/lib-es/room-control/whiteboard-control-v1/factory.js +6 -4
- package/lib-es/room-control/whiteboard-control-v1/index.js +80 -67
- package/lib-es/room-control/whiteboard-control-v1/mount-manager.js +3 -2
- package/lib-es/room-control/whiteboard-control-v1/utils.js +17 -14
- package/lib-es/room-control/whiteboard-control-v2/annotation-control/control.js +13 -10
- package/lib-es/room-control/whiteboard-control-v2/annotation-control/factory.js +16 -8
- package/lib-es/room-control/whiteboard-control-v2/base/index.js +60 -53
- package/lib-es/room-control/whiteboard-control-v2/base/main-window.js +39 -30
- package/lib-es/room-control/whiteboard-control-v2/utils.js +10 -10
- package/lib-es/room-control/whiteboard-control-v2/whiteboard-control/control.js +45 -33
- package/lib-es/room-control/whiteboard-control-v2/whiteboard-control/factory.js +26 -11
- package/lib-es/room-control/widget-control/index.js +42 -33
- package/lib-es/room-router/index.js +66 -58
- package/lib-es/service/api.js +445 -548
- package/lib-es/struct.js +4 -2
- package/lib-es/utilities/abortable-retry.js +3 -0
- package/lib-es/utilities/collection.js +14 -11
- package/lib-es/utilities/error-helpers.js +33 -26
- package/lib-es/utilities/error.js +4 -3
- package/lib-es/utilities/join-helper.js +36 -29
- package/lib-es/utilities/logger.js +7 -5
- package/lib-es/utilities/parameters.js +21 -10
- package/lib-es/utilities/retry-helpers.js +1 -0
- package/lib-es/utilities/stream.js +15 -11
- package/lib-es/utilities/user.js +4 -3
- package/lib-es/utilities/validate-params.js +1 -1
- package/lib-es/utilities/video-encoder-config.js +10 -5
- package/package.json +4 -4
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
require("core-js/modules/es.symbol.description.js");
|
|
4
|
+
require("core-js/modules/es.error.cause.js");
|
|
3
5
|
require("core-js/modules/esnext.function.metadata.js");
|
|
4
6
|
require("core-js/modules/esnext.symbol.metadata.js");
|
|
5
7
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
@@ -29,6 +31,9 @@ require("core-js/modules/esnext.map.merge.js");
|
|
|
29
31
|
require("core-js/modules/esnext.map.reduce.js");
|
|
30
32
|
require("core-js/modules/esnext.map.some.js");
|
|
31
33
|
require("core-js/modules/esnext.map.update.js");
|
|
34
|
+
require("core-js/modules/web.dom-collections.iterator.js");
|
|
35
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
36
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
32
37
|
var _imports = require("../../imports");
|
|
33
38
|
var _type = require("../../type");
|
|
34
39
|
var _user = require("../../utilities/user");
|
|
@@ -36,7 +41,10 @@ var _error = require("../../utilities/error");
|
|
|
36
41
|
var _logger = require("../../utilities/logger");
|
|
37
42
|
var _validateParams = _interopRequireDefault(require("../../utilities/validate-params"));
|
|
38
43
|
var _schema = require("../../schema");
|
|
39
|
-
|
|
44
|
+
var _FcrStreamControlImpl;
|
|
45
|
+
let _initProto, _addLocalStreamsDecs, _bindLocalStreamsDecs, _updatePublishPrivilegeOfStreamsDecs, _updatePublishPrivilegeOfStreamsByScopeDecs, _removeStreamsDecs, _setVideoEncoderConfigDecs, _setDualStreamModeDecs, _setScreenScenarioDecs, _startRenderRemoteVideoStreamDecs, _stopRenderRemoteVideoStreamDecs, _startPlayRemoteAudioStreamDecs, _stopPlayRemoteAudioStreamDecs, _takeSnapshotDecs, _addLocalScreenStreamDecs, _adjustRemoteAudioStreamVolumeDecs, _mergeAudioStreamDecs, _splitAudioStreamDecs, _ref;
|
|
46
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
47
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
40
48
|
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 (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 (e) { return m(e), w.value; } : (o < 4 && (k = i(w, "get", m)), 3 !== o && (F = i(w, "set", m))) : (k = function (e) { return e[n]; }, (o < 2 || 4 === o) && (F = function (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 (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)]; } }; }
|
|
41
49
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
42
50
|
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); }
|
|
@@ -45,104 +53,148 @@ function _checkInRHS(e) { if (Object(e) !== e) throw TypeError("right-hand side
|
|
|
45
53
|
/**
|
|
46
54
|
* @internal
|
|
47
55
|
*/
|
|
56
|
+
_ref = (_addLocalStreamsDecs = [_imports.bound, (0, _imports.trace)(['streams']), (0, _validateParams.default)(_schema.fcrLocalStreamCreateArrayConfigSchema)], _bindLocalStreamsDecs = [_imports.bound, (0, _imports.trace)(['streams']), (0, _validateParams.default)(_schema.fcrStreamBindConfigArrySchema)], _updatePublishPrivilegeOfStreamsDecs = [_imports.bound, _imports.trace, (0, _validateParams.default)(_schema.fcrUpdateStreamPrivilegesRecordSchema)], _updatePublishPrivilegeOfStreamsByScopeDecs = [_imports.bound, _imports.trace, (0, _validateParams.default)(_schema.fcrUpdateStreamPrivilegeSchema, _schema.fcrUpdateStreamPrivilegeScopeSchema)], _removeStreamsDecs = [_imports.bound, (0, _imports.trace)(['streams']), (0, _validateParams.default)(_schema.stringArraySchema)], _setVideoEncoderConfigDecs = [_imports.bound, (0, _imports.trace)(['streamId', 'config', 'streamType']), (0, _validateParams.default)(_schema.stringSchema, _schema.agoraRtcVideoEncoderConfigurationSchema, _schema.fcrVideoStreamTypeSchema)], _setDualStreamModeDecs = [_imports.bound, (0, _imports.trace)(['streamId', 'enable'])], _setScreenScenarioDecs = [_imports.bound, (0, _imports.trace)(['type']), (0, _validateParams.default)(_schema.fcrScreenScenarioTypeSchema)], _startRenderRemoteVideoStreamDecs = [_imports.bound, (0, _imports.trace)(['streamId', 'type', 'config', 'element']), (0, _validateParams.default)(_schema.stringSchema, _schema.fcrVideoStreamTypeSchema, _schema.fcrRenderConfigSchema, (0, _schema.createUnionSchema)([_schema.fcrRenderViewSchema, _imports.objectSchema]))], _stopRenderRemoteVideoStreamDecs = [_imports.bound, (0, _imports.trace)(['streamId', 'element']), (0, _validateParams.default)(_schema.stringSchema, _schema.fcrRenderViewSchema)], _startPlayRemoteAudioStreamDecs = [_imports.bound, (0, _imports.trace)(['streamId']), (0, _validateParams.default)(_schema.stringSchema)], _stopPlayRemoteAudioStreamDecs = [_imports.bound, (0, _imports.trace)(['streamId']), (0, _validateParams.default)(_schema.stringSchema)], _takeSnapshotDecs = [_imports.bound, (0, _imports.trace)(['streamId', 'filePath']), (0, _validateParams.default)(_schema.stringSchema, _schema.stringSchema)], _addLocalScreenStreamDecs = [_imports.bound, (0, _imports.trace)(['config', 'size']), (0, _validateParams.default)(_schema.fcrScreenStreamCreateConfigSchema, _schema.fcrSizeSchema)], _adjustRemoteAudioStreamVolumeDecs = [_imports.bound, (0, _imports.trace)(['streamId', 'volume']), (0, _validateParams.default)(_schema.stringSchema, _schema.numberSchema)], _mergeAudioStreamDecs = [_imports.bound, (0, _imports.trace)(['targetUserId']), (0, _validateParams.default)(_schema.stringSchema)], _splitAudioStreamDecs = [_imports.bound, (0, _imports.trace)(['userId']), (0, _validateParams.default)(_schema.stringSchema)], "logger");
|
|
48
57
|
class FcrStreamControlImpl {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
const stream = event.modifiedStream;
|
|
78
|
-
const exists = stream.streamId in this._streamMapByStreamId;
|
|
79
|
-
if (exists) {
|
|
80
|
-
this.logger.warn(`[FcrStreamControl] stream added when the stream already exists, streamId: ${stream.streamId}`);
|
|
81
|
-
} else {
|
|
82
|
-
this._streamList.push(stream);
|
|
83
|
-
this._streamMapByStreamId[stream.streamId] = stream;
|
|
84
|
-
this._putUserStream(stream.owner.userId, stream);
|
|
85
|
-
}
|
|
86
|
-
});
|
|
87
|
-
this._observable.notifyObservers('onStreamsAdded', sceneId, fcrStreamEvents);
|
|
88
|
-
},
|
|
89
|
-
onStreamsRemoved: (sceneId, events) => {
|
|
90
|
-
const fcrStreamEvents = events.map(this._convertStreamEvent);
|
|
91
|
-
fcrStreamEvents.forEach(event => {
|
|
92
|
-
const stream = event.modifiedStream;
|
|
93
|
-
const exists = stream.streamId in this._streamMapByStreamId;
|
|
94
|
-
if (!exists) {
|
|
95
|
-
this.logger.warn(`[FcrStreamControl] stream removed when the stream does not exist, streamId: ${stream.streamId}`);
|
|
96
|
-
} else {
|
|
97
|
-
const index = this._streamList.findIndex(s => stream.streamId === s.streamId);
|
|
98
|
-
if (index !== -1) {
|
|
99
|
-
this._streamList.splice(index, 1);
|
|
58
|
+
constructor(_engine, _scene, _api, _sharedCache) {
|
|
59
|
+
//@internal
|
|
60
|
+
(0, _defineProperty2.default)(this, _ref, (_initProto(this), (0, _logger.createLogger)({
|
|
61
|
+
prefix: 'FcrStreamControlImpl'
|
|
62
|
+
})));
|
|
63
|
+
//@internal
|
|
64
|
+
(0, _defineProperty2.default)(this, "_observable", new _imports.AgoraObservable());
|
|
65
|
+
//@internal
|
|
66
|
+
(0, _defineProperty2.default)(this, "_streamMapByStreamId", {});
|
|
67
|
+
//@internal
|
|
68
|
+
(0, _defineProperty2.default)(this, "_streamMapByUserId", {});
|
|
69
|
+
//@internal
|
|
70
|
+
(0, _defineProperty2.default)(this, "_streamList", []);
|
|
71
|
+
//@internal
|
|
72
|
+
(0, _defineProperty2.default)(this, "_subscribedStreamsControl", new FcrSubscribedStreamsControl());
|
|
73
|
+
//@internal
|
|
74
|
+
(0, _defineProperty2.default)(this, "_sceneObserver", {
|
|
75
|
+
onStreamsAdded: (sceneId, events) => {
|
|
76
|
+
const fcrStreamEvents = events.map(this._convertStreamEvent);
|
|
77
|
+
fcrStreamEvents.forEach(event => {
|
|
78
|
+
const stream = event.modifiedStream;
|
|
79
|
+
const exists = stream.streamId in this._streamMapByStreamId;
|
|
80
|
+
if (exists) {
|
|
81
|
+
this.logger.warn("[FcrStreamControl] stream added when the stream already exists, streamId: ".concat(stream.streamId));
|
|
82
|
+
} else {
|
|
83
|
+
this._streamList.push(stream);
|
|
84
|
+
this._streamMapByStreamId[stream.streamId] = stream;
|
|
85
|
+
this._putUserStream(stream.owner.userId, stream);
|
|
100
86
|
}
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
this.
|
|
87
|
+
});
|
|
88
|
+
this._observable.notifyObservers('onStreamsAdded', sceneId, fcrStreamEvents);
|
|
89
|
+
},
|
|
90
|
+
onStreamsRemoved: (sceneId, events) => {
|
|
91
|
+
const fcrStreamEvents = events.map(this._convertStreamEvent);
|
|
92
|
+
fcrStreamEvents.forEach(event => {
|
|
93
|
+
const stream = event.modifiedStream;
|
|
94
|
+
const exists = stream.streamId in this._streamMapByStreamId;
|
|
95
|
+
if (!exists) {
|
|
96
|
+
this.logger.warn("[FcrStreamControl] stream removed when the stream does not exist, streamId: ".concat(stream.streamId));
|
|
97
|
+
} else {
|
|
98
|
+
const index = this._streamList.findIndex(s => stream.streamId === s.streamId);
|
|
99
|
+
if (index !== -1) {
|
|
100
|
+
this._streamList.splice(index, 1);
|
|
101
|
+
}
|
|
102
|
+
delete this._streamMapByStreamId[stream.streamId];
|
|
103
|
+
this._deleteUserStream(stream.owner.userId, stream);
|
|
104
|
+
}
|
|
105
|
+
});
|
|
106
|
+
this._observable.notifyObservers('onStreamsRemoved', sceneId, fcrStreamEvents);
|
|
107
|
+
},
|
|
108
|
+
onStreamsUpdated: (sceneId, events) => {
|
|
109
|
+
const fcrStreamEvents = events.map(this._convertStreamEvent);
|
|
110
|
+
fcrStreamEvents.forEach(event => {
|
|
111
|
+
const stream = event.modifiedStream;
|
|
112
|
+
const exists = stream.streamId in this._streamMapByStreamId;
|
|
113
|
+
if (!exists) {
|
|
114
|
+
this.logger.warn("[FcrStreamControl] stream updated when the stream does not exist, streamId: ".concat(stream.streamId));
|
|
115
|
+
} else {
|
|
116
|
+
const index = this._streamList.findIndex(s => stream.streamId === s.streamId);
|
|
117
|
+
if (index !== -1) {
|
|
118
|
+
this._streamList.splice(index, 1, stream);
|
|
119
|
+
}
|
|
120
|
+
this._streamMapByStreamId[stream.streamId] = stream;
|
|
121
|
+
this._setUserStream(stream.owner.userId, stream);
|
|
118
122
|
}
|
|
119
|
-
|
|
120
|
-
|
|
123
|
+
});
|
|
124
|
+
this._observable.notifyObservers('onStreamsUpdated', sceneId, fcrStreamEvents);
|
|
125
|
+
},
|
|
126
|
+
onLocalVideoStatsUpdated: (sceneId, streamId, stats) => {
|
|
127
|
+
this._observable.notifyObservers('onLocalVideoStatsUpdated', sceneId, streamId, stats);
|
|
128
|
+
},
|
|
129
|
+
onLocalAudioStatsUpdated: (sceneId, streamId, stats) => {
|
|
130
|
+
this._observable.notifyObservers('onLocalAudioStatsUpdated', sceneId, streamId, stats);
|
|
131
|
+
},
|
|
132
|
+
onRemoteVideoStatsUpdated: (sceneId, streamId, stats) => {
|
|
133
|
+
this._observable.notifyObservers('onRemoteVideoStatsUpdated', sceneId, streamId, stats);
|
|
134
|
+
},
|
|
135
|
+
onRemoteAudioStatsUpdated: (sceneId, streamId, stats) => {
|
|
136
|
+
this._observable.notifyObservers('onRemoteAudioStatsUpdated', sceneId, streamId, stats);
|
|
137
|
+
},
|
|
138
|
+
onFirstRemoteVideoFrameRendered: (sceneId, streamId) => {
|
|
139
|
+
this._observable.notifyObservers('onFirstRemoteVideoFrameRendered', sceneId, streamId);
|
|
140
|
+
}
|
|
141
|
+
});
|
|
142
|
+
//@internal
|
|
143
|
+
(0, _defineProperty2.default)(this, "_addSceneStreamPlayerObserver", {
|
|
144
|
+
onRemoteAudioStreamVolumeUpdated: (streamId, volume) => this._observable.notifyObservers('onStreamVolumeIndicationUpdated', this._scene.sceneId, streamId, volume)
|
|
145
|
+
});
|
|
146
|
+
(0, _defineProperty2.default)(this, "_convertStreamInfo", info => {
|
|
147
|
+
return {
|
|
148
|
+
streamId: info.streamId,
|
|
149
|
+
streamName: info.streamName,
|
|
150
|
+
owner: (0, _user.convertRteUserToFcrUser)(info.owner, this._roomCache),
|
|
151
|
+
streamType: info.streamType,
|
|
152
|
+
videoSourceType: info.videoSourceType,
|
|
153
|
+
audioSourceType: info.audioSourceType,
|
|
154
|
+
videoSourceState: info.videoSourceState,
|
|
155
|
+
audioSourceState: info.audioSourceState,
|
|
156
|
+
videoSourceId: info.videoSourceId,
|
|
157
|
+
audioSourceId: info.audioSourceId,
|
|
158
|
+
connectorType: info.connectorType
|
|
159
|
+
};
|
|
160
|
+
});
|
|
161
|
+
(0, _defineProperty2.default)(this, "_getPublishStateByPrivilege", privilege => {
|
|
162
|
+
return privilege === _imports.AgoraRteStreamPrivilegeOperation.HAS_PRIVILEGE ? 1 : privilege === _imports.AgoraRteStreamPrivilegeOperation.NOPRIVILEGE ? 0 : undefined;
|
|
163
|
+
});
|
|
164
|
+
(0, _defineProperty2.default)(this, "_convertStreamEvent", event => {
|
|
165
|
+
return {
|
|
166
|
+
modifiedStream: this._convertStreamInfo(event.modifiedStream),
|
|
167
|
+
operatorUser: event.operatorUser ? (0, _user.convertRteUserToFcrUser)(event.operatorUser, this._roomCache) : undefined,
|
|
168
|
+
cause: event.cause
|
|
169
|
+
};
|
|
170
|
+
});
|
|
171
|
+
(0, _defineProperty2.default)(this, "_putUserStream", (userId, stream) => {
|
|
172
|
+
if (!this._streamMapByUserId[userId]) {
|
|
173
|
+
this._streamMapByUserId[userId] = [];
|
|
174
|
+
}
|
|
175
|
+
this._streamMapByUserId[userId].push(stream);
|
|
176
|
+
});
|
|
177
|
+
(0, _defineProperty2.default)(this, "_setUserStream", (userId, stream) => {
|
|
178
|
+
const streams = this._streamMapByUserId[userId];
|
|
179
|
+
if (streams) {
|
|
180
|
+
const index = streams.findIndex(s => s.streamId === stream.streamId);
|
|
181
|
+
if (index !== -1) {
|
|
182
|
+
streams.splice(index, 1, stream);
|
|
121
183
|
}
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
},
|
|
137
|
-
onFirstRemoteVideoFrameRendered: (sceneId, streamId) => {
|
|
138
|
-
this._observable.notifyObservers('onFirstRemoteVideoFrameRendered', sceneId, streamId);
|
|
139
|
-
}
|
|
140
|
-
};
|
|
141
|
-
//@internal
|
|
142
|
-
_addSceneStreamPlayerObserver = {
|
|
143
|
-
onRemoteAudioStreamVolumeUpdated: (streamId, volume) => this._observable.notifyObservers('onStreamVolumeIndicationUpdated', this._scene.sceneId, streamId, volume)
|
|
144
|
-
};
|
|
145
|
-
constructor(_engine, _scene, _api, _sharedCache) {
|
|
184
|
+
}
|
|
185
|
+
});
|
|
186
|
+
(0, _defineProperty2.default)(this, "_deleteUserStream", (userId, stream) => {
|
|
187
|
+
const userStreams = this._streamMapByUserId[userId];
|
|
188
|
+
if (userStreams) {
|
|
189
|
+
const index = userStreams.findIndex(s => s.streamId === stream.streamId);
|
|
190
|
+
if (index !== -1) {
|
|
191
|
+
userStreams.splice(index, 1);
|
|
192
|
+
}
|
|
193
|
+
if (userStreams.length === 0) {
|
|
194
|
+
delete this._streamMapByUserId[userId];
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
});
|
|
146
198
|
this._engine = _engine;
|
|
147
199
|
this._scene = _scene;
|
|
148
200
|
this._api = _api;
|
|
@@ -181,18 +233,20 @@ class FcrStreamControlImpl {
|
|
|
181
233
|
}
|
|
182
234
|
}
|
|
183
235
|
async addLocalStreams(streams) {
|
|
184
|
-
const streamCreateResult = await (0, _error.handleRequestError)(() => this._api.createStreamBatch(this._scene.sceneId, streams.map(config =>
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
236
|
+
const streamCreateResult = await (0, _error.handleRequestError)(() => this._api.createStreamBatch(this._scene.sceneId, streams.map(config => {
|
|
237
|
+
var _config$generateToken;
|
|
238
|
+
return _objectSpread({
|
|
239
|
+
streamName: config.streamName,
|
|
240
|
+
streamUuid: '0',
|
|
241
|
+
// means that this stream needs to be created
|
|
242
|
+
generateToken: (_config$generateToken = config.generateToken) !== null && _config$generateToken !== void 0 ? _config$generateToken : config.videoSourceType === _imports.AgoraRteVideoSourceType.SCREEN,
|
|
243
|
+
userUuid: config.ownerId,
|
|
244
|
+
videoSourceType: config.videoSourceType,
|
|
245
|
+
audioSourceType: config.audioSourceType,
|
|
246
|
+
videoSourceUuid: config.videoSourceId,
|
|
247
|
+
audioSourceUuid: config.audioSourceId
|
|
248
|
+
}, (0, _imports.convertStreamTypeToPublishState)(config.streamType));
|
|
249
|
+
})), _imports.ErrorModuleCode.FCR_ROOM_STREAM, 'add local streams failed');
|
|
196
250
|
|
|
197
251
|
// 处理需要 token 的流
|
|
198
252
|
this._handleStreamTokensPreparation(streams, streamCreateResult.data);
|
|
@@ -280,7 +334,7 @@ class FcrStreamControlImpl {
|
|
|
280
334
|
}
|
|
281
335
|
startRenderRemoteVideoStream(streamId, type, config, element) {
|
|
282
336
|
const startTime = Date.now();
|
|
283
|
-
const parameters =
|
|
337
|
+
const parameters = "streamId: ".concat(streamId, ", config: ").concat(JSON.stringify(config), ", type: ").concat(type, ", element: ").concat(element);
|
|
284
338
|
|
|
285
339
|
// 将 FcrVideoStreamType 转换为 AgoraRteStreamLayer
|
|
286
340
|
const streamLayer = this._convertToStreamLayer(type);
|
|
@@ -291,13 +345,13 @@ class FcrStreamControlImpl {
|
|
|
291
345
|
this._subscribedStreamsControl.bind(viewId, streamId);
|
|
292
346
|
return _type.FcrReturnCode.SUCCESS;
|
|
293
347
|
} catch (error) {
|
|
294
|
-
this.logger.error(
|
|
348
|
+
this.logger.error("[FcrStreamControl][start-render-remote-video-stream] render failed, streamId: ".concat(streamId, ", error: ").concat(error, ", parameters: ").concat(parameters, ", duration: ").concat(Date.now() - startTime, "ms"));
|
|
295
349
|
throw error;
|
|
296
350
|
}
|
|
297
351
|
}
|
|
298
352
|
stopRenderRemoteVideoStream(streamId, element) {
|
|
299
353
|
const startTime = Date.now();
|
|
300
|
-
const parameters =
|
|
354
|
+
const parameters = "streamId: ".concat(streamId, ", element: ").concat(element);
|
|
301
355
|
try {
|
|
302
356
|
this._scene.streamPlayer.stopRenderRemoteVideoStream(streamId, element);
|
|
303
357
|
const viewId = this._subscribedStreamsControl.getViewId(element);
|
|
@@ -306,11 +360,11 @@ class FcrStreamControlImpl {
|
|
|
306
360
|
if (shouldUnsubscribe) {
|
|
307
361
|
this._scene.streamPlayer.unsubscribeRemoteVideoStream(streamId);
|
|
308
362
|
} else {
|
|
309
|
-
this.logger.info(
|
|
363
|
+
this.logger.info("[FcrStreamControl][unsubscribe-remote-video-stream] still has other views, do not unsubscribe, streamId: ".concat(streamId, ", parameters: ").concat(parameters, ", duration: ").concat(Date.now() - startTime, "ms"));
|
|
310
364
|
}
|
|
311
365
|
return _type.FcrReturnCode.SUCCESS;
|
|
312
366
|
} catch (error) {
|
|
313
|
-
this.logger.error(
|
|
367
|
+
this.logger.error("[FcrStreamControl][stop-render-remote-video-stream] stop render failed, streamId: ".concat(streamId, ", error: ").concat(error, ", parameters: ").concat(parameters, ", duration: ").concat(Date.now() - startTime, "ms"));
|
|
314
368
|
throw error;
|
|
315
369
|
}
|
|
316
370
|
}
|
|
@@ -327,14 +381,14 @@ class FcrStreamControlImpl {
|
|
|
327
381
|
const res = await (0, _error.handleRequestError)(() => this._api.startShareScreen({
|
|
328
382
|
roomId: this._scene.sceneId,
|
|
329
383
|
userId: this._scene.getLocalUser().getLocalUserId(),
|
|
330
|
-
config: {
|
|
384
|
+
config: _objectSpread(_objectSpread({
|
|
331
385
|
videoSourceType: _type.FcrVideoSourceType.SCREEN,
|
|
332
386
|
audioSourceType: _type.FcrAudioSourceType.LOOPBACK,
|
|
333
387
|
videoSourceState: _type.FcrMediaSourceState.CLOSE,
|
|
334
388
|
audioSourceState: _type.FcrMediaSourceState.CLOSE,
|
|
335
389
|
videoSourceUuid: config.videoSourceId,
|
|
336
|
-
audioSourceUuid: config.audioSourceId
|
|
337
|
-
|
|
390
|
+
audioSourceUuid: config.audioSourceId
|
|
391
|
+
}, (0, _imports.convertStreamTypeToPublishState)(config.streamType)), {}, {
|
|
338
392
|
annotation: size ? {
|
|
339
393
|
size: {
|
|
340
394
|
width: size.width,
|
|
@@ -346,14 +400,11 @@ class FcrStreamControlImpl {
|
|
|
346
400
|
height: 0
|
|
347
401
|
}
|
|
348
402
|
}
|
|
349
|
-
}
|
|
403
|
+
})
|
|
350
404
|
}), _imports.ErrorModuleCode.FCR_ROOM_STREAM, 'add local screen stream failed');
|
|
351
|
-
const
|
|
352
|
-
data
|
|
353
|
-
|
|
354
|
-
streamUuid: streamId
|
|
355
|
-
}
|
|
356
|
-
} = res;
|
|
405
|
+
const _res$data = res.data,
|
|
406
|
+
token = _res$data.rtcToken,
|
|
407
|
+
streamId = _res$data.streamUuid;
|
|
357
408
|
this._screenStreamId = streamId;
|
|
358
409
|
this._scene.localUser.prepareToPublishStream(streamId, token);
|
|
359
410
|
if (labels) {
|
|
@@ -367,7 +418,7 @@ class FcrStreamControlImpl {
|
|
|
367
418
|
let localUserId;
|
|
368
419
|
try {
|
|
369
420
|
localUserId = this._scene.localUser.getLocalUserId();
|
|
370
|
-
} catch {
|
|
421
|
+
} catch (_unused) {
|
|
371
422
|
// localUser 已被清除(房间已结束),无需调用 API
|
|
372
423
|
this.logger.warn('removeScreenStream: localUser not exist, skip API call');
|
|
373
424
|
if (this._screenStreamId) {
|
|
@@ -386,7 +437,7 @@ class FcrStreamControlImpl {
|
|
|
386
437
|
try {
|
|
387
438
|
this._scene.localUser.removePreparePublishStream(this._screenStreamId);
|
|
388
439
|
} catch (e) {
|
|
389
|
-
this.logger.warn(
|
|
440
|
+
this.logger.warn("removeScreenStream: localUser not exist ".concat(JSON.stringify(e), " "));
|
|
390
441
|
}
|
|
391
442
|
}
|
|
392
443
|
return res;
|
|
@@ -427,39 +478,14 @@ class FcrStreamControlImpl {
|
|
|
427
478
|
this._observable.removeAllObservers();
|
|
428
479
|
}
|
|
429
480
|
async findSelectionByParamId(paramSourceId) {
|
|
430
|
-
|
|
431
|
-
const
|
|
481
|
+
var _this$_mediaControl, _this$_mediaControl2;
|
|
482
|
+
const wins = (await ((_this$_mediaControl = this._mediaControl) === null || _this$_mediaControl === void 0 ? void 0 : _this$_mediaControl.getWindowList())) || [];
|
|
483
|
+
const displays = (await ((_this$_mediaControl2 = this._mediaControl) === null || _this$_mediaControl2 === void 0 ? void 0 : _this$_mediaControl2.getDisplayList())) || [];
|
|
432
484
|
const findInList = list => list.find(item => item.id === paramSourceId);
|
|
433
485
|
const winMatch = findInList(wins);
|
|
434
486
|
const displayMatch = findInList(displays);
|
|
435
487
|
return winMatch || displayMatch || null;
|
|
436
488
|
}
|
|
437
|
-
_convertStreamInfo = info => {
|
|
438
|
-
return {
|
|
439
|
-
streamId: info.streamId,
|
|
440
|
-
streamName: info.streamName,
|
|
441
|
-
owner: (0, _user.convertRteUserToFcrUser)(info.owner, this._roomCache),
|
|
442
|
-
streamType: info.streamType,
|
|
443
|
-
videoSourceType: info.videoSourceType,
|
|
444
|
-
audioSourceType: info.audioSourceType,
|
|
445
|
-
videoSourceState: info.videoSourceState,
|
|
446
|
-
audioSourceState: info.audioSourceState,
|
|
447
|
-
videoSourceId: info.videoSourceId,
|
|
448
|
-
audioSourceId: info.audioSourceId,
|
|
449
|
-
connectorType: info.connectorType
|
|
450
|
-
};
|
|
451
|
-
};
|
|
452
|
-
_getPublishStateByPrivilege = privilege => {
|
|
453
|
-
return privilege === _imports.AgoraRteStreamPrivilegeOperation.HAS_PRIVILEGE ? 1 : privilege === _imports.AgoraRteStreamPrivilegeOperation.NOPRIVILEGE ? 0 : undefined;
|
|
454
|
-
};
|
|
455
|
-
_convertStreamEvent = event => {
|
|
456
|
-
return {
|
|
457
|
-
modifiedStream: this._convertStreamInfo(event.modifiedStream),
|
|
458
|
-
operatorUser: event.operatorUser ? (0, _user.convertRteUserToFcrUser)(event.operatorUser, this._roomCache) : undefined,
|
|
459
|
-
cause: event.cause
|
|
460
|
-
};
|
|
461
|
-
};
|
|
462
|
-
|
|
463
489
|
/**
|
|
464
490
|
* 将 FcrVideoStreamType 转换为 AgoraRteStreamLayer
|
|
465
491
|
* @param streamType - FcrVideoStreamType (HIGH_STREAM=0, LOW_STREAM=1)
|
|
@@ -469,33 +495,6 @@ class FcrStreamControlImpl {
|
|
|
469
495
|
_convertToStreamLayer(streamType) {
|
|
470
496
|
return streamType === _type.FcrVideoStreamType.HIGH_STREAM ? _imports.AgoraRteStreamLayer.HIGH : _imports.AgoraRteStreamLayer.LOW;
|
|
471
497
|
}
|
|
472
|
-
_putUserStream = (userId, stream) => {
|
|
473
|
-
if (!this._streamMapByUserId[userId]) {
|
|
474
|
-
this._streamMapByUserId[userId] = [];
|
|
475
|
-
}
|
|
476
|
-
this._streamMapByUserId[userId].push(stream);
|
|
477
|
-
};
|
|
478
|
-
_setUserStream = (userId, stream) => {
|
|
479
|
-
const streams = this._streamMapByUserId[userId];
|
|
480
|
-
if (streams) {
|
|
481
|
-
const index = streams.findIndex(s => s.streamId === stream.streamId);
|
|
482
|
-
if (index !== -1) {
|
|
483
|
-
streams.splice(index, 1, stream);
|
|
484
|
-
}
|
|
485
|
-
}
|
|
486
|
-
};
|
|
487
|
-
_deleteUserStream = (userId, stream) => {
|
|
488
|
-
const userStreams = this._streamMapByUserId[userId];
|
|
489
|
-
if (userStreams) {
|
|
490
|
-
const index = userStreams.findIndex(s => s.streamId === stream.streamId);
|
|
491
|
-
if (index !== -1) {
|
|
492
|
-
userStreams.splice(index, 1);
|
|
493
|
-
}
|
|
494
|
-
if (userStreams.length === 0) {
|
|
495
|
-
delete this._streamMapByUserId[userId];
|
|
496
|
-
}
|
|
497
|
-
}
|
|
498
|
-
};
|
|
499
498
|
_addLogObserver() {
|
|
500
499
|
this.addObserver((0, _logger.generateLogObserver)(this.logger, [
|
|
501
500
|
// 'onLocalVideoStatsUpdated',
|
|
@@ -508,17 +507,22 @@ class FcrStreamControlImpl {
|
|
|
508
507
|
}
|
|
509
508
|
}
|
|
510
509
|
exports.FcrStreamControlImpl = FcrStreamControlImpl;
|
|
510
|
+
_FcrStreamControlImpl = FcrStreamControlImpl;
|
|
511
|
+
var _applyDecs$e = (0, _slicedToArray2.default)(_applyDecs(_FcrStreamControlImpl, [[_imports.bound, 2, "getStreams"], [_imports.bound, 2, "getStreamList"], [_imports.bound, 2, "getStreamsByUserId"], [_imports.bound, 2, "getStreamByStreamId"], [_addLocalStreamsDecs, 2, "addLocalStreams"], [_bindLocalStreamsDecs, 2, "bindLocalStreams"], [_updatePublishPrivilegeOfStreamsDecs, 2, "updatePublishPrivilegeOfStreams"], [_updatePublishPrivilegeOfStreamsByScopeDecs, 2, "updatePublishPrivilegeOfStreamsByScope"], [_removeStreamsDecs, 2, "removeStreams"], [_setVideoEncoderConfigDecs, 2, "setVideoEncoderConfig"], [_setDualStreamModeDecs, 2, "setDualStreamMode"], [_setScreenScenarioDecs, 2, "setScreenScenario"], [_startRenderRemoteVideoStreamDecs, 2, "startRenderRemoteVideoStream"], [_stopRenderRemoteVideoStreamDecs, 2, "stopRenderRemoteVideoStream"], [_startPlayRemoteAudioStreamDecs, 2, "startPlayRemoteAudioStream"], [_stopPlayRemoteAudioStreamDecs, 2, "stopPlayRemoteAudioStream"], [_takeSnapshotDecs, 2, "takeSnapshot"], [_addLocalScreenStreamDecs, 2, "addLocalScreenStream"], [[_imports.bound, _imports.trace], 2, "removeScreenStream"], [_adjustRemoteAudioStreamVolumeDecs, 2, "adjustRemoteAudioStreamVolume"], [_mergeAudioStreamDecs, 2, "mergeAudioStream"], [_splitAudioStreamDecs, 2, "splitAudioStream"], [_imports.trace, 2, "release"]], []).e, 1);
|
|
512
|
+
_initProto = _applyDecs$e[0];
|
|
511
513
|
class FcrSubscribedStreamsControl {
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
514
|
+
constructor() {
|
|
515
|
+
(0, _defineProperty2.default)(this, "logger", (0, _logger.createLogger)({
|
|
516
|
+
prefix: 'StreamSubscriptionManager'
|
|
517
|
+
}));
|
|
518
|
+
//@internal
|
|
519
|
+
/**
|
|
520
|
+
* Map of remote subscribed streams to their bound view IDs
|
|
521
|
+
* key: streamId - The ID of the remote video stream
|
|
522
|
+
* value: string[] - Array of viewIds bound to this stream
|
|
523
|
+
*/
|
|
524
|
+
(0, _defineProperty2.default)(this, "_remoteSubscribedStreamRenderMap", new Map());
|
|
525
|
+
}
|
|
522
526
|
getViewId(element) {
|
|
523
527
|
// Adapt for harmony: AgoraRteRenderView is string in harmony, HTMLElement in web
|
|
524
528
|
if (typeof element === 'string') {
|
|
@@ -541,7 +545,7 @@ class FcrSubscribedStreamsControl {
|
|
|
541
545
|
}
|
|
542
546
|
bind(viewId, streamId) {
|
|
543
547
|
if (!streamId || !viewId) {
|
|
544
|
-
this.logger.warn(
|
|
548
|
+
this.logger.warn("[FcrStreamControl][bind-view-to-stream] invalid parameters, streamId: ".concat(streamId, ", viewId: ").concat(viewId));
|
|
545
549
|
return;
|
|
546
550
|
}
|
|
547
551
|
const viewIds = this._remoteSubscribedStreamRenderMap.get(streamId) || [];
|
|
@@ -550,17 +554,17 @@ class FcrSubscribedStreamsControl {
|
|
|
550
554
|
viewIds.push(viewId);
|
|
551
555
|
this._remoteSubscribedStreamRenderMap.set(streamId, viewIds);
|
|
552
556
|
} else {
|
|
553
|
-
this.logger.warn(
|
|
557
|
+
this.logger.warn("[FcrStreamControl][bind-view-to-stream] viewId already bound, streamId: ".concat(streamId, ", viewId: ").concat(viewId));
|
|
554
558
|
}
|
|
555
559
|
}
|
|
556
560
|
unbind(viewId, streamId) {
|
|
557
561
|
if (!streamId || !viewId) {
|
|
558
|
-
this.logger.warn(
|
|
562
|
+
this.logger.warn("[FcrStreamControl][unbind-view-from-stream] invalid parameters, streamId: ".concat(streamId, ", viewId: ").concat(viewId));
|
|
559
563
|
return;
|
|
560
564
|
}
|
|
561
565
|
const viewIds = this._remoteSubscribedStreamRenderMap.get(streamId);
|
|
562
566
|
if (!viewIds || !viewIds.includes(viewId)) {
|
|
563
|
-
this.logger.warn(
|
|
567
|
+
this.logger.warn("[FcrStreamControl][unbind-view-from-stream] viewId not found, streamId: ".concat(streamId, ", viewId: ").concat(viewId));
|
|
564
568
|
return;
|
|
565
569
|
}
|
|
566
570
|
const rest = viewIds.filter(id => id !== viewId);
|
|
@@ -4,6 +4,16 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.deCompressGzipToJson = deCompressGzipToJson;
|
|
7
|
+
require("core-js/modules/es.error.cause.js");
|
|
8
|
+
require("core-js/modules/es.array-buffer.constructor.js");
|
|
9
|
+
require("core-js/modules/es.array-buffer.slice.js");
|
|
10
|
+
require("core-js/modules/es.typed-array.uint8-array.js");
|
|
11
|
+
require("core-js/modules/es.typed-array.at.js");
|
|
12
|
+
require("core-js/modules/es.typed-array.fill.js");
|
|
13
|
+
require("core-js/modules/es.typed-array.find-last.js");
|
|
14
|
+
require("core-js/modules/es.typed-array.find-last-index.js");
|
|
15
|
+
require("core-js/modules/es.typed-array.set.js");
|
|
16
|
+
require("core-js/modules/es.typed-array.sort.js");
|
|
7
17
|
require("core-js/modules/es.typed-array.to-reversed.js");
|
|
8
18
|
require("core-js/modules/es.typed-array.to-sorted.js");
|
|
9
19
|
require("core-js/modules/es.typed-array.with.js");
|