fcr-core 3.8.0-alpha → 3.8.1-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 -40
- package/lib/engine/index.js +72 -66
- 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 -47
- package/lib/plugins/chatroom.js +213 -229
- 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 +27 -35
- 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 -46
- package/lib/room-control/shared-cache.js +29 -36
- package/lib/room-control/sharing-control/index.d.ts +1 -1
- package/lib/room-control/sharing-control/index.js +34 -42
- package/lib/room-control/stream-control/index.js +191 -195
- package/lib/room-control/stream-control/type.d.ts +1 -1
- package/lib/room-control/stt-control/de-compress-gzip.js +0 -10
- package/lib/room-control/stt-control/index.js +95 -98
- package/lib/room-control/stt-control/type.d.ts +1 -1
- 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/utils.js +2 -4
- package/lib/room-control/whiteboard-control-v1/board-subwindow.js +1 -2
- package/lib/room-control/whiteboard-control-v1/board-window.js +88 -99
- package/lib/room-control/whiteboard-control-v1/factory.js +4 -7
- package/lib/room-control/whiteboard-control-v1/index.js +28 -40
- package/lib/room-control/whiteboard-control-v1/mount-manager.js +2 -4
- package/lib/room-control/whiteboard-control-v1/utils.js +14 -17
- package/lib/room-control/whiteboard-control-v2/annotation-control/control.js +4 -6
- package/lib/room-control/whiteboard-control-v2/annotation-control/factory.js +5 -10
- package/lib/room-control/whiteboard-control-v2/base/index.js +34 -41
- package/lib/room-control/whiteboard-control-v2/base/main-window.js +24 -29
- package/lib/room-control/whiteboard-control-v2/utils.js +6 -7
- package/lib/room-control/whiteboard-control-v2/whiteboard-control/control.d.ts +0 -1
- package/lib/room-control/whiteboard-control-v2/whiteboard-control/control.js +23 -34
- package/lib/room-control/whiteboard-control-v2/whiteboard-control/factory.js +7 -14
- package/lib/room-router/index.js +47 -53
- package/lib/room-router/type.d.ts +2 -2
- package/lib/service/api.js +227 -250
- 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/stream.js +11 -16
- package/lib/utilities/user.js +3 -4
- package/lib/utilities/validate-params.js +1 -2
- package/package.json +5 -6
|
@@ -1,17 +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.filter.js");
|
|
7
|
-
require("core-js/modules/esnext.iterator.for-each.js");
|
|
8
5
|
require("core-js/modules/esnext.symbol.metadata.js");
|
|
9
6
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
10
7
|
Object.defineProperty(exports, "__esModule", {
|
|
11
8
|
value: true
|
|
12
9
|
});
|
|
13
10
|
exports.FcrRoomSessionControlImpl = void 0;
|
|
14
|
-
require("core-js/modules/es.error.cause.js");
|
|
15
11
|
require("core-js/modules/es.json.stringify.js");
|
|
16
12
|
require("core-js/modules/esnext.iterator.constructor.js");
|
|
17
13
|
require("core-js/modules/esnext.iterator.map.js");
|
|
@@ -29,8 +25,6 @@ require("core-js/modules/esnext.map.merge.js");
|
|
|
29
25
|
require("core-js/modules/esnext.map.reduce.js");
|
|
30
26
|
require("core-js/modules/esnext.map.some.js");
|
|
31
27
|
require("core-js/modules/esnext.map.update.js");
|
|
32
|
-
require("core-js/modules/web.dom-collections.iterator.js");
|
|
33
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
34
28
|
var _imports = require("../../imports");
|
|
35
29
|
var _type = require("../../type");
|
|
36
30
|
var _error = require("../../utilities/error");
|
|
@@ -38,10 +32,7 @@ var _logger = require("../../utilities/logger");
|
|
|
38
32
|
var _validateParams = _interopRequireDefault(require("../../utilities/validate-params"));
|
|
39
33
|
var _schema = require("../../schema");
|
|
40
34
|
var _helpers = require("../helpers");
|
|
41
|
-
|
|
42
|
-
let _initProto, _startRoomSessionDecs, _stopRoomSessionDecs, _acceptRoomSessionDecs, _rejectRoomSessionDecs, _ref;
|
|
43
|
-
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; }
|
|
44
|
-
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; }
|
|
35
|
+
let _initProto, _startRoomSessionDecs, _stopRoomSessionDecs, _acceptRoomSessionDecs, _rejectRoomSessionDecs;
|
|
45
36
|
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)]; } }; }
|
|
46
37
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
47
38
|
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); }
|
|
@@ -50,21 +41,25 @@ function _checkInRHS(e) { if (Object(e) !== e) throw TypeError("right-hand side
|
|
|
50
41
|
/**
|
|
51
42
|
* @internal
|
|
52
43
|
*/
|
|
53
|
-
_ref = (_startRoomSessionDecs = [_imports.trace, (0, _validateParams.default)(_schema.fcrRoomSessionParamsSchema, _schema.fcrPrivilegeUserRoleArraySchema.optional())], _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");
|
|
54
44
|
class FcrRoomSessionControlImpl {
|
|
45
|
+
static {
|
|
46
|
+
[_initProto] = _applyDecs(this, [[_startRoomSessionDecs, 2, "startRoomSession"], [_stopRoomSessionDecs, 2, "stopRoomSession"], [_acceptRoomSessionDecs, 2, "acceptRoomSession"], [_rejectRoomSessionDecs, 2, "rejectRoomSession"]], []).e;
|
|
47
|
+
}
|
|
48
|
+
//@internal
|
|
49
|
+
[(_startRoomSessionDecs = [_imports.trace, (0, _validateParams.default)(_schema.fcrRoomSessionParamsSchema, _schema.fcrPrivilegeUserRoleArraySchema.optional())], _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)({
|
|
50
|
+
prefix: 'FcrRoomSessionControlImpl'
|
|
51
|
+
}));
|
|
52
|
+
//@internal
|
|
53
|
+
_observable = new _imports.AgoraObservable();
|
|
54
|
+
//@internal
|
|
55
|
+
_taskInterval = _imports.Duration.second(1);
|
|
56
|
+
//@internal
|
|
57
|
+
|
|
58
|
+
//@internal
|
|
59
|
+
_scheduleMap = new Map();
|
|
60
|
+
//@internal
|
|
61
|
+
_receivedMap = new Map();
|
|
55
62
|
constructor(_roomControl, _api, _userId) {
|
|
56
|
-
//@internal
|
|
57
|
-
(0, _defineProperty2.default)(this, _ref, (_initProto(this), (0, _logger.createLogger)({
|
|
58
|
-
prefix: 'FcrRoomSessionControlImpl'
|
|
59
|
-
})));
|
|
60
|
-
//@internal
|
|
61
|
-
(0, _defineProperty2.default)(this, "_observable", new _imports.AgoraObservable());
|
|
62
|
-
//@internal
|
|
63
|
-
(0, _defineProperty2.default)(this, "_taskInterval", _imports.Duration.second(1));
|
|
64
|
-
//@internal
|
|
65
|
-
(0, _defineProperty2.default)(this, "_scheduleMap", new Map());
|
|
66
|
-
//@internal
|
|
67
|
-
(0, _defineProperty2.default)(this, "_receivedMap", new Map());
|
|
68
63
|
this._roomControl = _roomControl;
|
|
69
64
|
this._api = _api;
|
|
70
65
|
this._userId = _userId;
|
|
@@ -78,7 +73,7 @@ class FcrRoomSessionControlImpl {
|
|
|
78
73
|
async startRoomSession(params, targetRoles) {
|
|
79
74
|
try {
|
|
80
75
|
const session = {
|
|
81
|
-
sessionId: (0, _imports.md5)(
|
|
76
|
+
sessionId: (0, _imports.md5)(`${this._userId}${Date.now()}`),
|
|
82
77
|
sessionKey: params.sessionKey,
|
|
83
78
|
payload: params.payload,
|
|
84
79
|
duration: params.duration,
|
|
@@ -99,12 +94,13 @@ class FcrRoomSessionControlImpl {
|
|
|
99
94
|
targetRoles: session.targetRoles
|
|
100
95
|
});
|
|
101
96
|
const nextTs = Date.now() + interval;
|
|
102
|
-
this._scheduleMap.set(session.sessionId,
|
|
97
|
+
this._scheduleMap.set(session.sessionId, {
|
|
98
|
+
...params,
|
|
103
99
|
targetRoles: session.targetRoles,
|
|
104
100
|
nextTs,
|
|
105
101
|
startTs: Date.now()
|
|
106
|
-
})
|
|
107
|
-
this.logger.info(
|
|
102
|
+
});
|
|
103
|
+
this.logger.info(`[RoomSession] put into session schedule: ${session.sessionId}, next ts: ${nextTs}, remain: ${nextTs - Date.now()}ms`);
|
|
108
104
|
return session.sessionId;
|
|
109
105
|
} catch (e) {
|
|
110
106
|
throw (0, _error.generateFcrCoreServerError)(_error.FcrErrorCode.LOCAL_HTTP_REQUEST_FAILED, 'start room session failed', e);
|
|
@@ -176,13 +172,13 @@ class FcrRoomSessionControlImpl {
|
|
|
176
172
|
interval: 0
|
|
177
173
|
};
|
|
178
174
|
if (this._isSessionExpired(session)) {
|
|
179
|
-
this.logger.info(
|
|
175
|
+
this.logger.info(`[RoomSession] room session expired, removed: ${session.sessionId}`);
|
|
180
176
|
this._scheduleMap.delete(session.sessionId);
|
|
181
177
|
continue;
|
|
182
178
|
}
|
|
183
179
|
// check timeout
|
|
184
180
|
if (params.nextTs < Date.now()) {
|
|
185
|
-
this.logger.info(
|
|
181
|
+
this.logger.info(`[RoomSession] ping session: ${session.sessionId}`);
|
|
186
182
|
try {
|
|
187
183
|
const {
|
|
188
184
|
data: {
|
|
@@ -199,13 +195,14 @@ class FcrRoomSessionControlImpl {
|
|
|
199
195
|
});
|
|
200
196
|
const nextTs = Date.now() + interval;
|
|
201
197
|
if (this._scheduleMap.has(session.sessionId)) {
|
|
202
|
-
this._scheduleMap.set(session.sessionId,
|
|
198
|
+
this._scheduleMap.set(session.sessionId, {
|
|
199
|
+
...params,
|
|
203
200
|
nextTs
|
|
204
|
-
})
|
|
205
|
-
this.logger.info(
|
|
201
|
+
});
|
|
202
|
+
this.logger.info(`[RoomSession] refresh session schedule: ${session.sessionId}, next ts: ${nextTs}`);
|
|
206
203
|
}
|
|
207
204
|
} catch (e) {
|
|
208
|
-
this.logger.error(
|
|
205
|
+
this.logger.error(`[RoomSession] ping session failed: ${e}`);
|
|
209
206
|
}
|
|
210
207
|
}
|
|
211
208
|
}
|
|
@@ -214,7 +211,7 @@ class FcrRoomSessionControlImpl {
|
|
|
214
211
|
const session = this._receivedMap.get(key);
|
|
215
212
|
if (this._isSessionExpired(session)) {
|
|
216
213
|
this._receivedMap.delete(key);
|
|
217
|
-
this.logger.info(
|
|
214
|
+
this.logger.info(`[RoomSession] delete session callback: ${key}`);
|
|
218
215
|
}
|
|
219
216
|
}
|
|
220
217
|
}
|
|
@@ -243,7 +240,7 @@ class FcrRoomSessionControlImpl {
|
|
|
243
240
|
}
|
|
244
241
|
if (!this._isSessionExpired(session)) {
|
|
245
242
|
if (!this._receivedMap.has(session.sessionId)) {
|
|
246
|
-
this.logger.info(
|
|
243
|
+
this.logger.info(`[RoomSession] received room session request ${JSON.stringify(session)}`);
|
|
247
244
|
this._observable.notifyObservers('onRoomSessionReceived', roomId, session);
|
|
248
245
|
}
|
|
249
246
|
this._receivedMap.set(session.sessionId, session);
|
|
@@ -253,7 +250,6 @@ class FcrRoomSessionControlImpl {
|
|
|
253
250
|
// 但是点对点消息实际上触发的是 AgoraRteEngine.onPeerMessageReceived 事件. 所以这里并不会收到 cmd === ROOM_SESSION_ACCEPT 和 ROOM_SESSION_REJECT 的消息.
|
|
254
251
|
if (data.action === 1) {
|
|
255
252
|
if (this._scheduleMap.has(data.sessionUuid)) {
|
|
256
|
-
var _session$payload, _ref2, _data$payload;
|
|
257
253
|
const session = this._scheduleMap.get(data.sessionUuid);
|
|
258
254
|
const sessionResponse = {
|
|
259
255
|
sessionId: data.sessionUuid,
|
|
@@ -261,16 +257,15 @@ class FcrRoomSessionControlImpl {
|
|
|
261
257
|
responderId: senderId,
|
|
262
258
|
// FIXME: session may be lost when the client refreshes
|
|
263
259
|
// get payload from original session
|
|
264
|
-
payload:
|
|
265
|
-
cause:
|
|
260
|
+
payload: session.payload ?? {},
|
|
261
|
+
cause: data.payload?.cause ?? {}
|
|
266
262
|
};
|
|
267
|
-
this.logger.info(
|
|
263
|
+
this.logger.info(`[RoomSession] received room session accepted ${JSON.stringify(sessionResponse)}`);
|
|
268
264
|
this._scheduleMap.delete(data.sessionUuid);
|
|
269
265
|
this._observable.notifyObservers('onRoomSessionAccepted', roomId, sessionResponse);
|
|
270
266
|
}
|
|
271
267
|
} else if (data.action === 2) {
|
|
272
268
|
if (this._scheduleMap.has(data.sessionUuid)) {
|
|
273
|
-
var _session$payload2, _ref3, _data$payload2;
|
|
274
269
|
const session = this._scheduleMap.get(data.sessionUuid);
|
|
275
270
|
const sessionResponse = {
|
|
276
271
|
sessionId: data.sessionUuid,
|
|
@@ -278,10 +273,10 @@ class FcrRoomSessionControlImpl {
|
|
|
278
273
|
responderId: senderId,
|
|
279
274
|
// FIXME: session may be lost when the client refreshes
|
|
280
275
|
// get payload from original session
|
|
281
|
-
payload:
|
|
282
|
-
cause:
|
|
276
|
+
payload: session.payload ?? {},
|
|
277
|
+
cause: data.payload?.cause ?? {}
|
|
283
278
|
};
|
|
284
|
-
this.logger.info(
|
|
279
|
+
this.logger.info(`[RoomSession] received room session rejected ${JSON.stringify(sessionResponse)}`);
|
|
285
280
|
if (this._scheduleMap.has(data.sessionUuid)) {
|
|
286
281
|
this._scheduleMap.delete(data.sessionUuid);
|
|
287
282
|
this._observable.notifyObservers('onRoomSessionRejected', roomId, sessionResponse);
|
|
@@ -299,6 +294,4 @@ class FcrRoomSessionControlImpl {
|
|
|
299
294
|
this.addObserver((0, _logger.generateLogObserver)(this.logger, ['onRoomSessionAccepted', 'onRoomSessionRejected', 'onRoomSessionReceived']));
|
|
300
295
|
}
|
|
301
296
|
}
|
|
302
|
-
exports.FcrRoomSessionControlImpl = FcrRoomSessionControlImpl;
|
|
303
|
-
_FcrRoomSessionControlImpl = FcrRoomSessionControlImpl;
|
|
304
|
-
[_initProto] = _applyDecs(_FcrRoomSessionControlImpl, [[_startRoomSessionDecs, 2, "startRoomSession"], [_stopRoomSessionDecs, 2, "stopRoomSession"], [_acceptRoomSessionDecs, 2, "acceptRoomSession"], [_rejectRoomSessionDecs, 2, "rejectRoomSession"]], []).e;
|
|
297
|
+
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;
|
|
@@ -29,7 +29,7 @@ export declare class FcrSharingControlImpl implements FcrSharingControl {
|
|
|
29
29
|
get ownerId(): string;
|
|
30
30
|
get ownerStream(): FcrStreamInfo | null;
|
|
31
31
|
constructor(_scene: AgoraRteScene, _api: FcrCoreServiceApi, _engine: AgoraRteEngine, _privilegeControl: FcrPrivilegeControl, _streamControl: FcrStreamControl, _sharedCache: FcrSharedCache, _userControl: FcrUserControl);
|
|
32
|
-
startScreenSharing(config: FcrScreenStreamCreateConfig, size?: FcrSize): Promise<string>;
|
|
32
|
+
startScreenSharing(config: FcrScreenStreamCreateConfig, size?: FcrSize, labels?: Map<string, any>): Promise<string>;
|
|
33
33
|
startWhiteboard(): Promise<void>;
|
|
34
34
|
updateScreenSharing(enableAnnotation: boolean): Promise<void>;
|
|
35
35
|
stop(): Promise<void>;
|
|
@@ -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("../..");
|
|
@@ -37,7 +32,6 @@ var _factory = require("../whiteboard-control-v2/whiteboard-control/factory");
|
|
|
37
32
|
var _factory2 = require("../whiteboard-control-v2/annotation-control/factory");
|
|
38
33
|
var _utils = require("../whiteboard-control/utils");
|
|
39
34
|
var _type2 = require("../type");
|
|
40
|
-
var _FcrSharingControlImpl;
|
|
41
35
|
let _initProto;
|
|
42
36
|
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
37
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
@@ -45,6 +39,29 @@ function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e =
|
|
|
45
39
|
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; }
|
|
46
40
|
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; }
|
|
47
41
|
class FcrSharingControlImpl {
|
|
42
|
+
static {
|
|
43
|
+
[_initProto] = _applyDecs(this, [[_imports.trace, 2, "startScreenSharing"], [_imports.trace, 2, "startWhiteboard"], [_imports.trace, 2, "updateScreenSharing"], [_imports.trace, 2, "stop"], [_imports.trace, 2, "getScreenSharingState"]], []).e;
|
|
44
|
+
}
|
|
45
|
+
logger = (_initProto(this), (0, _logger.createLogger)({
|
|
46
|
+
prefix: 'FcrSharingControlImpl'
|
|
47
|
+
}));
|
|
48
|
+
_observable = new _imports.AgoraObservable();
|
|
49
|
+
_isActive = false;
|
|
50
|
+
_shareOwnerId = '';
|
|
51
|
+
_shareOwnerStream = null;
|
|
52
|
+
_streamObserver = {
|
|
53
|
+
onStreamsAdded: this._handleOnStreamsAdded.bind(this),
|
|
54
|
+
onStreamsRemoved: this._handleOnStreamsRemoved.bind(this)
|
|
55
|
+
};
|
|
56
|
+
_sceneObserver = {
|
|
57
|
+
onScenePropertiesUpdated: this._handleOnScenePropertiesUpdated.bind(this)
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
// TODO: 这里不应该再维护一套白板的状态和事件了, ui-scene 应该直接用 board control 的
|
|
61
|
+
_whiteboardObserver = {
|
|
62
|
+
onActive: this._handleOnWhiteboardActive.bind(this),
|
|
63
|
+
onInactive: this._handleOnWhiteboardInActive.bind(this)
|
|
64
|
+
};
|
|
48
65
|
get ownerId() {
|
|
49
66
|
return this._shareOwnerId;
|
|
50
67
|
}
|
|
@@ -52,25 +69,6 @@ class FcrSharingControlImpl {
|
|
|
52
69
|
return this._shareOwnerStream;
|
|
53
70
|
}
|
|
54
71
|
constructor(_scene, _api, _engine, _privilegeControl, _streamControl, _sharedCache, _userControl) {
|
|
55
|
-
(0, _defineProperty2.default)(this, "logger", (_initProto(this), (0, _logger.createLogger)({
|
|
56
|
-
prefix: 'FcrSharingControlImpl'
|
|
57
|
-
})));
|
|
58
|
-
(0, _defineProperty2.default)(this, "_observable", new _imports.AgoraObservable());
|
|
59
|
-
(0, _defineProperty2.default)(this, "_isActive", false);
|
|
60
|
-
(0, _defineProperty2.default)(this, "_shareOwnerId", '');
|
|
61
|
-
(0, _defineProperty2.default)(this, "_shareOwnerStream", null);
|
|
62
|
-
(0, _defineProperty2.default)(this, "_streamObserver", {
|
|
63
|
-
onStreamsAdded: this._handleOnStreamsAdded.bind(this),
|
|
64
|
-
onStreamsRemoved: this._handleOnStreamsRemoved.bind(this)
|
|
65
|
-
});
|
|
66
|
-
(0, _defineProperty2.default)(this, "_sceneObserver", {
|
|
67
|
-
onScenePropertiesUpdated: this._handleOnScenePropertiesUpdated.bind(this)
|
|
68
|
-
});
|
|
69
|
-
// TODO: 这里不应该再维护一套白板的状态和事件了, ui-scene 应该直接用 board control 的
|
|
70
|
-
(0, _defineProperty2.default)(this, "_whiteboardObserver", {
|
|
71
|
-
onActive: this._handleOnWhiteboardActive.bind(this),
|
|
72
|
-
onInactive: this._handleOnWhiteboardInActive.bind(this)
|
|
73
|
-
});
|
|
74
72
|
this._scene = _scene;
|
|
75
73
|
this._api = _api;
|
|
76
74
|
this._engine = _engine;
|
|
@@ -85,11 +83,11 @@ class FcrSharingControlImpl {
|
|
|
85
83
|
this._streamControl.addObserver(this._streamObserver);
|
|
86
84
|
this._whiteboardControl.addObserver(this._whiteboardObserver);
|
|
87
85
|
this._scene.addObserver(this._sceneObserver);
|
|
88
|
-
this.logger.info(
|
|
86
|
+
this.logger.info(`initialized, room id: ${this._scene.sceneId}`);
|
|
89
87
|
}
|
|
90
|
-
async startScreenSharing(config, size) {
|
|
88
|
+
async startScreenSharing(config, size, labels) {
|
|
91
89
|
try {
|
|
92
|
-
const streamId = await this._streamControl.addLocalScreenStream(config, size);
|
|
90
|
+
const streamId = await this._streamControl.addLocalScreenStream(config, size, labels);
|
|
93
91
|
return streamId;
|
|
94
92
|
} catch (error) {
|
|
95
93
|
throw error;
|
|
@@ -230,9 +228,8 @@ class FcrSharingControlImpl {
|
|
|
230
228
|
if (this.getScreenSharingState() === _type.FcrScreenSharingState.END) {
|
|
231
229
|
const isMeSharing = ownerId === this._userControl.getLocalUser().userId;
|
|
232
230
|
if (isMeSharing) {
|
|
233
|
-
var _this$_annotationCont;
|
|
234
231
|
this.logger.info('[sharing]: on stream removed, clean before terminal Annotation app');
|
|
235
|
-
|
|
232
|
+
this._annotationControl.getMainWindow()?.clean();
|
|
236
233
|
}
|
|
237
234
|
}
|
|
238
235
|
}
|
|
@@ -242,29 +239,26 @@ class FcrSharingControlImpl {
|
|
|
242
239
|
const {
|
|
243
240
|
cause
|
|
244
241
|
} = event;
|
|
245
|
-
const causeData = cause
|
|
242
|
+
const causeData = cause?.data;
|
|
246
243
|
const currentScreenSharingState = this.getScreenSharingState();
|
|
247
|
-
const causeCmd = cause
|
|
244
|
+
const causeCmd = cause?.cmd;
|
|
248
245
|
if (currentScreenSharingState === _type.FcrScreenSharingState.END) {
|
|
249
246
|
if (causeData && causeCmd === 10 && causeData.widgetUuid === _type2.FcrWidgetUuid.ANNOTATION) {
|
|
250
|
-
|
|
251
|
-
if (((_causeData$widgetCaus = causeData.widgetCause) === null || _causeData$widgetCaus === void 0 ? void 0 : _causeData$widgetCaus.cmd) === _type2.FcrWidgetCauseCmd.ANNOTATION) {
|
|
247
|
+
if (causeData.widgetCause?.cmd === _type2.FcrWidgetCauseCmd.ANNOTATION) {
|
|
252
248
|
this._observable.notifyObservers('onScreenSharingUpdated', this.ownerStream, _type.FcrScreenSharingState.END);
|
|
253
249
|
const isMeSharing = this.ownerId === this._userControl.getLocalUser().userId;
|
|
254
250
|
if (isMeSharing) {
|
|
255
|
-
var _this$_annotationCont2;
|
|
256
251
|
this.logger.info('clean annotation board');
|
|
257
|
-
|
|
252
|
+
this._annotationControl.getMainWindow()?.clean();
|
|
258
253
|
}
|
|
259
254
|
}
|
|
260
255
|
}
|
|
261
256
|
} else {
|
|
262
257
|
// 当屏幕共享开启时
|
|
263
258
|
if (causeData && causeCmd === 10 && causeData.widgetUuid === _type2.FcrWidgetUuid.ANNOTATION) {
|
|
264
|
-
|
|
265
|
-
if (((_causeData$widgetCaus2 = causeData.widgetCause) === null || _causeData$widgetCaus2 === void 0 ? void 0 : _causeData$widgetCaus2.cmd) === _type2.FcrWidgetCauseCmd.ANNOTATION) {
|
|
259
|
+
if (causeData.widgetCause?.cmd === _type2.FcrWidgetCauseCmd.ANNOTATION) {
|
|
266
260
|
const screenStream = this._getScreenShareStreamByUuid();
|
|
267
|
-
this._observable.notifyObservers('onScreenSharingUpdated', screenStream
|
|
261
|
+
this._observable.notifyObservers('onScreenSharingUpdated', screenStream ?? this.ownerStream, _type.FcrScreenSharingState.START_WHIT_ANNOTATION);
|
|
268
262
|
// const owner = this._userControl.getUser(this.ownerId);
|
|
269
263
|
// const isElectron =
|
|
270
264
|
// owner &&
|
|
@@ -310,6 +304,4 @@ class FcrSharingControlImpl {
|
|
|
310
304
|
this.addObserver((0, _logger.generateLogObserver)(this.logger, ['onScreenSharingUpdated', 'onWhiteboardStarted', 'onWhiteboardEnded']));
|
|
311
305
|
}
|
|
312
306
|
}
|
|
313
|
-
exports.FcrSharingControlImpl = FcrSharingControlImpl;
|
|
314
|
-
_FcrSharingControlImpl = FcrSharingControlImpl;
|
|
315
|
-
[_initProto] = _applyDecs(_FcrSharingControlImpl, [[_imports.trace, 2, "startScreenSharing"], [_imports.trace, 2, "startWhiteboard"], [_imports.trace, 2, "updateScreenSharing"], [_imports.trace, 2, "stop"], [_imports.trace, 2, "getScreenSharingState"]], []).e;
|
|
307
|
+
exports.FcrSharingControlImpl = FcrSharingControlImpl;
|