fcr-core 3.10.5 → 3.10.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/engine/index.js +108 -102
- package/lib/imports.js +0 -1
- package/lib/index.d.ts +1 -1
- package/lib/media-control/desktop.js +13 -22
- package/lib/media-control/mobile.js +13 -22
- package/lib/monitor-control/index.js +7 -17
- package/lib/peer-session/index.js +121 -120
- package/lib/plugins/chat/chatroom.js +96 -119
- package/lib/plugins/chat/connector.js +48 -69
- package/lib/remote-control/index.js +216 -194
- package/lib/room-control/ability-control/index.js +10 -20
- package/lib/room-control/application-control/index.js +75 -82
- package/lib/room-control/group-control/index.js +30 -31
- package/lib/room-control/helpers/board-init-info-helper.js +10 -16
- package/lib/room-control/helpers/validation-helper.js +1 -1
- package/lib/room-control/index.js +51 -70
- package/lib/room-control/infinity-room-control/index.js +19 -27
- package/lib/room-control/interpreter-control/index.js +65 -77
- 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 +25 -37
- package/lib/room-control/privilege-control/helper.js +13 -28
- package/lib/room-control/privilege-control/index.js +28 -36
- package/lib/room-control/room-connector-control/index.js +47 -52
- package/lib/room-control/room-control-factory.js +12 -10
- package/lib/room-control/room-session/index.js +74 -77
- package/lib/room-control/shared-cache.js +56 -63
- package/lib/room-control/sharing-control/index.js +57 -65
- package/lib/room-control/stream-control/index.js +238 -203
- package/lib/room-control/stream-control/type.d.ts +11 -1
- package/lib/room-control/stt-control/de-compress-gzip.js +0 -10
- package/lib/room-control/stt-control/index.js +86 -93
- package/lib/room-control/user-control/index.js +155 -162
- package/lib/room-control/waitingroom-control/index.js +9 -18
- 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 +103 -120
- package/lib/room-control/whiteboard-control-v1/factory.js +4 -7
- package/lib/room-control/whiteboard-control-v1/index.js +67 -80
- 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 +10 -14
- package/lib/room-control/whiteboard-control-v2/annotation-control/factory.js +8 -17
- package/lib/room-control/whiteboard-control-v2/base/index.js +53 -61
- package/lib/room-control/whiteboard-control-v2/base/main-window.js +30 -39
- package/lib/room-control/whiteboard-control-v2/utils.js +10 -10
- package/lib/room-control/whiteboard-control-v2/whiteboard-control/control.js +33 -45
- package/lib/room-control/whiteboard-control-v2/whiteboard-control/factory.js +11 -27
- package/lib/room-control/widget-control/index.js +33 -43
- package/lib/room-router/index.js +58 -66
- package/lib/service/api.js +548 -446
- package/lib/struct.js +2 -5
- package/lib/type.d.ts +1 -1
- package/lib/utilities/abortable-retry.js +0 -3
- package/lib/utilities/collection.js +11 -15
- package/lib/utilities/error-helpers.js +27 -34
- package/lib/utilities/error.js +3 -4
- package/lib/utilities/join-helper.js +31 -37
- package/lib/utilities/logger.js +5 -8
- package/lib/utilities/parameters.js +10 -21
- 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 -1
- package/lib/utilities/video-encoder-config.js +5 -10
- package/lib-es/engine/index.js +108 -102
- package/lib-es/media-control/desktop.js +13 -22
- package/lib-es/media-control/mobile.js +13 -22
- package/lib-es/monitor-control/index.js +7 -16
- package/lib-es/peer-session/index.js +121 -120
- package/lib-es/plugins/chat/chatroom.js +95 -118
- package/lib-es/plugins/chat/connector.js +47 -67
- package/lib-es/remote-control/index.js +216 -194
- package/lib-es/room-control/ability-control/index.js +10 -19
- package/lib-es/room-control/application-control/index.js +75 -81
- package/lib-es/room-control/group-control/index.js +30 -31
- package/lib-es/room-control/helpers/board-init-info-helper.js +10 -15
- package/lib-es/room-control/helpers/validation-helper.js +1 -1
- package/lib-es/room-control/index.js +51 -69
- package/lib-es/room-control/infinity-room-control/index.js +19 -26
- package/lib-es/room-control/interpreter-control/index.js +65 -77
- package/lib-es/room-control/interpreter-control/room.js +4 -5
- package/lib-es/room-control/join-before-host-waitingroom-control/index.js +4 -5
- package/lib-es/room-control/mainroom-control/index.js +25 -37
- package/lib-es/room-control/privilege-control/helper.js +13 -27
- package/lib-es/room-control/privilege-control/index.js +28 -36
- package/lib-es/room-control/room-connector-control/index.js +47 -52
- package/lib-es/room-control/room-control-factory.js +12 -10
- package/lib-es/room-control/room-session/index.js +74 -77
- package/lib-es/room-control/shared-cache.js +56 -62
- package/lib-es/room-control/sharing-control/index.js +57 -64
- package/lib-es/room-control/stream-control/index.js +240 -205
- package/lib-es/room-control/stt-control/de-compress-gzip.js +0 -10
- package/lib-es/room-control/stt-control/index.js +86 -93
- package/lib-es/room-control/user-control/index.js +155 -162
- package/lib-es/room-control/waitingroom-control/index.js +9 -18
- package/lib-es/room-control/whiteboard-control/utils.js +2 -4
- package/lib-es/room-control/whiteboard-control-v1/board-subwindow.js +1 -2
- package/lib-es/room-control/whiteboard-control-v1/board-window.js +103 -120
- package/lib-es/room-control/whiteboard-control-v1/factory.js +4 -6
- package/lib-es/room-control/whiteboard-control-v1/index.js +67 -80
- package/lib-es/room-control/whiteboard-control-v1/mount-manager.js +2 -3
- package/lib-es/room-control/whiteboard-control-v1/utils.js +14 -17
- package/lib-es/room-control/whiteboard-control-v2/annotation-control/control.js +10 -13
- package/lib-es/room-control/whiteboard-control-v2/annotation-control/factory.js +8 -16
- package/lib-es/room-control/whiteboard-control-v2/base/index.js +53 -60
- package/lib-es/room-control/whiteboard-control-v2/base/main-window.js +30 -39
- package/lib-es/room-control/whiteboard-control-v2/utils.js +10 -10
- package/lib-es/room-control/whiteboard-control-v2/whiteboard-control/control.js +33 -45
- package/lib-es/room-control/whiteboard-control-v2/whiteboard-control/factory.js +11 -26
- package/lib-es/room-control/widget-control/index.js +33 -42
- package/lib-es/room-router/index.js +58 -66
- package/lib-es/service/api.js +548 -445
- package/lib-es/struct.js +2 -4
- package/lib-es/utilities/abortable-retry.js +0 -3
- package/lib-es/utilities/collection.js +11 -14
- package/lib-es/utilities/error-helpers.js +26 -33
- package/lib-es/utilities/error.js +3 -4
- package/lib-es/utilities/join-helper.js +29 -36
- package/lib-es/utilities/logger.js +5 -7
- package/lib-es/utilities/parameters.js +10 -21
- package/lib-es/utilities/retry-helpers.js +0 -1
- package/lib-es/utilities/stream.js +11 -15
- package/lib-es/utilities/user.js +3 -4
- package/lib-es/utilities/validate-params.js +1 -1
- package/lib-es/utilities/video-encoder-config.js +5 -10
- package/package.json +4 -4
|
@@ -1,16 +1,7 @@
|
|
|
1
|
-
import "core-js/modules/es.symbol.description.js";
|
|
2
|
-
import "core-js/modules/es.error.cause.js";
|
|
3
1
|
import "core-js/modules/es.array.push.js";
|
|
4
2
|
import "core-js/modules/esnext.function.metadata.js";
|
|
5
|
-
import "core-js/modules/esnext.iterator.filter.js";
|
|
6
|
-
import "core-js/modules/esnext.iterator.for-each.js";
|
|
7
3
|
import "core-js/modules/esnext.symbol.metadata.js";
|
|
8
|
-
|
|
9
|
-
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
10
|
-
var _FcrRoomSessionControlImpl;
|
|
11
|
-
let _initProto, _startRoomSessionDecs, _stopRoomSessionDecs, _acceptRoomSessionDecs, _rejectRoomSessionDecs, _ref;
|
|
12
|
-
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; }
|
|
13
|
-
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) { _defineProperty(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; }
|
|
4
|
+
let _initProto, _startRoomSessionDecs, _stopRoomSessionDecs, _acceptRoomSessionDecs, _rejectRoomSessionDecs;
|
|
14
5
|
import "core-js/modules/es.json.stringify.js";
|
|
15
6
|
import "core-js/modules/esnext.iterator.constructor.js";
|
|
16
7
|
import "core-js/modules/esnext.iterator.map.js";
|
|
@@ -28,7 +19,6 @@ import "core-js/modules/esnext.map.merge.js";
|
|
|
28
19
|
import "core-js/modules/esnext.map.reduce.js";
|
|
29
20
|
import "core-js/modules/esnext.map.some.js";
|
|
30
21
|
import "core-js/modules/esnext.map.update.js";
|
|
31
|
-
import "core-js/modules/web.dom-collections.iterator.js";
|
|
32
22
|
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
23
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
34
24
|
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); }
|
|
@@ -42,28 +32,32 @@ import { generateFcrCoreServerError } from '../../utilities/error';
|
|
|
42
32
|
import { createLogger, generateLogObserver } from '../../utilities/logger';
|
|
43
33
|
import validateParams from '../../utilities/validate-params';
|
|
44
34
|
import { ROOM_MESSAGE_COMMANDS } from '../helpers';
|
|
45
|
-
_ref = (_startRoomSessionDecs = [trace(['params', 'targetRoles']), validateParams(fcrRoomSessionParamsSchema, fcrPrivilegeUserRoleArraySchema.optional())], _stopRoomSessionDecs = [trace(['sessionId']), validateParams(stringSchema)], _acceptRoomSessionDecs = [trace(['session', 'cause']), validateParams(fcrSessionBaseSchema, stringKeyUnknownValueSchema.optional())], _rejectRoomSessionDecs = [trace(['session', 'cause']), validateParams(fcrSessionBaseSchema, stringKeyUnknownValueSchema.optional())], "logger");
|
|
46
35
|
/**
|
|
47
36
|
* @internal
|
|
48
37
|
*/
|
|
49
38
|
export class FcrRoomSessionControlImpl {
|
|
39
|
+
static {
|
|
40
|
+
[_initProto] = _applyDecs(this, [[_startRoomSessionDecs, 2, "startRoomSession"], [_stopRoomSessionDecs, 2, "stopRoomSession"], [_acceptRoomSessionDecs, 2, "acceptRoomSession"], [_rejectRoomSessionDecs, 2, "rejectRoomSession"], [trace, 2, "release"]], []).e;
|
|
41
|
+
}
|
|
42
|
+
//@internal
|
|
43
|
+
[(_startRoomSessionDecs = [trace(['params', 'targetRoles']), validateParams(fcrRoomSessionParamsSchema, fcrPrivilegeUserRoleArraySchema.optional())], _stopRoomSessionDecs = [trace(['sessionId']), validateParams(stringSchema)], _acceptRoomSessionDecs = [trace(['session', 'cause']), validateParams(fcrSessionBaseSchema, stringKeyUnknownValueSchema.optional())], _rejectRoomSessionDecs = [trace(['session', 'cause']), validateParams(fcrSessionBaseSchema, stringKeyUnknownValueSchema.optional())], "logger")] = (_initProto(this), createLogger({
|
|
44
|
+
prefix: 'FcrRoomSessionControlImpl'
|
|
45
|
+
}));
|
|
46
|
+
//@internal
|
|
47
|
+
_observable = new AgoraObservable();
|
|
48
|
+
//@internal
|
|
49
|
+
_taskInterval = Duration.second(1);
|
|
50
|
+
//@internal
|
|
51
|
+
|
|
52
|
+
//@internal
|
|
53
|
+
_scheduleMap = new Map();
|
|
54
|
+
//@internal
|
|
55
|
+
_receivedMap = new Map();
|
|
56
|
+
//@internal
|
|
57
|
+
_roomObserver = {
|
|
58
|
+
onRoomMessageReceived: this._handleRoomMessage.bind(this)
|
|
59
|
+
};
|
|
50
60
|
constructor(_roomControl, _api, _userId) {
|
|
51
|
-
//@internal
|
|
52
|
-
_defineProperty(this, _ref, (_initProto(this), createLogger({
|
|
53
|
-
prefix: 'FcrRoomSessionControlImpl'
|
|
54
|
-
})));
|
|
55
|
-
//@internal
|
|
56
|
-
_defineProperty(this, "_observable", new AgoraObservable());
|
|
57
|
-
//@internal
|
|
58
|
-
_defineProperty(this, "_taskInterval", Duration.second(1));
|
|
59
|
-
//@internal
|
|
60
|
-
_defineProperty(this, "_scheduleMap", new Map());
|
|
61
|
-
//@internal
|
|
62
|
-
_defineProperty(this, "_receivedMap", new Map());
|
|
63
|
-
//@internal
|
|
64
|
-
_defineProperty(this, "_roomObserver", {
|
|
65
|
-
onRoomMessageReceived: this._handleRoomMessage.bind(this)
|
|
66
|
-
});
|
|
67
61
|
this._roomControl = _roomControl;
|
|
68
62
|
this._api = _api;
|
|
69
63
|
this._userId = _userId;
|
|
@@ -75,30 +69,34 @@ export class FcrRoomSessionControlImpl {
|
|
|
75
69
|
async startRoomSession(params, targetRoles) {
|
|
76
70
|
try {
|
|
77
71
|
const session = {
|
|
78
|
-
sessionId: md5(
|
|
72
|
+
sessionId: md5(`${this._userId}${Date.now()}`),
|
|
79
73
|
sessionKey: params.sessionKey,
|
|
80
74
|
payload: params.payload,
|
|
81
75
|
duration: params.duration,
|
|
82
76
|
sender: this._userId,
|
|
83
77
|
targetRoles: targetRoles ? targetRoles.map(role => FcrPrivilegeUserRoleToStringMap[role]) : undefined
|
|
84
78
|
};
|
|
85
|
-
const
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
79
|
+
const {
|
|
80
|
+
data: {
|
|
81
|
+
interval
|
|
82
|
+
}
|
|
83
|
+
} = await this._api.updateRoomSession({
|
|
84
|
+
userId: this._userId,
|
|
85
|
+
sessionId: session.sessionId,
|
|
86
|
+
sessionKey: session.sessionKey,
|
|
87
|
+
duration: session.duration,
|
|
88
|
+
payload: session.payload,
|
|
89
|
+
targetId: this._roomControl.getRoomInfo().roomId,
|
|
90
|
+
targetRoles: session.targetRoles
|
|
91
|
+
});
|
|
95
92
|
const nextTs = Date.now() + interval;
|
|
96
|
-
this._scheduleMap.set(session.sessionId,
|
|
93
|
+
this._scheduleMap.set(session.sessionId, {
|
|
94
|
+
...params,
|
|
97
95
|
targetRoles: session.targetRoles,
|
|
98
96
|
nextTs,
|
|
99
97
|
startTs: Date.now()
|
|
100
|
-
})
|
|
101
|
-
this.logger.info(
|
|
98
|
+
});
|
|
99
|
+
this.logger.info(`[RoomSession] put into session schedule: ${session.sessionId}, next ts: ${nextTs}, remain: ${nextTs - Date.now()}ms`);
|
|
102
100
|
return session.sessionId;
|
|
103
101
|
} catch (e) {
|
|
104
102
|
throw generateFcrCoreServerError(DetailErrorCode.LOCAL_HTTP_REQUEST_FAILED, 'start room session failed');
|
|
@@ -187,33 +185,37 @@ export class FcrRoomSessionControlImpl {
|
|
|
187
185
|
interval: 0
|
|
188
186
|
};
|
|
189
187
|
if (this._isSessionExpired(session)) {
|
|
190
|
-
this.logger.info(
|
|
188
|
+
this.logger.info(`room session expired, removed: ${session.sessionId}`);
|
|
191
189
|
this._scheduleMap.delete(session.sessionId);
|
|
192
190
|
continue;
|
|
193
191
|
}
|
|
194
192
|
// check timeout
|
|
195
193
|
if (params.nextTs < Date.now()) {
|
|
196
|
-
this.logger.info(
|
|
194
|
+
this.logger.info(`ping session: ${session.sessionId}`);
|
|
197
195
|
try {
|
|
198
|
-
const
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
196
|
+
const {
|
|
197
|
+
data: {
|
|
198
|
+
interval
|
|
199
|
+
}
|
|
200
|
+
} = await this._api.updateRoomSession({
|
|
201
|
+
userId: this._userId,
|
|
202
|
+
sessionId: session.sessionId,
|
|
203
|
+
sessionKey: session.sessionKey,
|
|
204
|
+
duration: params.duration,
|
|
205
|
+
payload: session.payload,
|
|
206
|
+
targetRoles: session.targetRoles,
|
|
207
|
+
targetId: this._roomControl.getRoomInfo().roomId
|
|
208
|
+
});
|
|
208
209
|
const nextTs = Date.now() + interval;
|
|
209
210
|
if (this._scheduleMap.has(session.sessionId)) {
|
|
210
|
-
this._scheduleMap.set(session.sessionId,
|
|
211
|
+
this._scheduleMap.set(session.sessionId, {
|
|
212
|
+
...params,
|
|
211
213
|
nextTs
|
|
212
|
-
})
|
|
213
|
-
this.logger.info(
|
|
214
|
+
});
|
|
215
|
+
this.logger.info(`[RoomSession] refresh session schedule: ${session.sessionId}, next ts: ${nextTs}`);
|
|
214
216
|
}
|
|
215
217
|
} catch (e) {
|
|
216
|
-
this.logger.error(
|
|
218
|
+
this.logger.error(`ping session failed: ${e}`);
|
|
217
219
|
}
|
|
218
220
|
}
|
|
219
221
|
}
|
|
@@ -222,16 +224,18 @@ export class FcrRoomSessionControlImpl {
|
|
|
222
224
|
const session = this._receivedMap.get(key);
|
|
223
225
|
if (this._isSessionExpired(session)) {
|
|
224
226
|
this._receivedMap.delete(key);
|
|
225
|
-
this.logger.info(
|
|
227
|
+
this.logger.info(`delete session callback: ${key}`);
|
|
226
228
|
}
|
|
227
229
|
}
|
|
228
230
|
}
|
|
229
231
|
|
|
230
232
|
//@internal
|
|
231
233
|
async _handleRoomMessage(roomId, message) {
|
|
232
|
-
const
|
|
233
|
-
|
|
234
|
-
|
|
234
|
+
const {
|
|
235
|
+
senderId,
|
|
236
|
+
payload,
|
|
237
|
+
cmd
|
|
238
|
+
} = message;
|
|
235
239
|
const data = payload;
|
|
236
240
|
if (cmd === ROOM_MESSAGE_COMMANDS.ROOM_SESSION_REQUEST) {
|
|
237
241
|
const session = {
|
|
@@ -249,7 +253,7 @@ export class FcrRoomSessionControlImpl {
|
|
|
249
253
|
}
|
|
250
254
|
if (!this._isSessionExpired(session)) {
|
|
251
255
|
if (!this._receivedMap.has(session.sessionId)) {
|
|
252
|
-
this.logger.info(
|
|
256
|
+
this.logger.info(`[RoomSession] received room session request ${JSON.stringify(session)}`);
|
|
253
257
|
this._observable.notifyObservers('onRoomSessionReceived', roomId, session);
|
|
254
258
|
}
|
|
255
259
|
this._receivedMap.set(session.sessionId, session);
|
|
@@ -259,7 +263,6 @@ export class FcrRoomSessionControlImpl {
|
|
|
259
263
|
// 但是点对点消息实际上触发的是 AgoraRteEngine.onPeerMessageReceived 事件. 所以这里并不会收到 cmd === ROOM_SESSION_ACCEPT 和 ROOM_SESSION_REJECT 的消息.
|
|
260
264
|
if (data.action === 1) {
|
|
261
265
|
if (this._scheduleMap.has(data.sessionUuid)) {
|
|
262
|
-
var _session$payload, _ref2, _data$payload;
|
|
263
266
|
const session = this._scheduleMap.get(data.sessionUuid);
|
|
264
267
|
const sessionResponse = {
|
|
265
268
|
sessionId: data.sessionUuid,
|
|
@@ -267,16 +270,15 @@ export class FcrRoomSessionControlImpl {
|
|
|
267
270
|
responderId: senderId,
|
|
268
271
|
// FIXME: session may be lost when the client refreshes
|
|
269
272
|
// get payload from original session
|
|
270
|
-
payload:
|
|
271
|
-
cause:
|
|
273
|
+
payload: session.payload ?? {},
|
|
274
|
+
cause: data.payload?.cause ?? {}
|
|
272
275
|
};
|
|
273
|
-
this.logger.info(
|
|
276
|
+
this.logger.info(`[RoomSession] received room session accepted ${JSON.stringify(sessionResponse)}`);
|
|
274
277
|
this._scheduleMap.delete(data.sessionUuid);
|
|
275
278
|
this._observable.notifyObservers('onRoomSessionAccepted', roomId, sessionResponse);
|
|
276
279
|
}
|
|
277
280
|
} else if (data.action === 2) {
|
|
278
281
|
if (this._scheduleMap.has(data.sessionUuid)) {
|
|
279
|
-
var _session$payload2, _ref3, _data$payload2;
|
|
280
282
|
const session = this._scheduleMap.get(data.sessionUuid);
|
|
281
283
|
const sessionResponse = {
|
|
282
284
|
sessionId: data.sessionUuid,
|
|
@@ -284,10 +286,10 @@ export class FcrRoomSessionControlImpl {
|
|
|
284
286
|
responderId: senderId,
|
|
285
287
|
// FIXME: session may be lost when the client refreshes
|
|
286
288
|
// get payload from original session
|
|
287
|
-
payload:
|
|
288
|
-
cause:
|
|
289
|
+
payload: session.payload ?? {},
|
|
290
|
+
cause: data.payload?.cause ?? {}
|
|
289
291
|
};
|
|
290
|
-
this.logger.info(
|
|
292
|
+
this.logger.info(`[RoomSession] received room session rejected ${JSON.stringify(sessionResponse)}`);
|
|
291
293
|
if (this._scheduleMap.has(data.sessionUuid)) {
|
|
292
294
|
this._scheduleMap.delete(data.sessionUuid);
|
|
293
295
|
this._observable.notifyObservers('onRoomSessionRejected', roomId, sessionResponse);
|
|
@@ -304,9 +306,4 @@ export class FcrRoomSessionControlImpl {
|
|
|
304
306
|
_addLogObserver() {
|
|
305
307
|
this.addObserver(generateLogObserver(this.logger, [['onRoomSessionAccepted', ['roomId', 'response']], ['onRoomSessionRejected', ['roomId', 'response']], ['onRoomSessionReceived', ['roomId', 'session']]]));
|
|
306
308
|
}
|
|
307
|
-
}
|
|
308
|
-
_FcrRoomSessionControlImpl = FcrRoomSessionControlImpl;
|
|
309
|
-
var _applyDecs$e = _applyDecs(_FcrRoomSessionControlImpl, [[_startRoomSessionDecs, 2, "startRoomSession"], [_stopRoomSessionDecs, 2, "stopRoomSession"], [_acceptRoomSessionDecs, 2, "acceptRoomSession"], [_rejectRoomSessionDecs, 2, "rejectRoomSession"], [trace, 2, "release"]], []).e;
|
|
310
|
-
var _applyDecs$e2 = _slicedToArray(_applyDecs$e, 1);
|
|
311
|
-
_initProto = _applyDecs$e2[0];
|
|
312
|
-
_applyDecs$e;
|
|
309
|
+
}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
1
|
import "core-js/modules/es.array.push.js";
|
|
3
2
|
import "core-js/modules/esnext.map.delete-all.js";
|
|
4
3
|
import "core-js/modules/esnext.map.emplace.js";
|
|
@@ -14,74 +13,69 @@ import "core-js/modules/esnext.map.merge.js";
|
|
|
14
13
|
import "core-js/modules/esnext.map.reduce.js";
|
|
15
14
|
import "core-js/modules/esnext.map.some.js";
|
|
16
15
|
import "core-js/modules/esnext.map.update.js";
|
|
17
|
-
import "core-js/modules/web.dom-collections.iterator.js";
|
|
18
16
|
export class FcrRoomCache {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
_defineProperty(this, "_userList", []);
|
|
25
|
-
_defineProperty(this, "setUserMapByUserId", (userId, user) => {
|
|
26
|
-
this._userMapByUserId.set(userId, user);
|
|
27
|
-
});
|
|
28
|
-
_defineProperty(this, "deleteUserMapByUserId", userId => {
|
|
29
|
-
this._userMapByUserId.delete(userId);
|
|
30
|
-
});
|
|
31
|
-
_defineProperty(this, "setUserList", userList => {
|
|
32
|
-
this._userList = userList;
|
|
33
|
-
});
|
|
34
|
-
_defineProperty(this, "insertUserToList", (index, user) => {
|
|
35
|
-
this._userList.splice(index, 0, user);
|
|
36
|
-
});
|
|
37
|
-
_defineProperty(this, "deleteUserList", index => {
|
|
38
|
-
this._userList.splice(index, 1);
|
|
39
|
-
});
|
|
40
|
-
_defineProperty(this, "addUserToList", user => {
|
|
41
|
-
this._userList.push(user);
|
|
42
|
-
});
|
|
43
|
-
_defineProperty(this, "getUserPlatform", userId => {
|
|
44
|
-
return this._platformMapByUserId.get(userId);
|
|
45
|
-
});
|
|
46
|
-
_defineProperty(this, "getUserAvatar", userId => {
|
|
47
|
-
return this._avatarMapByUserId.get(userId);
|
|
48
|
-
});
|
|
49
|
-
_defineProperty(this, "setUserPlatform", (userId, platform) => {
|
|
50
|
-
this._platformMapByUserId.set(userId, platform);
|
|
51
|
-
});
|
|
52
|
-
_defineProperty(this, "setUserAvatar", (userId, avatar) => {
|
|
53
|
-
this._avatarMapByUserId.set(userId, avatar);
|
|
54
|
-
});
|
|
55
|
-
_defineProperty(this, "deleteUserPlatform", userId => {
|
|
56
|
-
this._platformMapByUserId.delete(userId);
|
|
57
|
-
});
|
|
58
|
-
_defineProperty(this, "deleteUserAvatar", userId => {
|
|
59
|
-
this._avatarMapByUserId.delete(userId);
|
|
60
|
-
});
|
|
61
|
-
_defineProperty(this, "clear", () => {
|
|
62
|
-
this._userMapByUserId.clear();
|
|
63
|
-
this._userList = [];
|
|
64
|
-
this._platformMapByUserId.clear();
|
|
65
|
-
this._avatarMapByUserId.clear();
|
|
66
|
-
});
|
|
67
|
-
}
|
|
17
|
+
_platformMapByUserId = new Map();
|
|
18
|
+
_avatarMapByUserId = new Map();
|
|
19
|
+
_userMapByUserId = new Map();
|
|
20
|
+
//@internal
|
|
21
|
+
_userList = [];
|
|
68
22
|
get userList() {
|
|
69
23
|
return this._userList;
|
|
70
24
|
}
|
|
71
25
|
get userMapByUserId() {
|
|
72
26
|
return this._userMapByUserId;
|
|
73
27
|
}
|
|
28
|
+
setUserMapByUserId = (userId, user) => {
|
|
29
|
+
this._userMapByUserId.set(userId, user);
|
|
30
|
+
};
|
|
31
|
+
deleteUserMapByUserId = userId => {
|
|
32
|
+
this._userMapByUserId.delete(userId);
|
|
33
|
+
};
|
|
34
|
+
setUserList = userList => {
|
|
35
|
+
this._userList = userList;
|
|
36
|
+
};
|
|
37
|
+
insertUserToList = (index, user) => {
|
|
38
|
+
this._userList.splice(index, 0, user);
|
|
39
|
+
};
|
|
40
|
+
deleteUserList = index => {
|
|
41
|
+
this._userList.splice(index, 1);
|
|
42
|
+
};
|
|
43
|
+
addUserToList = user => {
|
|
44
|
+
this._userList.push(user);
|
|
45
|
+
};
|
|
46
|
+
getUserPlatform = userId => {
|
|
47
|
+
return this._platformMapByUserId.get(userId);
|
|
48
|
+
};
|
|
49
|
+
getUserAvatar = userId => {
|
|
50
|
+
return this._avatarMapByUserId.get(userId);
|
|
51
|
+
};
|
|
52
|
+
setUserPlatform = (userId, platform) => {
|
|
53
|
+
this._platformMapByUserId.set(userId, platform);
|
|
54
|
+
};
|
|
55
|
+
setUserAvatar = (userId, avatar) => {
|
|
56
|
+
this._avatarMapByUserId.set(userId, avatar);
|
|
57
|
+
};
|
|
58
|
+
deleteUserPlatform = userId => {
|
|
59
|
+
this._platformMapByUserId.delete(userId);
|
|
60
|
+
};
|
|
61
|
+
deleteUserAvatar = userId => {
|
|
62
|
+
this._avatarMapByUserId.delete(userId);
|
|
63
|
+
};
|
|
64
|
+
clear = () => {
|
|
65
|
+
this._userMapByUserId.clear();
|
|
66
|
+
this._userList = [];
|
|
67
|
+
this._platformMapByUserId.clear();
|
|
68
|
+
this._avatarMapByUserId.clear();
|
|
69
|
+
};
|
|
74
70
|
}
|
|
75
71
|
export class FcrSharedCache {
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
});
|
|
86
|
-
}
|
|
72
|
+
_roomCache = new Map();
|
|
73
|
+
getRoomCache = roomId => {
|
|
74
|
+
let roomCache = this._roomCache.get(roomId);
|
|
75
|
+
if (!roomCache) {
|
|
76
|
+
roomCache = new FcrRoomCache();
|
|
77
|
+
this._roomCache.set(roomId, roomCache);
|
|
78
|
+
}
|
|
79
|
+
return roomCache;
|
|
80
|
+
};
|
|
87
81
|
}
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import "core-js/modules/es.symbol.description.js";
|
|
2
|
-
import "core-js/modules/es.error.cause.js";
|
|
3
1
|
import "core-js/modules/es.array.push.js";
|
|
4
2
|
import "core-js/modules/esnext.function.metadata.js";
|
|
5
3
|
import "core-js/modules/esnext.map.delete-all.js";
|
|
@@ -17,11 +15,7 @@ import "core-js/modules/esnext.map.reduce.js";
|
|
|
17
15
|
import "core-js/modules/esnext.map.some.js";
|
|
18
16
|
import "core-js/modules/esnext.map.update.js";
|
|
19
17
|
import "core-js/modules/esnext.symbol.metadata.js";
|
|
20
|
-
|
|
21
|
-
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
22
|
-
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
23
|
-
var _FcrSharingControlImpl;
|
|
24
|
-
let _initProto, _startScreenSharingDecs, _updateScreenSharingDecs, _ref;
|
|
18
|
+
let _initProto, _startScreenSharingDecs, _updateScreenSharingDecs;
|
|
25
19
|
import "core-js/modules/esnext.iterator.constructor.js";
|
|
26
20
|
import "core-js/modules/esnext.iterator.find.js";
|
|
27
21
|
import "core-js/modules/esnext.iterator.for-each.js";
|
|
@@ -44,8 +38,32 @@ import { FcrBoardPropertiesState } from '../whiteboard-control/type';
|
|
|
44
38
|
import { getBoardPerformance } from '../../utilities/scene-properties';
|
|
45
39
|
import { getScribbleForgeIpList } from '../../utilities/parameters';
|
|
46
40
|
import { clearBoardIpList, setBoardIpList } from '../../utilities/shared-storage';
|
|
47
|
-
_ref = (_startScreenSharingDecs = trace(['config', 'size', 'labels']), _updateScreenSharingDecs = trace(['enableAnnotation']), "logger");
|
|
48
41
|
export class FcrSharingControlImpl {
|
|
42
|
+
static {
|
|
43
|
+
[_initProto] = _applyDecs(this, [[_startScreenSharingDecs, 2, "startScreenSharing"], [trace, 2, "startWhiteboard"], [_updateScreenSharingDecs, 2, "updateScreenSharing"], [trace, 2, "stop"], [trace, 2, "getScreenSharingState"]], []).e;
|
|
44
|
+
}
|
|
45
|
+
[(_startScreenSharingDecs = trace(['config', 'size', 'labels']), _updateScreenSharingDecs = trace(['enableAnnotation']), "logger")] = (_initProto(this), createLogger({
|
|
46
|
+
prefix: 'FcrSharingControlImpl'
|
|
47
|
+
}));
|
|
48
|
+
_observable = new AgoraObservable();
|
|
49
|
+
_isActive = false;
|
|
50
|
+
_shareOwnerId = '';
|
|
51
|
+
_shareOwnerStream = null;
|
|
52
|
+
_lastScreenSharingState = FcrScreenSharingState.END;
|
|
53
|
+
_lastScreenSharingStreamId = null;
|
|
54
|
+
_streamObserver = {
|
|
55
|
+
onStreamsAdded: this._handleOnStreamsAdded.bind(this),
|
|
56
|
+
onStreamsRemoved: this._handleOnStreamsRemoved.bind(this)
|
|
57
|
+
};
|
|
58
|
+
_sceneObserver = {
|
|
59
|
+
onScenePropertiesUpdated: this._handleOnScenePropertiesUpdated.bind(this)
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
// TODO: 这里不应该再维护一套白板的状态和事件了, ui-scene 应该直接用 board control 的
|
|
63
|
+
_whiteboardObserver = {
|
|
64
|
+
onActive: this._handleOnWhiteboardActive.bind(this),
|
|
65
|
+
onInactive: this._handleOnWhiteboardInActive.bind(this)
|
|
66
|
+
};
|
|
49
67
|
get ownerId() {
|
|
50
68
|
return this._shareOwnerId;
|
|
51
69
|
}
|
|
@@ -53,27 +71,6 @@ export class FcrSharingControlImpl {
|
|
|
53
71
|
return this._shareOwnerStream;
|
|
54
72
|
}
|
|
55
73
|
constructor(_scene, _api, _engine, _config, _privilegeControl, _streamControl, _sharedCache, _userControl) {
|
|
56
|
-
_defineProperty(this, _ref, (_initProto(this), createLogger({
|
|
57
|
-
prefix: 'FcrSharingControlImpl'
|
|
58
|
-
})));
|
|
59
|
-
_defineProperty(this, "_observable", new AgoraObservable());
|
|
60
|
-
_defineProperty(this, "_isActive", false);
|
|
61
|
-
_defineProperty(this, "_shareOwnerId", '');
|
|
62
|
-
_defineProperty(this, "_shareOwnerStream", null);
|
|
63
|
-
_defineProperty(this, "_lastScreenSharingState", FcrScreenSharingState.END);
|
|
64
|
-
_defineProperty(this, "_lastScreenSharingStreamId", null);
|
|
65
|
-
_defineProperty(this, "_streamObserver", {
|
|
66
|
-
onStreamsAdded: this._handleOnStreamsAdded.bind(this),
|
|
67
|
-
onStreamsRemoved: this._handleOnStreamsRemoved.bind(this)
|
|
68
|
-
});
|
|
69
|
-
_defineProperty(this, "_sceneObserver", {
|
|
70
|
-
onScenePropertiesUpdated: this._handleOnScenePropertiesUpdated.bind(this)
|
|
71
|
-
});
|
|
72
|
-
// TODO: 这里不应该再维护一套白板的状态和事件了, ui-scene 应该直接用 board control 的
|
|
73
|
-
_defineProperty(this, "_whiteboardObserver", {
|
|
74
|
-
onActive: this._handleOnWhiteboardActive.bind(this),
|
|
75
|
-
onInactive: this._handleOnWhiteboardInActive.bind(this)
|
|
76
|
-
});
|
|
77
74
|
this._scene = _scene;
|
|
78
75
|
this._api = _api;
|
|
79
76
|
this._engine = _engine;
|
|
@@ -95,7 +92,7 @@ export class FcrSharingControlImpl {
|
|
|
95
92
|
this.logger.info('set board ip list to storage ', boardIpList);
|
|
96
93
|
setBoardIpList(boardIpList);
|
|
97
94
|
}
|
|
98
|
-
this.logger.info(
|
|
95
|
+
this.logger.info(`initialized, room id: ${this._scene.sceneId}`);
|
|
99
96
|
}
|
|
100
97
|
async startScreenSharing(config, size, labels) {
|
|
101
98
|
try {
|
|
@@ -157,9 +154,10 @@ export class FcrSharingControlImpl {
|
|
|
157
154
|
}
|
|
158
155
|
getAnnotationControl() {
|
|
159
156
|
if (!this._annotationControl) {
|
|
160
|
-
const
|
|
161
|
-
userId
|
|
162
|
-
userName
|
|
157
|
+
const {
|
|
158
|
+
userId,
|
|
159
|
+
userName
|
|
160
|
+
} = this._userControl.getLocalUser();
|
|
163
161
|
const annotationConfig = {
|
|
164
162
|
userId,
|
|
165
163
|
userName,
|
|
@@ -176,17 +174,15 @@ export class FcrSharingControlImpl {
|
|
|
176
174
|
this._engine._rtmClient._client, annotationConfig, {
|
|
177
175
|
sceneId: this._scene.sceneId,
|
|
178
176
|
getAnnotationState: () => {
|
|
179
|
-
|
|
180
|
-
return (_this$_scene$getScene = this._scene.getScenePropertiesByKeyPath('widgets.annotation.state')) !== null && _this$_scene$getScene !== void 0 ? _this$_scene$getScene : FcrBoardPropertiesState.INACTIVE;
|
|
177
|
+
return this._scene.getScenePropertiesByKeyPath('widgets.annotation.state') ?? FcrBoardPropertiesState.INACTIVE;
|
|
181
178
|
},
|
|
182
179
|
getBoardPerformance: () => getBoardPerformance(this._scene),
|
|
183
180
|
isAndroidByOwner: () => {
|
|
184
|
-
|
|
185
|
-
const sharingOwner = (_this$_streamControl$ = this._streamControl.getStreamList().find(stream => stream.videoSourceType === FcrVideoSourceType.SCREEN)) === null || _this$_streamControl$ === void 0 ? void 0 : _this$_streamControl$.owner;
|
|
181
|
+
const sharingOwner = this._streamControl.getStreamList().find(stream => stream.videoSourceType === FcrVideoSourceType.SCREEN)?.owner;
|
|
186
182
|
if (!sharingOwner) {
|
|
187
183
|
return false;
|
|
188
184
|
}
|
|
189
|
-
return
|
|
185
|
+
return this._userControl.getUser(sharingOwner.userId)?.platform === FcrPlatform.ANDROID;
|
|
190
186
|
}
|
|
191
187
|
}, this._api);
|
|
192
188
|
}
|
|
@@ -206,9 +202,10 @@ export class FcrSharingControlImpl {
|
|
|
206
202
|
getBoardControl() {
|
|
207
203
|
if (!this._whiteboardControl) {
|
|
208
204
|
const factory = new FcrWhiteboardControlFactoryImpl();
|
|
209
|
-
const
|
|
210
|
-
userId
|
|
211
|
-
userName
|
|
205
|
+
const {
|
|
206
|
+
userId,
|
|
207
|
+
userName
|
|
208
|
+
} = this._userControl.getLocalUser();
|
|
212
209
|
const boardConfig = {
|
|
213
210
|
userId,
|
|
214
211
|
userName,
|
|
@@ -242,7 +239,9 @@ export class FcrSharingControlImpl {
|
|
|
242
239
|
}
|
|
243
240
|
_handleOnStreamsAdded(roomId, events) {
|
|
244
241
|
events.forEach(event => {
|
|
245
|
-
const
|
|
242
|
+
const {
|
|
243
|
+
modifiedStream
|
|
244
|
+
} = event;
|
|
246
245
|
if (this._isStreamToHandleScreenSharing(modifiedStream)) {
|
|
247
246
|
this._shareOwnerId = modifiedStream.owner.userId;
|
|
248
247
|
this._shareOwnerStream = modifiedStream;
|
|
@@ -252,48 +251,48 @@ export class FcrSharingControlImpl {
|
|
|
252
251
|
}
|
|
253
252
|
_handleOnStreamsRemoved(roomId, events) {
|
|
254
253
|
events.forEach(event => {
|
|
255
|
-
const
|
|
254
|
+
const {
|
|
255
|
+
modifiedStream
|
|
256
|
+
} = event;
|
|
256
257
|
const ownerId = modifiedStream.owner.userId;
|
|
257
258
|
if (this._isStreamToHandleScreenSharing(modifiedStream)) {
|
|
258
259
|
this._notifyScreenSharingUpdated('onScreenSharingUpdated', modifiedStream, FcrScreenSharingState.END);
|
|
259
260
|
if (this.getScreenSharingState() === FcrScreenSharingState.END) {
|
|
260
261
|
const isMeSharing = ownerId === this._userControl.getLocalUser().userId;
|
|
261
262
|
if (isMeSharing) {
|
|
262
|
-
var _this$_annotationCont;
|
|
263
263
|
this.logger.info('on stream removed, clean before terminal Annotation app');
|
|
264
|
-
|
|
264
|
+
this._annotationControl.getMainWindow()?.clean();
|
|
265
265
|
}
|
|
266
266
|
}
|
|
267
267
|
}
|
|
268
268
|
});
|
|
269
269
|
}
|
|
270
270
|
_handleOnScenePropertiesUpdated(sceneId, event) {
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
271
|
+
const {
|
|
272
|
+
cause
|
|
273
|
+
} = event;
|
|
274
|
+
const causeData = cause?.data;
|
|
274
275
|
const currentScreenSharingState = this.getScreenSharingState();
|
|
275
|
-
const causeCmd = cause
|
|
276
|
+
const causeCmd = cause?.cmd;
|
|
276
277
|
const isWidgetPropertiesUpdated = causeCmd === 10;
|
|
277
|
-
const isAnnotationWidgetUpdated =
|
|
278
|
-
const isAnnotationStateUpdated =
|
|
278
|
+
const isAnnotationWidgetUpdated = causeData?.widgetUuid === FcrWidgetUuid.ANNOTATION;
|
|
279
|
+
const isAnnotationStateUpdated = causeData?.widgetCause?.cmd === FcrWidgetCauseCmd.ANNOTATION;
|
|
279
280
|
if (!isWidgetPropertiesUpdated || !isAnnotationWidgetUpdated) {
|
|
280
281
|
return;
|
|
281
282
|
}
|
|
282
283
|
if (currentScreenSharingState === FcrScreenSharingState.END) {
|
|
283
|
-
|
|
284
|
-
if (((_causeData$widgetCaus2 = causeData.widgetCause) === null || _causeData$widgetCaus2 === void 0 ? void 0 : _causeData$widgetCaus2.cmd) === FcrWidgetCauseCmd.ANNOTATION) {
|
|
284
|
+
if (causeData.widgetCause?.cmd === FcrWidgetCauseCmd.ANNOTATION) {
|
|
285
285
|
this._notifyScreenSharingUpdated('onScreenSharingUpdated', this.ownerStream, FcrScreenSharingState.END);
|
|
286
286
|
const isMeSharing = this.ownerId === this._userControl.getLocalUser().userId;
|
|
287
287
|
if (isMeSharing) {
|
|
288
|
-
var _this$_annotationCont2;
|
|
289
288
|
this.logger.info('clean annotation board');
|
|
290
|
-
|
|
289
|
+
this._annotationControl.getMainWindow()?.clean();
|
|
291
290
|
}
|
|
292
291
|
}
|
|
293
292
|
} else {
|
|
294
293
|
if (isAnnotationStateUpdated) {
|
|
295
294
|
const screenStream = this._getScreenShareStreamByUuid();
|
|
296
|
-
this._notifyScreenSharingUpdated('onScreenSharingUpdated', screenStream
|
|
295
|
+
this._notifyScreenSharingUpdated('onScreenSharingUpdated', screenStream ?? this.ownerStream, FcrScreenSharingState.START_WHIT_ANNOTATION);
|
|
297
296
|
// const owner = this._userControl.getUser(this.ownerId);
|
|
298
297
|
// const isElectron =
|
|
299
298
|
// owner &&
|
|
@@ -334,8 +333,7 @@ export class FcrSharingControlImpl {
|
|
|
334
333
|
return typeof stream === 'undefined' ? null : stream;
|
|
335
334
|
}
|
|
336
335
|
_notifyScreenSharingUpdated(eventName, streamInfo, state) {
|
|
337
|
-
|
|
338
|
-
const streamId = (_streamInfo$streamId = streamInfo === null || streamInfo === void 0 ? void 0 : streamInfo.streamId) !== null && _streamInfo$streamId !== void 0 ? _streamInfo$streamId : null;
|
|
336
|
+
const streamId = streamInfo?.streamId ?? null;
|
|
339
337
|
if (this._lastScreenSharingState === state && this._lastScreenSharingStreamId === streamId) {
|
|
340
338
|
return;
|
|
341
339
|
}
|
|
@@ -346,9 +344,4 @@ export class FcrSharingControlImpl {
|
|
|
346
344
|
_addLogObserver() {
|
|
347
345
|
this.addObserver(generateLogObserver(this.logger, [['onScreenSharingUpdated', ['streamInfo', 'state']], ['onWhiteboardStarted', ['ownerId', 'operatorUser']], ['onWhiteboardEnded', ['reason', 'operatorUser']]]));
|
|
348
346
|
}
|
|
349
|
-
}
|
|
350
|
-
_FcrSharingControlImpl = FcrSharingControlImpl;
|
|
351
|
-
var _applyDecs$e = _applyDecs(_FcrSharingControlImpl, [[_startScreenSharingDecs, 2, "startScreenSharing"], [trace, 2, "startWhiteboard"], [_updateScreenSharingDecs, 2, "updateScreenSharing"], [trace, 2, "stop"], [trace, 2, "getScreenSharingState"]], []).e;
|
|
352
|
-
var _applyDecs$e2 = _slicedToArray(_applyDecs$e, 1);
|
|
353
|
-
_initProto = _applyDecs$e2[0];
|
|
354
|
-
_applyDecs$e;
|
|
347
|
+
}
|