fcr-core 3.7.5 → 3.7.7-rc.1
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/chat-connection/index.js +34 -20
- package/lib/engine/index.js +62 -69
- package/lib/imports.js +1 -0
- package/lib/media-control/desktop.js +13 -8
- package/lib/media-control/mobile.js +17 -12
- package/lib/monitor-control/index.js +9 -4
- package/lib/peer-session/index.js +47 -38
- package/lib/plugins/chatroom.js +217 -202
- package/lib/room-control/ability-control/index.js +13 -8
- package/lib/room-control/group-control/index.js +20 -15
- package/lib/room-control/helpers/validation-helper.js +1 -1
- package/lib/room-control/index.js +53 -36
- package/lib/room-control/interpreter-control/index.js +23 -17
- 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 +24 -16
- package/lib/room-control/privilege-control/helper.js +8 -5
- package/lib/room-control/privilege-control/index.js +25 -18
- package/lib/room-control/room-connector-control/index.js +22 -15
- package/lib/room-control/room-control-factory.js +2 -1
- package/lib/room-control/room-session/index.js +47 -38
- package/lib/room-control/shared-cache.js +36 -29
- package/lib/room-control/sharing-control/index.js +40 -29
- package/lib/room-control/stream-control/index.js +177 -172
- package/lib/room-control/user-control/index.js +142 -135
- package/lib/room-control/waitingroom-control/index.js +13 -8
- package/lib/room-control/whiteboard-control-v2/annotation-control/control.js +25 -18
- package/lib/room-control/whiteboard-control-v2/annotation-control/index.js +26 -15
- package/lib/room-control/whiteboard-control-v2/annotation-control/privilege-control.js +62 -52
- package/lib/room-control/whiteboard-control-v2/index.js +35 -24
- package/lib/room-control/whiteboard-control-v2/main-window.js +27 -22
- package/lib/room-control/whiteboard-control-v2/utils.js +5 -5
- package/lib/room-control/whiteboard-control-v2/whiteboard-control/control.js +32 -23
- package/lib/room-control/whiteboard-control-v2/whiteboard-control/index.js +5 -3
- package/lib/room-control/whiteboard-control-v2/whiteboard-control/privilege-control.js +53 -41
- package/lib/room-router/index.js +67 -34
- package/lib/room-router/type.d.ts +4 -0
- package/lib/service/api.d.ts +12 -1
- package/lib/service/api.js +98 -88
- package/lib/utilities/collection.js +3 -2
- package/lib/utilities/error-helpers.js +32 -26
- package/lib/utilities/error.js +9 -8
- package/lib/utilities/join-helper.js +22 -18
- package/lib/utilities/logger.js +2 -2
- package/lib/utilities/parameters.js +8 -4
- package/lib/utilities/retry-helpers.js +1 -0
- package/lib/utilities/shared-storage.js +1 -0
- package/lib/utilities/storage.js +1 -0
- package/lib/utilities/stream.js +16 -11
- package/lib/utilities/user.js +4 -3
- package/lib/utilities/validate-params.js +2 -1
- package/package.json +4 -4
|
@@ -1,13 +1,19 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
require("core-js/modules/es.symbol.description.js");
|
|
3
4
|
require("core-js/modules/es.array.push.js");
|
|
4
5
|
require("core-js/modules/esnext.function.metadata.js");
|
|
6
|
+
require("core-js/modules/esnext.iterator.constructor.js");
|
|
7
|
+
require("core-js/modules/esnext.iterator.filter.js");
|
|
8
|
+
require("core-js/modules/esnext.iterator.for-each.js");
|
|
5
9
|
require("core-js/modules/esnext.symbol.metadata.js");
|
|
6
10
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
7
11
|
Object.defineProperty(exports, "__esModule", {
|
|
8
12
|
value: true
|
|
9
13
|
});
|
|
10
14
|
exports.FcrRoomSessionControlImpl = void 0;
|
|
15
|
+
require("core-js/modules/es.error.cause.js");
|
|
16
|
+
require("core-js/modules/es.json.stringify.js");
|
|
11
17
|
require("core-js/modules/esnext.map.delete-all.js");
|
|
12
18
|
require("core-js/modules/esnext.map.emplace.js");
|
|
13
19
|
require("core-js/modules/esnext.map.every.js");
|
|
@@ -22,13 +28,17 @@ require("core-js/modules/esnext.map.merge.js");
|
|
|
22
28
|
require("core-js/modules/esnext.map.reduce.js");
|
|
23
29
|
require("core-js/modules/esnext.map.some.js");
|
|
24
30
|
require("core-js/modules/esnext.map.update.js");
|
|
31
|
+
require("core-js/modules/web.dom-collections.iterator.js");
|
|
32
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
25
33
|
var _imports = require("../../imports");
|
|
26
34
|
var _error = require("../../utilities/error");
|
|
27
35
|
var _logger = require("../../utilities/logger");
|
|
28
36
|
var _validateParams = _interopRequireDefault(require("../../utilities/validate-params"));
|
|
29
37
|
var _schema = require("../../schema");
|
|
30
|
-
var
|
|
31
|
-
let _initProto, _startRoomSessionDecs, _stopRoomSessionDecs, _acceptRoomSessionDecs, _rejectRoomSessionDecs;
|
|
38
|
+
var _FcrRoomSessionControlImpl;
|
|
39
|
+
let _initProto, _startRoomSessionDecs, _stopRoomSessionDecs, _acceptRoomSessionDecs, _rejectRoomSessionDecs, _ref;
|
|
40
|
+
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; }
|
|
41
|
+
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; }
|
|
32
42
|
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)]; } }; }
|
|
33
43
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
34
44
|
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); }
|
|
@@ -37,22 +47,21 @@ function _checkInRHS(e) { if (Object(e) !== e) throw TypeError("right-hand side
|
|
|
37
47
|
/**
|
|
38
48
|
* @internal
|
|
39
49
|
*/
|
|
50
|
+
_ref = (_startRoomSessionDecs = [_imports.trace, (0, _validateParams.default)(_schema.fcrRoomSessionParamsSchema)], _stopRoomSessionDecs = [_imports.trace, (0, _validateParams.default)(_schema.stringSchema)], _acceptRoomSessionDecs = [_imports.trace, (0, _validateParams.default)(_schema.fcrSessionBaseSchema, _schema.stringKeyUnknownValueSchema.optional())], _rejectRoomSessionDecs = [_imports.trace, (0, _validateParams.default)(_schema.fcrSessionBaseSchema, _schema.stringKeyUnknownValueSchema.optional())], "logger");
|
|
40
51
|
class FcrRoomSessionControlImpl {
|
|
41
|
-
//@internal
|
|
42
|
-
[(_startRoomSessionDecs = [_imports.trace, (0, _validateParams.default)(_schema.fcrRoomSessionParamsSchema)], _stopRoomSessionDecs = [_imports.trace, (0, _validateParams.default)(_schema.stringSchema)], _acceptRoomSessionDecs = [_imports.trace, (0, _validateParams.default)(_schema.fcrSessionBaseSchema, _schema.stringKeyUnknownValueSchema.optional())], _rejectRoomSessionDecs = [_imports.trace, (0, _validateParams.default)(_schema.fcrSessionBaseSchema, _schema.stringKeyUnknownValueSchema.optional())], "logger")] = (() => (_initProto(this), (0, _logger.createLogger)({
|
|
43
|
-
prefix: 'FcrRoomSessionControlImpl'
|
|
44
|
-
})))();
|
|
45
|
-
//@internal
|
|
46
|
-
_observable = (() => new _imports.AgoraObservable())();
|
|
47
|
-
//@internal
|
|
48
|
-
_taskInterval = (() => _imports.Duration.second(1))();
|
|
49
|
-
//@internal
|
|
50
|
-
|
|
51
|
-
//@internal
|
|
52
|
-
_scheduleMap = (() => new Map())();
|
|
53
|
-
//@internal
|
|
54
|
-
_receivedMap = (() => new Map())();
|
|
55
52
|
constructor(_roomControl, _api, _userId) {
|
|
53
|
+
//@internal
|
|
54
|
+
(0, _defineProperty2.default)(this, _ref, (_initProto(this), (0, _logger.createLogger)({
|
|
55
|
+
prefix: 'FcrRoomSessionControlImpl'
|
|
56
|
+
})));
|
|
57
|
+
//@internal
|
|
58
|
+
(0, _defineProperty2.default)(this, "_observable", new _imports.AgoraObservable());
|
|
59
|
+
//@internal
|
|
60
|
+
(0, _defineProperty2.default)(this, "_taskInterval", _imports.Duration.second(1));
|
|
61
|
+
//@internal
|
|
62
|
+
(0, _defineProperty2.default)(this, "_scheduleMap", new Map());
|
|
63
|
+
//@internal
|
|
64
|
+
(0, _defineProperty2.default)(this, "_receivedMap", new Map());
|
|
56
65
|
this._roomControl = _roomControl;
|
|
57
66
|
this._api = _api;
|
|
58
67
|
this._userId = _userId;
|
|
@@ -66,7 +75,7 @@ class FcrRoomSessionControlImpl {
|
|
|
66
75
|
async startRoomSession(params) {
|
|
67
76
|
try {
|
|
68
77
|
const session = {
|
|
69
|
-
sessionId: (0, _imports.md5)(
|
|
78
|
+
sessionId: (0, _imports.md5)("".concat(Date.now())),
|
|
70
79
|
sessionKey: params.sessionKey,
|
|
71
80
|
payload: params.payload,
|
|
72
81
|
duration: params.duration,
|
|
@@ -85,12 +94,11 @@ class FcrRoomSessionControlImpl {
|
|
|
85
94
|
targetId: this._roomControl.getRoomInfo().roomId
|
|
86
95
|
});
|
|
87
96
|
const nextTs = Date.now() + interval;
|
|
88
|
-
this._scheduleMap.set(session.sessionId, {
|
|
89
|
-
...params,
|
|
97
|
+
this._scheduleMap.set(session.sessionId, _objectSpread(_objectSpread({}, params), {}, {
|
|
90
98
|
nextTs,
|
|
91
99
|
startTs: Date.now()
|
|
92
|
-
});
|
|
93
|
-
this.logger.info(
|
|
100
|
+
}));
|
|
101
|
+
this.logger.info("[RoomSession] put into session schedule: ".concat(session.sessionId, ", next ts: ").concat(nextTs, ", remain: ").concat(nextTs - Date.now(), "ms"));
|
|
94
102
|
return session.sessionId;
|
|
95
103
|
} catch (e) {
|
|
96
104
|
throw (0, _error.generateFcrCoreServerError)(_error.FcrErrorCode.LOCAL_HTTP_REQUEST_FAILED, 'start room session failed', e);
|
|
@@ -159,13 +167,13 @@ class FcrRoomSessionControlImpl {
|
|
|
159
167
|
interval: 0
|
|
160
168
|
};
|
|
161
169
|
if (this._isSessionExpired(session)) {
|
|
162
|
-
this.logger.info(
|
|
170
|
+
this.logger.info("[RoomSession] room session expired, removed: ".concat(session.sessionId));
|
|
163
171
|
this._scheduleMap.delete(session.sessionId);
|
|
164
172
|
continue;
|
|
165
173
|
}
|
|
166
174
|
// check timeout
|
|
167
175
|
if (params.nextTs < Date.now()) {
|
|
168
|
-
this.logger.info(
|
|
176
|
+
this.logger.info("[RoomSession] ping session: ".concat(session.sessionId));
|
|
169
177
|
try {
|
|
170
178
|
const {
|
|
171
179
|
data: {
|
|
@@ -181,14 +189,13 @@ class FcrRoomSessionControlImpl {
|
|
|
181
189
|
});
|
|
182
190
|
const nextTs = Date.now() + interval;
|
|
183
191
|
if (this._scheduleMap.has(session.sessionId)) {
|
|
184
|
-
this._scheduleMap.set(session.sessionId, {
|
|
185
|
-
...params,
|
|
192
|
+
this._scheduleMap.set(session.sessionId, _objectSpread(_objectSpread({}, params), {}, {
|
|
186
193
|
nextTs
|
|
187
|
-
});
|
|
188
|
-
this.logger.info(
|
|
194
|
+
}));
|
|
195
|
+
this.logger.info("[RoomSession] refresh session schedule: ".concat(session.sessionId, ", next ts: ").concat(nextTs));
|
|
189
196
|
}
|
|
190
197
|
} catch (e) {
|
|
191
|
-
this.logger.error(
|
|
198
|
+
this.logger.error("[RoomSession] ping session failed: ".concat(e));
|
|
192
199
|
}
|
|
193
200
|
}
|
|
194
201
|
}
|
|
@@ -197,7 +204,7 @@ class FcrRoomSessionControlImpl {
|
|
|
197
204
|
const session = this._receivedMap.get(key);
|
|
198
205
|
if (this._isSessionExpired(session)) {
|
|
199
206
|
this._receivedMap.delete(key);
|
|
200
|
-
this.logger.info(
|
|
207
|
+
this.logger.info("[RoomSession] delete session callback: ".concat(key));
|
|
201
208
|
}
|
|
202
209
|
}
|
|
203
210
|
}
|
|
@@ -228,7 +235,7 @@ class FcrRoomSessionControlImpl {
|
|
|
228
235
|
}
|
|
229
236
|
if (!this._isSessionExpired(session)) {
|
|
230
237
|
if (!this._receivedMap.has(session.sessionId)) {
|
|
231
|
-
this.logger.info(
|
|
238
|
+
this.logger.info("[RoomSession] received room session request ".concat(JSON.stringify(session)));
|
|
232
239
|
this._observable.notifyObservers('onRoomSessionReceived', roomId, session);
|
|
233
240
|
}
|
|
234
241
|
this._receivedMap.set(session.sessionId, session);
|
|
@@ -236,6 +243,7 @@ class FcrRoomSessionControlImpl {
|
|
|
236
243
|
} else if (cmd === '1002') {
|
|
237
244
|
if (data.action === 1) {
|
|
238
245
|
if (this._scheduleMap.has(data.sessionUuid)) {
|
|
246
|
+
var _session$payload, _ref2, _data$payload;
|
|
239
247
|
const session = this._scheduleMap.get(data.sessionUuid);
|
|
240
248
|
const sessionResponse = {
|
|
241
249
|
sessionId: data.sessionUuid,
|
|
@@ -243,15 +251,16 @@ class FcrRoomSessionControlImpl {
|
|
|
243
251
|
responderId: senderId,
|
|
244
252
|
// FIXME: session may be lost when the client refreshes
|
|
245
253
|
// get payload from original session
|
|
246
|
-
payload: session.payload
|
|
247
|
-
cause: data.payload
|
|
254
|
+
payload: (_session$payload = session.payload) !== null && _session$payload !== void 0 ? _session$payload : {},
|
|
255
|
+
cause: (_ref2 = (_data$payload = data.payload) === null || _data$payload === void 0 ? void 0 : _data$payload.cause) !== null && _ref2 !== void 0 ? _ref2 : {}
|
|
248
256
|
};
|
|
249
|
-
this.logger.info(
|
|
257
|
+
this.logger.info("[RoomSession] received room session accepted ".concat(JSON.stringify(sessionResponse)));
|
|
250
258
|
this._scheduleMap.delete(data.sessionUuid);
|
|
251
259
|
this._observable.notifyObservers('onRoomSessionAccepted', roomId, sessionResponse);
|
|
252
260
|
}
|
|
253
261
|
} else if (data.action === 2) {
|
|
254
262
|
if (this._scheduleMap.has(data.sessionUuid)) {
|
|
263
|
+
var _session$payload2, _ref3, _data$payload2;
|
|
255
264
|
const session = this._scheduleMap.get(data.sessionUuid);
|
|
256
265
|
const sessionResponse = {
|
|
257
266
|
sessionId: data.sessionUuid,
|
|
@@ -259,10 +268,10 @@ class FcrRoomSessionControlImpl {
|
|
|
259
268
|
responderId: senderId,
|
|
260
269
|
// FIXME: session may be lost when the client refreshes
|
|
261
270
|
// get payload from original session
|
|
262
|
-
payload: session.payload
|
|
263
|
-
cause: data.payload
|
|
271
|
+
payload: (_session$payload2 = session.payload) !== null && _session$payload2 !== void 0 ? _session$payload2 : {},
|
|
272
|
+
cause: (_ref3 = (_data$payload2 = data.payload) === null || _data$payload2 === void 0 ? void 0 : _data$payload2.cause) !== null && _ref3 !== void 0 ? _ref3 : {}
|
|
264
273
|
};
|
|
265
|
-
this.logger.info(
|
|
274
|
+
this.logger.info("[RoomSession] received room session rejected ".concat(JSON.stringify(sessionResponse)));
|
|
266
275
|
if (this._scheduleMap.has(data.sessionUuid)) {
|
|
267
276
|
this._scheduleMap.delete(data.sessionUuid);
|
|
268
277
|
this._observable.notifyObservers('onRoomSessionRejected', roomId, sessionResponse);
|
|
@@ -279,7 +288,7 @@ class FcrRoomSessionControlImpl {
|
|
|
279
288
|
_addLogObserver() {
|
|
280
289
|
this.addObserver((0, _logger.generateLogObserver)(this.logger, ['onRoomSessionAccepted', 'onRoomSessionRejected', 'onRoomSessionReceived']));
|
|
281
290
|
}
|
|
282
|
-
static #_ = (() => _staticBlock = () => [_initProto] = _applyDecs(this, [[_startRoomSessionDecs, 2, "startRoomSession"], [_stopRoomSessionDecs, 2, "stopRoomSession"], [_acceptRoomSessionDecs, 2, "acceptRoomSession"], [_rejectRoomSessionDecs, 2, "rejectRoomSession"]], []).e)();
|
|
283
291
|
}
|
|
284
292
|
exports.FcrRoomSessionControlImpl = FcrRoomSessionControlImpl;
|
|
285
|
-
|
|
293
|
+
_FcrRoomSessionControlImpl = FcrRoomSessionControlImpl;
|
|
294
|
+
[_initProto] = _applyDecs(_FcrRoomSessionControlImpl, [[_startRoomSessionDecs, 2, "startRoomSession"], [_stopRoomSessionDecs, 2, "stopRoomSession"], [_acceptRoomSessionDecs, 2, "acceptRoomSession"], [_rejectRoomSessionDecs, 2, "rejectRoomSession"]], []).e;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
3
4
|
Object.defineProperty(exports, "__esModule", {
|
|
4
5
|
value: true
|
|
5
6
|
});
|
|
@@ -18,38 +19,44 @@ require("core-js/modules/esnext.map.merge.js");
|
|
|
18
19
|
require("core-js/modules/esnext.map.reduce.js");
|
|
19
20
|
require("core-js/modules/esnext.map.some.js");
|
|
20
21
|
require("core-js/modules/esnext.map.update.js");
|
|
22
|
+
require("core-js/modules/web.dom-collections.iterator.js");
|
|
23
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
21
24
|
class FcrRoomCache {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
25
|
+
constructor() {
|
|
26
|
+
(0, _defineProperty2.default)(this, "_platformMapByUserId", new Map());
|
|
27
|
+
(0, _defineProperty2.default)(this, "_avatarMapByUserId", new Map());
|
|
28
|
+
(0, _defineProperty2.default)(this, "getUserPlatform", userId => {
|
|
29
|
+
return this._platformMapByUserId.get(userId);
|
|
30
|
+
});
|
|
31
|
+
(0, _defineProperty2.default)(this, "getUserAvatar", userId => {
|
|
32
|
+
return this._avatarMapByUserId.get(userId);
|
|
33
|
+
});
|
|
34
|
+
(0, _defineProperty2.default)(this, "setUserPlatform", (userId, platform) => {
|
|
35
|
+
this._platformMapByUserId.set(userId, platform);
|
|
36
|
+
});
|
|
37
|
+
(0, _defineProperty2.default)(this, "setUserAvatar", (userId, avatar) => {
|
|
38
|
+
this._avatarMapByUserId.set(userId, avatar);
|
|
39
|
+
});
|
|
40
|
+
(0, _defineProperty2.default)(this, "deleteUserPlatform", userId => {
|
|
41
|
+
this._platformMapByUserId.delete(userId);
|
|
42
|
+
});
|
|
43
|
+
(0, _defineProperty2.default)(this, "deleteUserAvatar", userId => {
|
|
44
|
+
this._avatarMapByUserId.delete(userId);
|
|
45
|
+
});
|
|
46
|
+
}
|
|
42
47
|
}
|
|
43
48
|
exports.FcrRoomCache = FcrRoomCache;
|
|
44
49
|
class FcrSharedCache {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
50
|
+
constructor() {
|
|
51
|
+
(0, _defineProperty2.default)(this, "_roomCache", new Map());
|
|
52
|
+
(0, _defineProperty2.default)(this, "getRoomCache", roomId => {
|
|
53
|
+
let roomCache = this._roomCache.get(roomId);
|
|
54
|
+
if (!roomCache) {
|
|
55
|
+
roomCache = new FcrRoomCache();
|
|
56
|
+
this._roomCache.set(roomId, roomCache);
|
|
57
|
+
}
|
|
58
|
+
return roomCache;
|
|
59
|
+
});
|
|
60
|
+
}
|
|
54
61
|
}
|
|
55
62
|
exports.FcrSharedCache = FcrSharedCache;
|
|
@@ -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/es.array.push.js");
|
|
4
6
|
require("core-js/modules/esnext.function.metadata.js");
|
|
5
7
|
require("core-js/modules/esnext.map.delete-all.js");
|
|
@@ -17,6 +19,7 @@ require("core-js/modules/esnext.map.reduce.js");
|
|
|
17
19
|
require("core-js/modules/esnext.map.some.js");
|
|
18
20
|
require("core-js/modules/esnext.map.update.js");
|
|
19
21
|
require("core-js/modules/esnext.symbol.metadata.js");
|
|
22
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
20
23
|
Object.defineProperty(exports, "__esModule", {
|
|
21
24
|
value: true
|
|
22
25
|
});
|
|
@@ -24,6 +27,8 @@ exports.FcrSharingControlImpl = void 0;
|
|
|
24
27
|
require("core-js/modules/esnext.iterator.constructor.js");
|
|
25
28
|
require("core-js/modules/esnext.iterator.for-each.js");
|
|
26
29
|
require("core-js/modules/esnext.iterator.some.js");
|
|
30
|
+
require("core-js/modules/web.dom-collections.iterator.js");
|
|
31
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
27
32
|
var _type = require("./type");
|
|
28
33
|
var _imports = require("../../imports");
|
|
29
34
|
var _ = require("../..");
|
|
@@ -31,7 +36,7 @@ var _enums = require("../whiteboard-control/enums");
|
|
|
31
36
|
var _logger = require("../../utilities/logger");
|
|
32
37
|
var _whiteboardControl = require("../whiteboard-control-v2/whiteboard-control");
|
|
33
38
|
var _annotationControl = require("../whiteboard-control-v2/annotation-control");
|
|
34
|
-
var
|
|
39
|
+
var _FcrSharingControlImpl;
|
|
35
40
|
let _initProto;
|
|
36
41
|
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)]; } }; }
|
|
37
42
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
@@ -39,24 +44,6 @@ function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e =
|
|
|
39
44
|
function _setFunctionName(e, t, n) { "symbol" == typeof t && (t = (t = t.description) ? "[" + t + "]" : ""); try { Object.defineProperty(e, "name", { configurable: !0, value: n ? n + " " + t : t }); } catch (e) {} return e; }
|
|
40
45
|
function _checkInRHS(e) { if (Object(e) !== e) throw TypeError("right-hand side of 'in' should be an object, got " + (null !== e ? typeof e : "null")); return e; }
|
|
41
46
|
class FcrSharingControlImpl {
|
|
42
|
-
logger = (() => (_initProto(this), (0, _logger.createLogger)({
|
|
43
|
-
prefix: 'FcrSharingControlImpl'
|
|
44
|
-
})))();
|
|
45
|
-
_observable = (() => new _imports.AgoraObservable())();
|
|
46
|
-
_isActive = false;
|
|
47
|
-
_shareOwnerId = '';
|
|
48
|
-
_shareOwnerStream = null;
|
|
49
|
-
_streamObserver = {
|
|
50
|
-
onStreamsAdded: this._handleOnStreamsAdded.bind(this),
|
|
51
|
-
onStreamsRemoved: this._handleOnStreamsRemoved.bind(this)
|
|
52
|
-
};
|
|
53
|
-
_sceneObserver = {
|
|
54
|
-
onScenePropertiesUpdated: this._handleOnScenePropertiesUpdated.bind(this)
|
|
55
|
-
};
|
|
56
|
-
_whiteboardObserver = {
|
|
57
|
-
onActive: this._handleOnWhiteboardActive.bind(this),
|
|
58
|
-
onInactive: this._handleOnWhiteboardInActive.bind(this)
|
|
59
|
-
};
|
|
60
47
|
get ownerId() {
|
|
61
48
|
return this._shareOwnerId;
|
|
62
49
|
}
|
|
@@ -64,6 +51,25 @@ class FcrSharingControlImpl {
|
|
|
64
51
|
return this._shareOwnerStream;
|
|
65
52
|
}
|
|
66
53
|
constructor(_scene, _api, _engine, _privilegeControl, _streamControl, _sharedCache, _userControl) {
|
|
54
|
+
(0, _defineProperty2.default)(this, "logger", (_initProto(this), (0, _logger.createLogger)({
|
|
55
|
+
prefix: 'FcrSharingControlImpl'
|
|
56
|
+
})));
|
|
57
|
+
(0, _defineProperty2.default)(this, "_observable", new _imports.AgoraObservable());
|
|
58
|
+
(0, _defineProperty2.default)(this, "_isActive", false);
|
|
59
|
+
(0, _defineProperty2.default)(this, "_shareOwnerId", '');
|
|
60
|
+
(0, _defineProperty2.default)(this, "_shareOwnerStream", null);
|
|
61
|
+
(0, _defineProperty2.default)(this, "_streamObserver", {
|
|
62
|
+
onStreamsAdded: this._handleOnStreamsAdded.bind(this),
|
|
63
|
+
onStreamsRemoved: this._handleOnStreamsRemoved.bind(this)
|
|
64
|
+
});
|
|
65
|
+
(0, _defineProperty2.default)(this, "_sceneObserver", {
|
|
66
|
+
onScenePropertiesUpdated: this._handleOnScenePropertiesUpdated.bind(this)
|
|
67
|
+
});
|
|
68
|
+
// TODO: 这里不应该再维护一套白板的状态和事件了, ui-scene 应该直接用 board control 的
|
|
69
|
+
(0, _defineProperty2.default)(this, "_whiteboardObserver", {
|
|
70
|
+
onActive: this._handleOnWhiteboardActive.bind(this),
|
|
71
|
+
onInactive: this._handleOnWhiteboardInActive.bind(this)
|
|
72
|
+
});
|
|
67
73
|
this._scene = _scene;
|
|
68
74
|
this._api = _api;
|
|
69
75
|
this._engine = _engine;
|
|
@@ -74,10 +80,11 @@ class FcrSharingControlImpl {
|
|
|
74
80
|
this._addLogObserver();
|
|
75
81
|
this._whiteboardControl = this.getBoardControl();
|
|
76
82
|
this._annotationControl = this.getAnnotationControl();
|
|
83
|
+
this._isActive = this._whiteboardControl.getActivity();
|
|
77
84
|
this._streamControl.addObserver(this._streamObserver);
|
|
78
85
|
this._whiteboardControl.addObserver(this._whiteboardObserver);
|
|
79
86
|
this._scene.addObserver(this._sceneObserver);
|
|
80
|
-
this.logger.info(
|
|
87
|
+
this.logger.info("initialized, room id: ".concat(this._scene.sceneId));
|
|
81
88
|
}
|
|
82
89
|
async startScreenSharing(config, size) {
|
|
83
90
|
try {
|
|
@@ -193,8 +200,9 @@ class FcrSharingControlImpl {
|
|
|
193
200
|
if (this.getScreenSharingState() === _type.FcrScreenSharingState.END) {
|
|
194
201
|
const isMeSharing = ownerId === this._userControl.getLocalUser().userId;
|
|
195
202
|
if (isMeSharing) {
|
|
203
|
+
var _this$_annotationCont;
|
|
196
204
|
this.logger.info('[sharing]: on stream removed, clean before terminal Annotation app');
|
|
197
|
-
this._annotationControl.getMainWindow()
|
|
205
|
+
(_this$_annotationCont = this._annotationControl.getMainWindow()) === null || _this$_annotationCont === void 0 || _this$_annotationCont.clean();
|
|
198
206
|
}
|
|
199
207
|
}
|
|
200
208
|
}
|
|
@@ -204,26 +212,29 @@ class FcrSharingControlImpl {
|
|
|
204
212
|
const {
|
|
205
213
|
cause
|
|
206
214
|
} = event;
|
|
207
|
-
const causeData = cause
|
|
215
|
+
const causeData = cause === null || cause === void 0 ? void 0 : cause.data;
|
|
208
216
|
const currentScreenSharingState = this.getScreenSharingState();
|
|
209
|
-
const causeCmd = cause
|
|
217
|
+
const causeCmd = cause === null || cause === void 0 ? void 0 : cause.cmd;
|
|
210
218
|
if (currentScreenSharingState === _type.FcrScreenSharingState.END) {
|
|
211
219
|
if (causeData && causeCmd === 10 && causeData.widgetUuid === 'annotation') {
|
|
212
|
-
|
|
220
|
+
var _causeData$widgetCaus;
|
|
221
|
+
if (((_causeData$widgetCaus = causeData.widgetCause) === null || _causeData$widgetCaus === void 0 ? void 0 : _causeData$widgetCaus.cmd) === 1) {
|
|
213
222
|
this._observable.notifyObservers('onScreenSharingUpdated', this.ownerStream, _type.FcrScreenSharingState.END);
|
|
214
223
|
const isMeSharing = this.ownerId === this._userControl.getLocalUser().userId;
|
|
215
224
|
if (isMeSharing) {
|
|
225
|
+
var _this$_annotationCont2;
|
|
216
226
|
this.logger.info('clean annotation board');
|
|
217
|
-
this._annotationControl.getMainWindow()
|
|
227
|
+
(_this$_annotationCont2 = this._annotationControl.getMainWindow()) === null || _this$_annotationCont2 === void 0 || _this$_annotationCont2.clean();
|
|
218
228
|
}
|
|
219
229
|
}
|
|
220
230
|
}
|
|
221
231
|
} else {
|
|
222
232
|
// 当屏幕共享开启时
|
|
223
233
|
if (causeData && causeCmd === 10 && causeData.widgetUuid === 'annotation') {
|
|
224
|
-
|
|
234
|
+
var _causeData$widgetCaus2;
|
|
235
|
+
if (((_causeData$widgetCaus2 = causeData.widgetCause) === null || _causeData$widgetCaus2 === void 0 ? void 0 : _causeData$widgetCaus2.cmd) === 1) {
|
|
225
236
|
const screenStream = this._getScreenShareStreamByUuid();
|
|
226
|
-
this._observable.notifyObservers('onScreenSharingUpdated', screenStream
|
|
237
|
+
this._observable.notifyObservers('onScreenSharingUpdated', screenStream !== null && screenStream !== void 0 ? screenStream : this.ownerStream, _type.FcrScreenSharingState.START_WHIT_ANNOTATION);
|
|
227
238
|
// const owner = this._userControl.getUser(this.ownerId);
|
|
228
239
|
// const isElectron =
|
|
229
240
|
// owner &&
|
|
@@ -268,7 +279,7 @@ class FcrSharingControlImpl {
|
|
|
268
279
|
_addLogObserver() {
|
|
269
280
|
this.addObserver((0, _logger.generateLogObserver)(this.logger, ['onScreenSharingUpdated', 'onWhiteboardStarted', 'onWhiteboardEnded']));
|
|
270
281
|
}
|
|
271
|
-
static #_ = (() => _staticBlock = () => [_initProto] = _applyDecs(this, [[_imports.trace, 2, "startScreenSharing"], [_imports.trace, 2, "startWhiteboard"], [_imports.trace, 2, "updateScreenSharing"], [_imports.trace, 2, "stop"], [_imports.trace, 2, "getScreenSharingState"]], []).e)();
|
|
272
282
|
}
|
|
273
283
|
exports.FcrSharingControlImpl = FcrSharingControlImpl;
|
|
274
|
-
|
|
284
|
+
_FcrSharingControlImpl = FcrSharingControlImpl;
|
|
285
|
+
[_initProto] = _applyDecs(_FcrSharingControlImpl, [[_imports.trace, 2, "startScreenSharing"], [_imports.trace, 2, "startWhiteboard"], [_imports.trace, 2, "updateScreenSharing"], [_imports.trace, 2, "stop"], [_imports.trace, 2, "getScreenSharingState"]], []).e;
|