fcr-core 3.7.2 → 3.7.4
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 +4 -2
- package/lib/engine/index.d.ts +1 -1
- package/lib/engine/index.js +18 -15
- package/lib/imports.d.ts +8 -6
- package/lib/imports.js +38 -18
- package/lib/index.d.ts +2 -1
- package/lib/index.js +6 -0
- package/lib/media-control/desktop.js +10 -8
- package/lib/media-control/mobile.js +6 -4
- package/lib/media-control/type.d.ts +10 -14
- package/lib/monitor-control/index.js +4 -2
- package/lib/peer-session/index.js +4 -2
- package/lib/plugins/chatroom.js +4 -2
- package/lib/room-control/ability-control/index.js +4 -2
- package/lib/room-control/group-control/index.js +4 -2
- package/lib/room-control/index.js +14 -7
- package/lib/room-control/interpreter-control/index.js +4 -2
- package/lib/room-control/interpreter-control/room.js +2 -3
- package/lib/room-control/join-before-host-waitingroom-control/index.js +2 -2
- package/lib/room-control/mainroom-control/index.js +52 -13
- package/lib/room-control/privilege-control/index.js +4 -2
- package/lib/room-control/room-connector-control/index.js +4 -2
- package/lib/room-control/room-session/index.js +4 -2
- package/lib/room-control/sharing-control/index.d.ts +8 -7
- package/lib/room-control/sharing-control/index.js +33 -34
- package/lib/room-control/sharing-control/type.d.ts +4 -4
- package/lib/room-control/stream-control/index.js +5 -7
- package/lib/room-control/user-control/index.js +4 -2
- package/lib/room-control/waitingroom-control/index.js +6 -4
- package/lib/room-control/whiteboard-control/types.d.ts +16 -13
- package/lib/room-control/whiteboard-control-v2/annotation-control/control.d.ts +32 -0
- package/lib/room-control/whiteboard-control-v2/annotation-control/control.js +239 -0
- package/lib/room-control/whiteboard-control-v2/annotation-control/index.d.ts +15 -35
- package/lib/room-control/whiteboard-control-v2/annotation-control/index.js +32 -217
- package/lib/room-control/whiteboard-control-v2/annotation-control/privilege-control.d.ts +36 -0
- package/lib/room-control/whiteboard-control-v2/annotation-control/privilege-control.js +252 -0
- package/lib/room-control/whiteboard-control-v2/annotation-control/type.d.ts +15 -3
- package/lib/room-control/whiteboard-control-v2/annotation-control/type.js +3 -1
- package/lib/room-control/whiteboard-control-v2/index.d.ts +3 -3
- package/lib/room-control/whiteboard-control-v2/index.js +7 -4
- package/lib/room-control/whiteboard-control-v2/main-window.d.ts +7 -11
- package/lib/room-control/whiteboard-control-v2/main-window.js +42 -48
- package/lib/room-control/whiteboard-control-v2/utils.d.ts +17 -0
- package/lib/room-control/whiteboard-control-v2/utils.js +64 -1
- package/lib/room-control/whiteboard-control-v2/whiteboard-control/control.d.ts +34 -0
- package/lib/room-control/whiteboard-control-v2/whiteboard-control/control.js +234 -0
- package/lib/room-control/whiteboard-control-v2/whiteboard-control/index.d.ts +17 -0
- package/lib/room-control/whiteboard-control-v2/whiteboard-control/index.js +30 -0
- package/lib/room-control/whiteboard-control-v2/whiteboard-control/privilege-control.d.ts +36 -0
- package/lib/room-control/whiteboard-control-v2/whiteboard-control/privilege-control.js +240 -0
- package/lib/room-control/whiteboard-control-v2/whiteboard-control/type.d.ts +20 -4
- package/lib/room-control/whiteboard-control-v2/whiteboard-control/type.js +9 -1
- package/lib/room-router/index.js +10 -7
- package/lib/schema.d.ts +24 -2
- package/lib/schema.js +2 -1
- package/lib/service/api.d.ts +7 -2
- package/lib/service/api.js +8 -7
- package/lib/type.d.ts +3 -3
- package/lib/type.js +19 -0
- package/lib/utilities/constant.d.ts +1 -0
- package/lib/utilities/constant.js +7 -0
- package/lib/utilities/error.d.ts +7 -12
- package/lib/utilities/error.js +51 -23
- package/lib/utilities/logger.d.ts +0 -1
- package/lib/utilities/logger.js +2 -3
- package/lib/utilities/parameters.d.ts +1 -0
- package/lib/utilities/parameters.js +21 -2
- package/lib/utilities/shared-storage.d.ts +5 -0
- package/lib/utilities/shared-storage.js +34 -0
- package/lib/utilities/storage.d.ts +8 -0
- package/lib/utilities/storage.js +32 -0
- package/package.json +7 -13
- package/lib/room-control/whiteboard-control/board-window.d.ts +0 -52
- package/lib/room-control/whiteboard-control/board-window.js +0 -405
- package/lib/room-control/whiteboard-control/index.d.ts +0 -1
- package/lib/room-control/whiteboard-control/index.js +0 -343
- package/lib/room-control/whiteboard-control/mount-manager.d.ts +0 -4
- package/lib/room-control/whiteboard-control/mount-manager.js +0 -13
- package/lib/room-control/whiteboard-control/utils.d.ts +0 -51
- package/lib/room-control/whiteboard-control/utils.js +0 -270
|
@@ -1,343 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
require("core-js/modules/es.array.push.js");
|
|
4
|
-
require("core-js/modules/esnext.function.metadata.js");
|
|
5
|
-
require("core-js/modules/esnext.map.delete-all.js");
|
|
6
|
-
require("core-js/modules/esnext.map.emplace.js");
|
|
7
|
-
require("core-js/modules/esnext.map.every.js");
|
|
8
|
-
require("core-js/modules/esnext.map.filter.js");
|
|
9
|
-
require("core-js/modules/esnext.map.find.js");
|
|
10
|
-
require("core-js/modules/esnext.map.find-key.js");
|
|
11
|
-
require("core-js/modules/esnext.map.includes.js");
|
|
12
|
-
require("core-js/modules/esnext.map.key-of.js");
|
|
13
|
-
require("core-js/modules/esnext.map.map-keys.js");
|
|
14
|
-
require("core-js/modules/esnext.map.map-values.js");
|
|
15
|
-
require("core-js/modules/esnext.map.merge.js");
|
|
16
|
-
require("core-js/modules/esnext.map.reduce.js");
|
|
17
|
-
require("core-js/modules/esnext.map.some.js");
|
|
18
|
-
require("core-js/modules/esnext.map.update.js");
|
|
19
|
-
require("core-js/modules/esnext.symbol.metadata.js");
|
|
20
|
-
require("core-js/modules/esnext.weak-map.delete-all.js");
|
|
21
|
-
require("core-js/modules/esnext.weak-map.emplace.js");
|
|
22
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
23
|
-
Object.defineProperty(exports, "__esModule", {
|
|
24
|
-
value: true
|
|
25
|
-
});
|
|
26
|
-
exports.FcrWhiteboardControlImpl = void 0;
|
|
27
|
-
require("core-js/modules/esnext.iterator.constructor.js");
|
|
28
|
-
require("core-js/modules/esnext.iterator.map.js");
|
|
29
|
-
var _imports = require("../../imports");
|
|
30
|
-
var _whiteWebSdk = require("white-web-sdk");
|
|
31
|
-
var netlessVideoPlugin = _interopRequireWildcard(require("@netless/video-js-plugin"));
|
|
32
|
-
var _windowManager = require("@netless/window-manager");
|
|
33
|
-
var _utils = require("./utils");
|
|
34
|
-
var _observable = require("agora-foundation/lib/utilities/observable");
|
|
35
|
-
var _asyncRetry = require("agora-foundation/lib/utilities/async-retry");
|
|
36
|
-
var _boardWindow = require("./board-window");
|
|
37
|
-
var _enums = require("./enums");
|
|
38
|
-
var _user = require("../../utilities/user");
|
|
39
|
-
var _2 = require("../..");
|
|
40
|
-
var _logger = require("../../utilities/logger");
|
|
41
|
-
var _error = require("../../utilities/error");
|
|
42
|
-
var _validateParams = _interopRequireDefault(require("../../utilities/validate-params"));
|
|
43
|
-
var _schema = require("../../schema");
|
|
44
|
-
let _initProto, _setBackgroundColorDecs;
|
|
45
|
-
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
46
|
-
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)]; } }; }
|
|
47
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
48
|
-
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); }
|
|
49
|
-
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; }
|
|
50
|
-
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; }
|
|
51
|
-
/**
|
|
52
|
-
* @internal
|
|
53
|
-
*/
|
|
54
|
-
class FcrWhiteboardControlImpl {
|
|
55
|
-
static #_ = (() => [_initProto] = _applyDecs(this, [[[_imports.bound, _imports.trace], 2, "active"], [[_imports.bound, _imports.trace], 2, "inactive"], [[_imports.bound, _imports.trace], 2, "open"], [[_imports.bound, _imports.trace], 2, "close"], [_setBackgroundColorDecs, 2, "setBackgroundColor"], [[_imports.bound, _imports.trace], 2, "getActivity"], [[_imports.bound, _imports.trace], 2, "getOwnerId"], [[_imports.bound, _imports.trace], 2, "getBackgroundColor"], [[_imports.bound, _imports.trace], 2, "getConnectionState"], [[_imports.bound, _imports.trace], 2, "getMainWindow"], [[_imports.bound, _imports.trace], 2, "addObserver"], [[_imports.bound, _imports.trace], 2, "removeObserver"], [_imports.bound, 2, "getBoardActiveInfo"], [_imports.trace, 2, "leave"], [_imports.bound, 2, "_getToken"], [_imports.bound, 2, "_handleRoomStateUpdated"], [_imports.bound, 2, "_updateConnnectionState"], [_imports.bound, 2, "_handleConnectionStateUpdated"]], []).e)();
|
|
56
|
-
[(_setBackgroundColorDecs = [_imports.bound, _imports.trace, (0, _validateParams.default)(_schema.stringSchema)], "logger")] = (() => (_initProto(this), (0, _logger.createLogger)({
|
|
57
|
-
prefix: 'FcrWhiteboardControlImpl'
|
|
58
|
-
})))();
|
|
59
|
-
_client = (() => ({}))();
|
|
60
|
-
_joined = false;
|
|
61
|
-
_connectState = (() => _2.FcrConnectionState.DISCONNECTED)();
|
|
62
|
-
_observable = (() => new _observable.AgoraObservable())();
|
|
63
|
-
_options = {
|
|
64
|
-
debug: false
|
|
65
|
-
};
|
|
66
|
-
constructor(_scene, _privilegeControl, _api, _sharedCache) {
|
|
67
|
-
this._scene = _scene;
|
|
68
|
-
this._privilegeControl = _privilegeControl;
|
|
69
|
-
this._api = _api;
|
|
70
|
-
this._sharedCache = _sharedCache;
|
|
71
|
-
this._roomCache = _sharedCache.getRoomCache(this._scene.sceneId);
|
|
72
|
-
_scene.addObserver({
|
|
73
|
-
onScenePropertiesUpdated: (_, event) => {
|
|
74
|
-
const operatorUser = (0, _user.convertRteUserToFcrUser)(event.operatorUser, this._roomCache);
|
|
75
|
-
if (event.cause?.cmd === 10) {
|
|
76
|
-
const {
|
|
77
|
-
state,
|
|
78
|
-
extra: {
|
|
79
|
-
backgroundColor: bgColor
|
|
80
|
-
}
|
|
81
|
-
} = _scene.getScenePropertiesByKeyPath('widgets.netlessBoard') ?? {
|
|
82
|
-
state: 0,
|
|
83
|
-
extra: {
|
|
84
|
-
backgroundColor: '#fff'
|
|
85
|
-
}
|
|
86
|
-
};
|
|
87
|
-
if (state === 1) {
|
|
88
|
-
this._observable.notifyObservers('onActive', _scene.getScenePropertiesByKeyPath('widgets.netlessBoard').ownerUserUuid, operatorUser);
|
|
89
|
-
}
|
|
90
|
-
if (state === 0) {
|
|
91
|
-
this._observable.notifyObservers('onInactive', event.cause.data.widgetCause?.data?.reason, operatorUser);
|
|
92
|
-
}
|
|
93
|
-
if (event.cause.data.widgetCause?.cmd === 100101) {
|
|
94
|
-
this._observable.notifyObservers('onBackgroundColorUpdated', bgColor, operatorUser);
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
});
|
|
99
|
-
this._addLogObserver();
|
|
100
|
-
}
|
|
101
|
-
async active() {
|
|
102
|
-
return (0, _error.handleRequestError)(() => this._api.toggleWhiteboardActivityState(this._scene.sceneId, _enums.FcrSharePermissionState.ON), _error.FcrErrorModuleCode.ROOM_WHITEBOARD, 'active failed');
|
|
103
|
-
}
|
|
104
|
-
async inactive() {
|
|
105
|
-
return (0, _error.handleRequestError)(() => this._api.toggleWhiteboardActivityState(this._scene.sceneId, _enums.FcrSharePermissionState.OFF), _error.FcrErrorModuleCode.ROOM_WHITEBOARD, 'inactive failed');
|
|
106
|
-
}
|
|
107
|
-
async open() {
|
|
108
|
-
// 白板权限禁用状态下,主持人和联席主持人仍然可以发起共享,所以,不能根据是否禁用状态直接拒绝
|
|
109
|
-
const roomId = this._scene.sceneId;
|
|
110
|
-
const userId = this._scene.localUser.getLocalUserId();
|
|
111
|
-
const cursorName = this._scene.getUser(userId)?.userName;
|
|
112
|
-
const {
|
|
113
|
-
data
|
|
114
|
-
} = await this._getToken(roomId, userId);
|
|
115
|
-
const {
|
|
116
|
-
boardAppId,
|
|
117
|
-
boardId,
|
|
118
|
-
boardRegion,
|
|
119
|
-
boardToken
|
|
120
|
-
} = data || {};
|
|
121
|
-
this._joined = true;
|
|
122
|
-
if (this._connectState !== _2.FcrConnectionState.DISCONNECTED) {
|
|
123
|
-
return this._boardView;
|
|
124
|
-
}
|
|
125
|
-
const plugins = this._createPlugins();
|
|
126
|
-
this._client = new _whiteWebSdk.WhiteWebSdk({
|
|
127
|
-
appIdentifier: boardAppId,
|
|
128
|
-
useMobXState: true,
|
|
129
|
-
pptParams: {
|
|
130
|
-
useServerWrap: true
|
|
131
|
-
},
|
|
132
|
-
deviceType: _whiteWebSdk.DeviceType.Surface,
|
|
133
|
-
plugins,
|
|
134
|
-
preloadDynamicPPT: true,
|
|
135
|
-
loggerOptions: {
|
|
136
|
-
reportQualityMode: _whiteWebSdk.LoggerReportMode.AlwaysReport,
|
|
137
|
-
reportDebugLogMode: _whiteWebSdk.LoggerReportMode.AlwaysReport,
|
|
138
|
-
reportLevelMask: this._options.debug ? 'debug' : 'info',
|
|
139
|
-
printLevelMask: this._options.debug ? 'debug' : 'info'
|
|
140
|
-
}
|
|
141
|
-
});
|
|
142
|
-
const hasPermission = true;
|
|
143
|
-
const joinParams = {
|
|
144
|
-
region: boardRegion,
|
|
145
|
-
uuid: boardId,
|
|
146
|
-
uid: userId,
|
|
147
|
-
roomToken: boardToken,
|
|
148
|
-
isWritable: hasPermission,
|
|
149
|
-
disableDeviceInputs: false,
|
|
150
|
-
disableCameraTransform: true,
|
|
151
|
-
disableNewPencil: false,
|
|
152
|
-
disableEraseImage: false,
|
|
153
|
-
wrappedComponents: [],
|
|
154
|
-
invisiblePlugins: [_windowManager.WindowManager],
|
|
155
|
-
useMultiViews: true,
|
|
156
|
-
disableMagixEventDispatchLimit: true,
|
|
157
|
-
userPayload: {
|
|
158
|
-
userId,
|
|
159
|
-
avatar: '',
|
|
160
|
-
cursorName,
|
|
161
|
-
disappearCursor: true
|
|
162
|
-
},
|
|
163
|
-
floatBar: {
|
|
164
|
-
colors: _utils.textColors.map(color => (0, _utils.hexColorToWhiteboardColor)(color))
|
|
165
|
-
}
|
|
166
|
-
};
|
|
167
|
-
try {
|
|
168
|
-
const retriesMax = 10;
|
|
169
|
-
this._updateConnnectionState(_2.FcrConnectionState.CONNECTING);
|
|
170
|
-
await (0, _asyncRetry.retryAttempt)(async () => {
|
|
171
|
-
const room = await this._client.joinRoom(joinParams, {
|
|
172
|
-
onPhaseChanged: this._handleConnectionStateUpdated,
|
|
173
|
-
onRoomStateChanged: this._handleRoomStateUpdated
|
|
174
|
-
});
|
|
175
|
-
this._room = room;
|
|
176
|
-
room.setViewMode(_whiteWebSdk.ViewMode.Broadcaster);
|
|
177
|
-
this._boardView = new _boardWindow.FcrBoardMainWindowImpl(room, this._privilegeControl);
|
|
178
|
-
this._updateConnnectionState(_2.FcrConnectionState.CONNECTED);
|
|
179
|
-
}, [], {
|
|
180
|
-
retriesMax
|
|
181
|
-
}).fail(async _ref => {
|
|
182
|
-
let {
|
|
183
|
-
error,
|
|
184
|
-
timeFn,
|
|
185
|
-
currentRetry
|
|
186
|
-
} = _ref;
|
|
187
|
-
this.logger.info(`failed to join board room, error: ${error.message}, current retry: ${currentRetry}`);
|
|
188
|
-
if (this._joined) {
|
|
189
|
-
await timeFn();
|
|
190
|
-
}
|
|
191
|
-
this.logger.info(`continue attemptting? ${this._joined}`);
|
|
192
|
-
return this._joined;
|
|
193
|
-
}).abort(() => {
|
|
194
|
-
this._updateConnnectionState(_2.FcrConnectionState.DISCONNECTED);
|
|
195
|
-
}).exec();
|
|
196
|
-
} catch (e) {
|
|
197
|
-
this._updateConnnectionState(_2.FcrConnectionState.DISCONNECTED);
|
|
198
|
-
}
|
|
199
|
-
return this._boardView;
|
|
200
|
-
}
|
|
201
|
-
async close() {
|
|
202
|
-
this._joined = false;
|
|
203
|
-
if (this._boardView) {
|
|
204
|
-
// @ts-ignore
|
|
205
|
-
this._boardView.destroy();
|
|
206
|
-
this._boardView = undefined;
|
|
207
|
-
}
|
|
208
|
-
if (this._room) {
|
|
209
|
-
try {
|
|
210
|
-
// Workaround for whiteboard sdk issue: frameGenerator being null when disconnecting will cause error and trigger 'did-finish-loading' event in electron.
|
|
211
|
-
// Set writable to false to prevent this error from throwing.
|
|
212
|
-
this.logger.info('change writable to false before disconnecting');
|
|
213
|
-
this._room.setWritable(false);
|
|
214
|
-
await this._room.disconnect();
|
|
215
|
-
} catch (e) {}
|
|
216
|
-
this._room = undefined;
|
|
217
|
-
}
|
|
218
|
-
}
|
|
219
|
-
async setBackgroundColor(backgroundColor) {
|
|
220
|
-
this._api.setBackgroundColor({
|
|
221
|
-
roomId: this._scene.sceneId,
|
|
222
|
-
backgroundColor
|
|
223
|
-
}).then(() => {
|
|
224
|
-
Promise.resolve();
|
|
225
|
-
}).catch(e => {
|
|
226
|
-
Promise.reject(e);
|
|
227
|
-
});
|
|
228
|
-
}
|
|
229
|
-
getActivity() {
|
|
230
|
-
return this._scene.getScenePropertiesByKeyPath('widgets.netlessBoard').state === 1;
|
|
231
|
-
}
|
|
232
|
-
getOwnerId() {
|
|
233
|
-
return this._scene.getScenePropertiesByKeyPath('widgets.netlessBoard.ownerUserUuid');
|
|
234
|
-
}
|
|
235
|
-
getBackgroundColor() {
|
|
236
|
-
return this._scene.getScenePropertiesByKeyPath('widgets.netlessBoard.extra.backgroundColor');
|
|
237
|
-
}
|
|
238
|
-
getConnectionState() {
|
|
239
|
-
return this._connectState;
|
|
240
|
-
}
|
|
241
|
-
getMainWindow() {
|
|
242
|
-
return this._boardView;
|
|
243
|
-
}
|
|
244
|
-
addObserver(observer) {
|
|
245
|
-
this._observable.addObserver(observer);
|
|
246
|
-
}
|
|
247
|
-
removeObserver(observer) {
|
|
248
|
-
this._observable.removeObserver(observer);
|
|
249
|
-
}
|
|
250
|
-
getBoardActiveInfo() {
|
|
251
|
-
const {
|
|
252
|
-
state,
|
|
253
|
-
ownerUserUuid: ownerUserId
|
|
254
|
-
} = this._scene.getScenePropertiesByKeyPath('widgets.netlessBoard');
|
|
255
|
-
if (state === _enums.FcrSharePermissionState.ON) {
|
|
256
|
-
return {
|
|
257
|
-
isActive: true,
|
|
258
|
-
ownerUserId
|
|
259
|
-
};
|
|
260
|
-
} else {
|
|
261
|
-
return {
|
|
262
|
-
isActive: false,
|
|
263
|
-
ownerUserId: null
|
|
264
|
-
};
|
|
265
|
-
}
|
|
266
|
-
}
|
|
267
|
-
async leave() {
|
|
268
|
-
//@ts-ignore
|
|
269
|
-
this._boardView?.destroy();
|
|
270
|
-
this._boardView = undefined;
|
|
271
|
-
this._room?.disconnect();
|
|
272
|
-
this._room = undefined;
|
|
273
|
-
}
|
|
274
|
-
_createPlugins() {
|
|
275
|
-
const plugins = (0, _whiteWebSdk.createPlugins)({
|
|
276
|
-
[netlessVideoPlugin.PluginId]: netlessVideoPlugin.videoJsPlugin()
|
|
277
|
-
});
|
|
278
|
-
plugins.setPluginContext(netlessVideoPlugin.PluginId, {
|
|
279
|
-
enable: true,
|
|
280
|
-
verbose: true
|
|
281
|
-
});
|
|
282
|
-
return plugins;
|
|
283
|
-
}
|
|
284
|
-
async _getToken(roomId, userId) {
|
|
285
|
-
return await (0, _error.handleRequestError)(() => this._api.getWhiteboardToken({
|
|
286
|
-
roomId,
|
|
287
|
-
userId
|
|
288
|
-
}), _error.FcrErrorModuleCode.ROOM_WHITEBOARD, 'get whiteboard token failed');
|
|
289
|
-
}
|
|
290
|
-
_handleRoomStateUpdated(state) {
|
|
291
|
-
const {
|
|
292
|
-
memberState
|
|
293
|
-
} = state;
|
|
294
|
-
if (memberState) {
|
|
295
|
-
const {
|
|
296
|
-
strokeColor,
|
|
297
|
-
strokeWidth,
|
|
298
|
-
currentApplianceName,
|
|
299
|
-
textSize,
|
|
300
|
-
shapeType
|
|
301
|
-
} = memberState;
|
|
302
|
-
const localState = {};
|
|
303
|
-
const [tool, shape] = (0, _utils.convertToFcrBoardToolShape)(currentApplianceName, shapeType);
|
|
304
|
-
localState.tool = tool;
|
|
305
|
-
localState.shape = shape;
|
|
306
|
-
if (typeof strokeColor !== 'undefined') {
|
|
307
|
-
const [r, g, b] = strokeColor;
|
|
308
|
-
localState.strokeColor = {
|
|
309
|
-
r,
|
|
310
|
-
g,
|
|
311
|
-
b
|
|
312
|
-
};
|
|
313
|
-
}
|
|
314
|
-
if (typeof strokeWidth !== 'undefined') {
|
|
315
|
-
localState.strokeWidth = strokeWidth;
|
|
316
|
-
}
|
|
317
|
-
if (typeof textSize !== 'undefined') {
|
|
318
|
-
localState.textSize = textSize;
|
|
319
|
-
}
|
|
320
|
-
}
|
|
321
|
-
}
|
|
322
|
-
_updateConnnectionState(state) {
|
|
323
|
-
this._connectState = state;
|
|
324
|
-
this._observable.notifyObservers('onConnectionStateUpdated', state);
|
|
325
|
-
}
|
|
326
|
-
_handleConnectionStateUpdated(phase) {
|
|
327
|
-
if (phase === _whiteWebSdk.RoomPhase.Connecting) {
|
|
328
|
-
this._updateConnnectionState(_2.FcrConnectionState.CONNECTING);
|
|
329
|
-
} else if (phase === _whiteWebSdk.RoomPhase.Connected) {
|
|
330
|
-
// this._updateConnnectionState(FcrBoardRoomConnectionState.CONNECTED);
|
|
331
|
-
} else if (phase === _whiteWebSdk.RoomPhase.Reconnecting) {
|
|
332
|
-
this._updateConnnectionState(_2.FcrConnectionState.RECONNECTING);
|
|
333
|
-
} else if (phase === _whiteWebSdk.RoomPhase.Disconnected) {
|
|
334
|
-
this._updateConnnectionState(_2.FcrConnectionState.DISCONNECTED);
|
|
335
|
-
} else if (phase === _whiteWebSdk.RoomPhase.Disconnecting) {
|
|
336
|
-
// this._updateConnnectionState(FcrConnectionState.DISCONNECTING);
|
|
337
|
-
}
|
|
338
|
-
}
|
|
339
|
-
_addLogObserver() {
|
|
340
|
-
this.addObserver((0, _logger.generateLogObserver)(this.logger, ['onActive', 'onInactive', 'onBackgroundColorUpdated', 'onConnectionStateUpdated']));
|
|
341
|
-
}
|
|
342
|
-
}
|
|
343
|
-
exports.FcrWhiteboardControlImpl = FcrWhiteboardControlImpl;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.BoardMountManager = void 0;
|
|
7
|
-
class BoardMountManager {
|
|
8
|
-
static isMounting = false;
|
|
9
|
-
static setIsMounting(isMounting) {
|
|
10
|
-
BoardMountManager.isMounting = isMounting;
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
exports.BoardMountManager = BoardMountManager;
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import { BaseImageSize, FetchImageResult } from './types';
|
|
2
|
-
import { ApplianceNames, FcrBoardShape, FcrBoardToolType, ShapeType } from './enums';
|
|
3
|
-
export declare const heightPerTool = 36;
|
|
4
|
-
export declare const heightPerColor = 18;
|
|
5
|
-
export declare const defaultToolsRetain: number;
|
|
6
|
-
export declare const verticalPadding = 10;
|
|
7
|
-
export declare const sceneNavHeight: number;
|
|
8
|
-
export declare const widgetContainerClassName = "netless-whiteboard-wrapper";
|
|
9
|
-
export declare const layoutContentClassName = "fcr-layout-content-main-view";
|
|
10
|
-
export declare const videoRowClassName = "fcr-layout-content-video-list-row";
|
|
11
|
-
export declare const toolbarClassName = "fcr-board-toolbar";
|
|
12
|
-
export declare const windowClassName = "netless-whiteboard-wrapper";
|
|
13
|
-
export declare const WINDOW_TITLE_HEIGHT = 28;
|
|
14
|
-
export declare const WINDOW_ASPECT_RATIO: number;
|
|
15
|
-
export declare const WINDOW_MIN_SIZE: {
|
|
16
|
-
width: number;
|
|
17
|
-
height: number;
|
|
18
|
-
};
|
|
19
|
-
export declare const WINDOW_REMAIN_SIZE: {
|
|
20
|
-
width: number;
|
|
21
|
-
height: number;
|
|
22
|
-
};
|
|
23
|
-
export declare const WINDOW_REMAIN_POSITION: {
|
|
24
|
-
x: number;
|
|
25
|
-
y: number;
|
|
26
|
-
};
|
|
27
|
-
/**
|
|
28
|
-
* 根据
|
|
29
|
-
* @param imageInnerSize
|
|
30
|
-
* @returns
|
|
31
|
-
*/
|
|
32
|
-
export declare const getImageSize: (imageInnerSize: BaseImageSize, containerSize: BaseImageSize) => BaseImageSize;
|
|
33
|
-
/**
|
|
34
|
-
*
|
|
35
|
-
* @param url
|
|
36
|
-
* @returns
|
|
37
|
-
*/
|
|
38
|
-
export declare const fetchImageInfoByUrl: (url: string, containerSize: BaseImageSize) => Promise<FetchImageResult>;
|
|
39
|
-
export declare const mergeCanvasImage: (scenes: (() => Promise<HTMLCanvasElement | null>)[]) => Promise<HTMLCanvasElement>;
|
|
40
|
-
export declare const textColors: string[];
|
|
41
|
-
export declare const defaultStrokeColor: {
|
|
42
|
-
r: number;
|
|
43
|
-
g: number;
|
|
44
|
-
b: number;
|
|
45
|
-
};
|
|
46
|
-
export declare const defaultTextSize = 24;
|
|
47
|
-
export declare const mediaMimeTypes: Record<string, string>;
|
|
48
|
-
export declare const convertToNetlessBoardTool: (tool: FcrBoardToolType) => never[] | readonly [ApplianceNames.selector] | readonly [ApplianceNames.pencilEraser] | readonly [ApplianceNames.laserPointer] | readonly [ApplianceNames.hand] | readonly [ApplianceNames.text] | readonly [ApplianceNames.arrow] | readonly [ApplianceNames.rectangle] | readonly [ApplianceNames.ellipse] | readonly [ApplianceNames.straight] | readonly [ApplianceNames.pencil] | readonly [ApplianceNames.shape, ShapeType.Triangle] | readonly [ApplianceNames.shape, ShapeType.Pentagram] | readonly [ApplianceNames.shape, ShapeType.Rhombus];
|
|
49
|
-
export declare const convertToFcrBoardToolShape: (tool?: ApplianceNames, shape?: ShapeType) => FcrBoardToolType[] | (FcrBoardShape | undefined)[];
|
|
50
|
-
export declare const hexColorToWhiteboardColor: (val: string) => number[];
|
|
51
|
-
export declare const src2DataURL: (src: string) => Promise<string>;
|