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