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