fcr-core 3.6.0 → 3.6.2
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 +1 -1
- package/lib/room-control/ability-control/index.js +1 -1
- package/lib/room-control/index.js +12 -8
- package/lib/room-control/interpreter-control/index.js +13 -3
- package/lib/room-control/mainroom-control/index.js +17 -2
- package/lib/room-control/privilege-control/index.js +32 -4
- package/lib/room-control/privilege-control/type.d.ts +13 -3
- package/lib/room-control/privilege-control/type.js +3 -0
- package/lib/room-control/sharing-control/index.d.ts +44 -0
- package/lib/room-control/sharing-control/index.js +217 -0
- package/lib/room-control/sharing-control/type.d.ts +31 -0
- package/lib/room-control/sharing-control/type.js +17 -0
- package/lib/room-control/stream-control/index.js +80 -11
- package/lib/room-control/stream-control/type.d.ts +3 -2
- package/lib/room-control/type.d.ts +5 -5
- package/lib/room-control/whiteboard-control/board-window.d.ts +4 -3
- package/lib/room-control/whiteboard-control/board-window.js +4 -1
- package/lib/room-control/whiteboard-control/types.d.ts +39 -72
- package/lib/room-control/whiteboard-control-v2/annotation-control/index.d.ts +33 -0
- package/lib/room-control/whiteboard-control-v2/annotation-control/index.js +187 -0
- package/lib/room-control/whiteboard-control-v2/annotation-control/type.d.ts +32 -0
- package/lib/room-control/whiteboard-control-v2/annotation-control/type.js +5 -0
- package/lib/room-control/whiteboard-control-v2/index.d.ts +2 -1
- package/lib/room-control/whiteboard-control-v2/index.js +19 -1
- package/lib/room-control/whiteboard-control-v2/main-window.d.ts +7 -4
- package/lib/room-control/whiteboard-control-v2/main-window.js +20 -3
- package/lib/room-control/whiteboard-control-v2/whiteboard-control/index.d.ts +38 -0
- package/lib/room-control/whiteboard-control-v2/whiteboard-control/index.js +261 -0
- package/lib/room-control/whiteboard-control-v2/whiteboard-control/type.d.ts +42 -0
- package/lib/room-control/whiteboard-control-v2/whiteboard-control/type.js +5 -0
- package/lib/schema.d.ts +21 -0
- package/lib/schema.js +9 -1
- package/lib/service/api.d.ts +64 -3
- package/lib/service/api.js +88 -3
- package/lib/type.d.ts +7 -0
- package/lib/utilities/package-info.d.ts +2 -0
- package/lib/utilities/package-info.js +6 -2
- package/package.json +7 -7
package/lib/engine/index.js
CHANGED
|
@@ -412,7 +412,7 @@ class FcrCoreEngine {
|
|
|
412
412
|
return parametersList;
|
|
413
413
|
}
|
|
414
414
|
_getRtcPresetParameters() {
|
|
415
|
-
let rtcPresetParameters = ['{\"che.
|
|
415
|
+
let rtcPresetParameters = ['{\"che.video.videoCodecIndex\": 1}', '{\"rtc.video.new_complexity\": true}', '{\"rtc.video.default_complexity\": 1027}', '{\"rtc.video.enable_doc_screen_share_sr\":true}', '{\"rtc.video.enable_pvc\":false}', '{\"che.video.brightness_detection_enable\":false} ', '{\"che.audio.bitrate_level\":1}', '{\"rtc.video.downMaxRetryTimes\":5}'];
|
|
416
416
|
if ((0, _imports.getPlatform)() == _imports.FcrApplicationPlatform.WINDOWS) {
|
|
417
417
|
rtcPresetParameters.push('{\"engine.video.hw_decoder_provider\":\"qsv\"}', '{\"rtc.video.default_hw_decoder_thres\":921600}');
|
|
418
418
|
}
|
|
@@ -66,4 +66,4 @@ class FcrAbilityControlImpl {
|
|
|
66
66
|
}
|
|
67
67
|
exports.FcrAbilityControlImpl = FcrAbilityControlImpl;
|
|
68
68
|
_FcrAbilityControlImpl = FcrAbilityControlImpl;
|
|
69
|
-
[_initProto] = _applyDecs(_FcrAbilityControlImpl, [[_imports.trace, 2, "
|
|
69
|
+
[_initProto] = _applyDecs(_FcrAbilityControlImpl, [[_imports.trace, 2, "isPlatformAbilitySupported"]], []).e;
|
|
@@ -48,6 +48,7 @@ var _ = require("..");
|
|
|
48
48
|
var _logger = require("../utilities/logger");
|
|
49
49
|
var _abilityControl = require("./ability-control");
|
|
50
50
|
var _error2 = require("agora-rte-sdk/lib/core/utilities/error");
|
|
51
|
+
var _sharingControl = require("./sharing-control");
|
|
51
52
|
var _FcrBaseRoomControlImpl;
|
|
52
53
|
let _initProto;
|
|
53
54
|
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; }
|
|
@@ -101,6 +102,9 @@ class FcrBaseRoomControlImpl {
|
|
|
101
102
|
this._privilegeControl = new _privilegeControl.FcrPrivilegeControlImpl(this._engine, this._scene, this._api, this._sharedCache);
|
|
102
103
|
this._roomConnectorControl = new _roomConnectorControl.FcrRoomConnectorControlImpl(this._scene, this._engine, this._api);
|
|
103
104
|
this._abilityControl = new _abilityControl.FcrAbilityControlImpl(this._scene);
|
|
105
|
+
if (this._whiteboardControl && this._streamControl) {
|
|
106
|
+
this.sharingControl = new _sharingControl.FcrSharingControlImpl(this._scene, this._api, this._engine, this._privilegeControl, this._whiteboardControl, this._streamControl, this._sharedCache);
|
|
107
|
+
}
|
|
104
108
|
this._observable.notifyObservers('onJoinRoomSuccess', sceneId);
|
|
105
109
|
},
|
|
106
110
|
// onJoinSceneFailure: (sceneId, error) => {
|
|
@@ -205,19 +209,19 @@ class FcrBaseRoomControlImpl {
|
|
|
205
209
|
};
|
|
206
210
|
}
|
|
207
211
|
// @trace
|
|
212
|
+
getSharingControl() {
|
|
213
|
+
if (!this.sharingControl) {
|
|
214
|
+
throw (0, _error.generateFcrCoreClientError)(_error.FcrErrorModuleCode.ROOM, _error.FcrErrorCode.NOT_JOINED_ROOM, 'sharing control not initialized, please join room first', new Error('sharing control not initialized, please join room first'));
|
|
215
|
+
}
|
|
216
|
+
return this.sharingControl;
|
|
217
|
+
}
|
|
218
|
+
// @trace
|
|
208
219
|
getUserControl() {
|
|
209
220
|
if (!this._userControl) {
|
|
210
221
|
throw (0, _error.generateFcrCoreClientError)(_error.FcrErrorModuleCode.ROOM, _error.FcrErrorCode.NOT_JOINED_ROOM, 'user control not initialized, please join room first', new Error('user control not initialized, please join room first'));
|
|
211
222
|
}
|
|
212
223
|
return this._userControl;
|
|
213
224
|
}
|
|
214
|
-
// @trace
|
|
215
|
-
getBoardControl() {
|
|
216
|
-
if (!this._whiteboardControl) {
|
|
217
|
-
throw (0, _error.generateFcrCoreClientError)(_error.FcrErrorModuleCode.ROOM, _error.FcrErrorCode.NOT_JOINED_ROOM, 'whiteboard control not initialized, please join room first', new Error('whiteboard control not initialized, please join room first'));
|
|
218
|
-
}
|
|
219
|
-
return this._whiteboardControl;
|
|
220
|
-
}
|
|
221
225
|
|
|
222
226
|
// @trace
|
|
223
227
|
getStreamControl() {
|
|
@@ -565,6 +569,6 @@ class FcrBaseRoomControlImpl {
|
|
|
565
569
|
*/
|
|
566
570
|
exports.FcrBaseRoomControlImpl = FcrBaseRoomControlImpl;
|
|
567
571
|
_FcrBaseRoomControlImpl = FcrBaseRoomControlImpl;
|
|
568
|
-
[_initProto] = _applyDecs(_FcrBaseRoomControlImpl, [[_imports.trace, 2, "getSyncTimestamp"], [_imports.trace, 2, "getRoomInfo"], [_imports.trace, 2, "getRoomSchedule"], [_imports.trace, 2, "join"], [_imports.trace, 2, "leave"], [_imports.trace, 2, "start"], [_imports.trace, 2, "end"], [_imports.trace, 2, "close"], [_imports.trace, 2, "getRoomState"], [_imports.trace, 2, "getRoomProperties"], [_imports.trace, 2, "getRoomPropertiesByKeyPath"], [_imports.trace, 2, "updateRoomProperties"], [_imports.trace, 2, "updateIncrementRoomProperties"], [_imports.trace, 2, "deleteRoomProperties"], [_imports.trace, 2, "startCloudRecording"], [_imports.trace, 2, "pauseCloudRecording"], [_imports.trace, 2, "resumeCloudRecording"], [_imports.trace, 2, "stopCloudRecording"], [_imports.trace, 2, "getLiveStreamingState"], [_imports.trace, 2, "getLiveStreamingConfig"], [_imports.trace, 2, "startLiveStreaming"], [_imports.trace, 2, "updateLiveStreamingLayout"], [_imports.trace, 2, "stopLiveStreaming"], [_imports.trace, 2, "getCloudRecordingState"], [_imports.trace, 2, "sendRoomMessage"]
|
|
572
|
+
[_initProto] = _applyDecs(_FcrBaseRoomControlImpl, [[_imports.trace, 2, "getSyncTimestamp"], [_imports.trace, 2, "getRoomInfo"], [_imports.trace, 2, "getRoomSchedule"], [_imports.trace, 2, "join"], [_imports.trace, 2, "leave"], [_imports.trace, 2, "start"], [_imports.trace, 2, "end"], [_imports.trace, 2, "close"], [_imports.trace, 2, "getRoomState"], [_imports.trace, 2, "getRoomProperties"], [_imports.trace, 2, "getRoomPropertiesByKeyPath"], [_imports.trace, 2, "updateRoomProperties"], [_imports.trace, 2, "updateIncrementRoomProperties"], [_imports.trace, 2, "deleteRoomProperties"], [_imports.trace, 2, "startCloudRecording"], [_imports.trace, 2, "pauseCloudRecording"], [_imports.trace, 2, "resumeCloudRecording"], [_imports.trace, 2, "stopCloudRecording"], [_imports.trace, 2, "getLiveStreamingState"], [_imports.trace, 2, "getLiveStreamingConfig"], [_imports.trace, 2, "startLiveStreaming"], [_imports.trace, 2, "updateLiveStreamingLayout"], [_imports.trace, 2, "stopLiveStreaming"], [_imports.trace, 2, "getCloudRecordingState"], [_imports.trace, 2, "sendRoomMessage"]], []).e;
|
|
569
573
|
class FcrSubRoomControlImpl extends FcrBaseRoomControlImpl {}
|
|
570
574
|
exports.FcrSubRoomControlImpl = FcrSubRoomControlImpl;
|
|
@@ -54,6 +54,7 @@ class FcrInterpreterControlImpl {
|
|
|
54
54
|
prefix: 'FcrInterpreterControlImpl'
|
|
55
55
|
})));
|
|
56
56
|
(0, _defineProperty2.default)(this, "_observable", new _imports.AgoraObservable());
|
|
57
|
+
(0, _defineProperty2.default)(this, "_interpreterUserList", null);
|
|
57
58
|
this._api = _api;
|
|
58
59
|
this._scene = _scene;
|
|
59
60
|
this._config = _config;
|
|
@@ -111,7 +112,7 @@ class FcrInterpreterControlImpl {
|
|
|
111
112
|
};
|
|
112
113
|
}) : null;
|
|
113
114
|
}
|
|
114
|
-
|
|
115
|
+
_setInterpreterUserList() {
|
|
115
116
|
const interpreter = this._scene.getScenePropertiesByKeyPath('interpreter');
|
|
116
117
|
const {
|
|
117
118
|
translates
|
|
@@ -131,7 +132,10 @@ class FcrInterpreterControlImpl {
|
|
|
131
132
|
targetLanguage
|
|
132
133
|
};
|
|
133
134
|
});
|
|
134
|
-
|
|
135
|
+
this._interpreterUserList = results.length > 0 ? results : null;
|
|
136
|
+
}
|
|
137
|
+
getInterpreterUserList() {
|
|
138
|
+
return this._interpreterUserList;
|
|
135
139
|
}
|
|
136
140
|
getInterpreterLanguageList() {
|
|
137
141
|
const languages = this._scene.getScenePropertiesByKeyPath('interpreter.languages');
|
|
@@ -157,6 +161,9 @@ class FcrInterpreterControlImpl {
|
|
|
157
161
|
const isUpdated = [
|
|
158
162
|
// FcrInterpreterActionType.OPEN,
|
|
159
163
|
_types.FcrInterpreterActionType.UPDATE].includes(actionType);
|
|
164
|
+
if (isStateUpdated || isUpdated) {
|
|
165
|
+
this._setInterpreterUserList();
|
|
166
|
+
}
|
|
160
167
|
if (isStateUpdated) {
|
|
161
168
|
this._observable.notifyObservers('onInterpreterStateUpdated', this._roomId, this.getState(), operatorUser);
|
|
162
169
|
}
|
|
@@ -165,6 +172,9 @@ class FcrInterpreterControlImpl {
|
|
|
165
172
|
this._observable.notifyObservers('onInterpreterRoomListUpdated', this._roomId, this.getInterpreterRoomList(), operatorUser);
|
|
166
173
|
}
|
|
167
174
|
}
|
|
175
|
+
},
|
|
176
|
+
onJoinSceneSuccess: () => {
|
|
177
|
+
this._setInterpreterUserList();
|
|
168
178
|
}
|
|
169
179
|
});
|
|
170
180
|
}
|
|
@@ -177,4 +187,4 @@ class FcrInterpreterControlImpl {
|
|
|
177
187
|
}
|
|
178
188
|
exports.FcrInterpreterControlImpl = FcrInterpreterControlImpl;
|
|
179
189
|
_FcrInterpreterControlImpl = FcrInterpreterControlImpl;
|
|
180
|
-
[_initProto] = _applyDecs(_FcrInterpreterControlImpl, [[_createRoomControlDecs, 2, "createRoomControl"], [_setInterpreterUsersDecs, 2, "setInterpreterUsers"], [_imports.trace, 2, "close"], [_imports.trace, 2, "getState"], [_imports.trace, 2, "getInterpreterRoomList"], [_imports.trace, 2, "
|
|
190
|
+
[_initProto] = _applyDecs(_FcrInterpreterControlImpl, [[_createRoomControlDecs, 2, "createRoomControl"], [_setInterpreterUsersDecs, 2, "setInterpreterUsers"], [_imports.trace, 2, "close"], [_imports.trace, 2, "getState"], [_imports.trace, 2, "getInterpreterRoomList"], [_imports.trace, 2, "getInterpreterLanguageList"]], []).e;
|
|
@@ -35,9 +35,9 @@ var _type = require("../type");
|
|
|
35
35
|
var _type2 = require("../../type");
|
|
36
36
|
var _error = require("../../utilities/error");
|
|
37
37
|
var _interpreterControl = require("../interpreter-control");
|
|
38
|
+
var _schema = require("../../schema");
|
|
38
39
|
var _logger = require("../../utilities/logger");
|
|
39
40
|
var _validateParams = _interopRequireDefault(require("../../utilities/validate-params"));
|
|
40
|
-
var _schema = require("../../schema");
|
|
41
41
|
var _FcrMainRoomControlImpl;
|
|
42
42
|
let _initProto, _enableWaitingRoomDecs, _moveToWaitingRoomByUserIdsDecs, _ref;
|
|
43
43
|
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)]; } }; }
|
|
@@ -80,6 +80,7 @@ class FcrMainRoomControlImpl extends _.FcrBaseRoomControlImpl {
|
|
|
80
80
|
async join(options) {
|
|
81
81
|
try {
|
|
82
82
|
await super.join(options);
|
|
83
|
+
this._initAnnotationInfo();
|
|
83
84
|
const task = sharedScheduler.addIntervalTask(() => {
|
|
84
85
|
this._engine.getMonitor().uploadLog({
|
|
85
86
|
userUuid: this._config.userId,
|
|
@@ -132,6 +133,20 @@ class FcrMainRoomControlImpl extends _.FcrBaseRoomControlImpl {
|
|
|
132
133
|
async moveToWaitingRoomByUserRoles() {
|
|
133
134
|
return this._api.moveToWaitingRoomByUserRoles([_type2.FcrUserRoleToStringMap[_2.FcrUserRole.PARTICIPANT]], this._scene.sceneId);
|
|
134
135
|
}
|
|
136
|
+
async _initAnnotationInfo() {
|
|
137
|
+
const roomId = this._scene.sceneId;
|
|
138
|
+
const userId = this._scene.localUser.getLocalUserId();
|
|
139
|
+
const boardOptions = (await this._getToken(roomId, userId)).data;
|
|
140
|
+
if (localStorage) {
|
|
141
|
+
localStorage.setItem('board_options', JSON.stringify(boardOptions));
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
async _getToken(roomId, userId) {
|
|
145
|
+
return await (0, _error.handleRequestError)(() => this._api.getAnnotationToken({
|
|
146
|
+
roomId,
|
|
147
|
+
userId
|
|
148
|
+
}), _error.FcrErrorModuleCode.ROOM_WHITEBOARD, 'get whiteboard token failed');
|
|
149
|
+
}
|
|
135
150
|
_addLogObserver() {
|
|
136
151
|
this.addObserver((0, _logger.generateLogObserver)(this.logger, ['onCloudRecordingStateUpdated', 'onJoinRoomFailure', 'onJoinRoomSuccess', 'onLiveStreamingStateUpdated',
|
|
137
152
|
// 'onNetworkQualityUpdated',
|
|
@@ -141,4 +156,4 @@ class FcrMainRoomControlImpl extends _.FcrBaseRoomControlImpl {
|
|
|
141
156
|
}
|
|
142
157
|
exports.FcrMainRoomControlImpl = FcrMainRoomControlImpl;
|
|
143
158
|
_FcrMainRoomControlImpl = FcrMainRoomControlImpl;
|
|
144
|
-
[_initProto] = _applyDecs(_FcrMainRoomControlImpl, [[_imports.trace, 2, "join"], [_imports.trace, 2, "leave"], [_enableWaitingRoomDecs, 2, "enableWaitingRoom"], [_moveToWaitingRoomByUserIdsDecs, 2, "moveToWaitingRoomByUserIds"], [_imports.trace, 2, "moveToWaitingRoomByUserRoles"]], [], 0, void 0, _.FcrBaseRoomControlImpl).e;
|
|
159
|
+
[_initProto] = _applyDecs(_FcrMainRoomControlImpl, [[_imports.trace, 2, "join"], [_imports.trace, 2, "leave"], [_enableWaitingRoomDecs, 2, "enableWaitingRoom"], [_moveToWaitingRoomByUserIdsDecs, 2, "moveToWaitingRoomByUserIds"], [_imports.trace, 2, "moveToWaitingRoomByUserRoles"], [_imports.bound, 2, "_getToken"]], [], 0, void 0, _.FcrBaseRoomControlImpl).e;
|
|
@@ -3,7 +3,9 @@
|
|
|
3
3
|
require("core-js/modules/es.symbol.description.js");
|
|
4
4
|
require("core-js/modules/es.error.cause.js");
|
|
5
5
|
require("core-js/modules/es.array.push.js");
|
|
6
|
+
require("core-js/modules/esnext.async-iterator.filter.js");
|
|
6
7
|
require("core-js/modules/esnext.function.metadata.js");
|
|
8
|
+
require("core-js/modules/esnext.iterator.filter.js");
|
|
7
9
|
require("core-js/modules/esnext.map.delete-all.js");
|
|
8
10
|
require("core-js/modules/esnext.map.emplace.js");
|
|
9
11
|
require("core-js/modules/esnext.map.every.js");
|
|
@@ -41,13 +43,15 @@ var _error = require("../../utilities/error");
|
|
|
41
43
|
var _validateParams = _interopRequireDefault(require("../../utilities/validate-params"));
|
|
42
44
|
var _schema = require("../../schema");
|
|
43
45
|
var _FcrPrivilegeControlImpl;
|
|
44
|
-
let _initProto, _getSecurityInfoDecs, _getLocalUserPermissionInfoDecs, _enableLockedRoomDecs,
|
|
46
|
+
let _initProto, _getSecurityInfoDecs, _getLocalUserPermissionInfoDecs, _enableLockedRoomDecs, _allowShareAndWriteDecs, _allowWriteBoardDecs, _allowSendChatDecs, _allowStartAudioDecs, _allowStartVideoDecs, _allowJoinWithMutedAudioDecs, _allowJoinWithMutedVideoDecs, _allowWatermarkDecs, _allowChangeUserNameDecs, _ref;
|
|
47
|
+
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; }
|
|
48
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
45
49
|
function _applyDecs(e, t, r, n, o, a) { function i(e, t, r) { return function (n, o) { return r && r(n), e[t].call(n, o); }; } function c(e, t) { for (var r = 0; r < e.length; r++) e[r].call(t); return t; } function s(e, t, r, n) { if ("function" != typeof e && (n || void 0 !== e)) throw new TypeError(t + " must " + (r || "be") + " a function" + (n ? "" : " or undefined")); return e; } function applyDec(e, t, r, n, o, a, c, u, l, f, p, d, h) { function m(e) { if (!h(e)) throw new TypeError("Attempted to access private element on non-instance"); } var y, v = t[0], g = t[3], b = !u; if (!b) { r || Array.isArray(v) || (v = [v]); var w = {}, S = [], A = 3 === o ? "get" : 4 === o || d ? "set" : "value"; f ? (p || d ? w = { get: _setFunctionName(function () { return g(this); }, n, "get"), set: function (e) { t[4](this, e); } } : w[A] = g, p || _setFunctionName(w[A], n, 2 === o ? "" : A)) : p || (w = Object.getOwnPropertyDescriptor(e, n)); } for (var P = e, j = v.length - 1; j >= 0; j -= r ? 2 : 1) { var D = v[j], E = r ? v[j - 1] : void 0, I = {}, O = { kind: ["field", "accessor", "method", "getter", "setter", "class"][o], name: n, metadata: a, addInitializer: function (e, t) { if (e.v) throw Error("attempted to call addInitializer after decoration was finished"); s(t, "An initializer", "be", !0), c.push(t); }.bind(null, I) }; try { if (b) (y = s(D.call(E, P, O), "class decorators", "return")) && (P = y);else { var k, F; O.static = l, O.private = f, f ? 2 === o ? k = function (e) { return m(e), w.value; } : (o < 4 && (k = i(w, "get", m)), 3 !== o && (F = i(w, "set", m))) : (k = function (e) { return e[n]; }, (o < 2 || 4 === o) && (F = function (e, t) { e[n] = t; })); var N = O.access = { has: f ? h.bind() : function (e) { return n in e; } }; if (k && (N.get = k), F && (N.set = F), P = D.call(E, d ? { get: w.get, set: w.set } : w[A], O), d) { if ("object" == typeof P && P) (y = s(P.get, "accessor.get")) && (w.get = y), (y = s(P.set, "accessor.set")) && (w.set = y), (y = s(P.init, "accessor.init")) && S.push(y);else if (void 0 !== P) throw new TypeError("accessor decorators must return an object with get, set, or init properties or void 0"); } else s(P, (p ? "field" : "method") + " decorators", "return") && (p ? S.push(P) : w[A] = P); } } finally { I.v = !0; } } return (p || d) && u.push(function (e, t) { for (var r = S.length - 1; r >= 0; r--) t = S[r].call(e, t); return t; }), p || b || (f ? d ? u.push(i(w, "get"), i(w, "set")) : u.push(2 === o ? w[A] : i.call.bind(w[A])) : Object.defineProperty(e, n, w)), P; } function u(e, t) { return Object.defineProperty(e, Symbol.metadata || Symbol.for("Symbol.metadata"), { configurable: !0, enumerable: !0, value: t }); } if (arguments.length >= 6) var l = a[Symbol.metadata || Symbol.for("Symbol.metadata")]; var f = Object.create(null == l ? null : l), p = function (e, t, r, n) { var o, a, i = [], s = function (t) { return _checkInRHS(t) === e; }, u = new Map(); function l(e) { e && i.push(c.bind(null, e)); } for (var f = 0; f < t.length; f++) { var p = t[f]; if (Array.isArray(p)) { var d = p[1], h = p[2], m = p.length > 3, y = 16 & d, v = !!(8 & d), g = 0 == (d &= 7), b = h + "/" + v; if (!g && !m) { var w = u.get(b); if (!0 === w || 3 === w && 4 !== d || 4 === w && 3 !== d) throw Error("Attempted to decorate a public method/accessor that has the same name as a previously decorated public method/accessor. This is not currently supported by the decorators plugin. Property name was: " + h); u.set(b, !(d > 2) || d); } applyDec(v ? e : e.prototype, p, y, m ? "#" + h : _toPropertyKey(h), d, n, v ? a = a || [] : o = o || [], i, v, m, g, 1 === d, v && m ? s : r); } } return l(o), l(a), i; }(e, t, o, f); return r.length || u(e, f), { e: p, get c() { var t = []; return r.length && [u(applyDec(e, [r], n, e.name, 5, f, t), f), c.bind(null, t, e)]; } }; }
|
|
46
50
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
47
51
|
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); }
|
|
48
52
|
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; }
|
|
49
53
|
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; }
|
|
50
|
-
_ref = (_getSecurityInfoDecs = [_imports.trace, (0, _validateParams.default)(_schema.fcrSecurityActionSchema)], _getLocalUserPermissionInfoDecs = [_imports.trace, (0, _validateParams.default)(_schema.fcrPermissionActionSchema)], _enableLockedRoomDecs = [_imports.trace, (0, _validateParams.default)(_schema.booleanSchema, _schema.fcrPrivilegeUserRoleArraySchema)],
|
|
54
|
+
_ref = (_getSecurityInfoDecs = [_imports.trace, (0, _validateParams.default)(_schema.fcrSecurityActionSchema)], _getLocalUserPermissionInfoDecs = [_imports.trace, (0, _validateParams.default)(_schema.fcrPermissionActionSchema)], _enableLockedRoomDecs = [_imports.trace, (0, _validateParams.default)(_schema.booleanSchema, _schema.fcrPrivilegeUserRoleArraySchema)], _allowShareAndWriteDecs = [_imports.trace, (0, _validateParams.default)(_schema.booleanSchema, _schema.fcrPrivilegeUserRoleArraySchema)], _allowWriteBoardDecs = [_imports.trace, (0, _validateParams.default)(_schema.booleanSchema, _schema.fcrPrivilegeUserRoleArraySchema)], _allowSendChatDecs = [_imports.trace, (0, _validateParams.default)(_schema.booleanSchema, _schema.fcrPrivilegeUserRoleArraySchema, _schema.fcrSecuritySendChatPayloadSchema)], _allowStartAudioDecs = [_imports.trace, (0, _validateParams.default)(_schema.booleanSchema, _schema.fcrPrivilegeUserRoleArraySchema)], _allowStartVideoDecs = [_imports.trace, (0, _validateParams.default)(_schema.booleanSchema, _schema.fcrPrivilegeUserRoleArraySchema)], _allowJoinWithMutedAudioDecs = [_imports.trace, (0, _validateParams.default)(_schema.booleanSchema, _schema.fcrPrivilegeUserRoleArraySchema)], _allowJoinWithMutedVideoDecs = [_imports.trace, (0, _validateParams.default)(_schema.booleanSchema, _schema.fcrPrivilegeUserRoleArraySchema)], _allowWatermarkDecs = [_imports.trace, (0, _validateParams.default)(_schema.booleanSchema, _schema.fcrPrivilegeUserRoleArraySchema, _schema.fcrLineTypeSchema.optional())], _allowChangeUserNameDecs = [_imports.trace, (0, _validateParams.default)(_schema.booleanSchema, _schema.fcrPrivilegeUserRoleArraySchema)], "logger");
|
|
51
55
|
/**
|
|
52
56
|
* @internal
|
|
53
57
|
*/
|
|
@@ -66,6 +70,16 @@ class FcrPrivilegeControlImpl {
|
|
|
66
70
|
this._addLogObserver();
|
|
67
71
|
this._addSceneObserver();
|
|
68
72
|
}
|
|
73
|
+
async allowWriteAnnotation(enable, targetRoles) {
|
|
74
|
+
await (0, _error.handleRequestError)(() => this._api.toggleAnnotation({
|
|
75
|
+
roomId: this._scene.sceneId,
|
|
76
|
+
enable,
|
|
77
|
+
targetRoles: targetRoles.map(role => _type2.FcrPrivilegeUserRoleToStringMap[role]),
|
|
78
|
+
payload: {
|
|
79
|
+
write: enable ? 1 : 0
|
|
80
|
+
}
|
|
81
|
+
}), _error.FcrErrorModuleCode.ROOM_WHITEBOARD, 'allow annotation failed');
|
|
82
|
+
}
|
|
69
83
|
getSecurityInfo(action) {
|
|
70
84
|
const info = this._scene.getScenePropertiesByKeyPath("security.".concat(action));
|
|
71
85
|
return this._convertSecurityInfo(info, action);
|
|
@@ -105,7 +119,7 @@ class FcrPrivilegeControlImpl {
|
|
|
105
119
|
targetRoles
|
|
106
120
|
}), _error.FcrErrorModuleCode.ROOM_PRIVILEGE, 'enable locked room failed');
|
|
107
121
|
}
|
|
108
|
-
async
|
|
122
|
+
async allowShareAndWrite(enable, targetRoles) {
|
|
109
123
|
await (0, _error.handleRequestError)(() => this._api.toggleShareEnable({
|
|
110
124
|
roomId: this._scene.sceneId,
|
|
111
125
|
enable: true,
|
|
@@ -114,6 +128,9 @@ class FcrPrivilegeControlImpl {
|
|
|
114
128
|
screen: enable ? 1 : 0,
|
|
115
129
|
board: {
|
|
116
130
|
start: enable ? 1 : 0
|
|
131
|
+
},
|
|
132
|
+
annotation: {
|
|
133
|
+
start: enable ? 1 : 0
|
|
117
134
|
}
|
|
118
135
|
}
|
|
119
136
|
}), _error.FcrErrorModuleCode.ROOM_PRIVILEGE, 'allow share failed');
|
|
@@ -127,6 +144,9 @@ class FcrPrivilegeControlImpl {
|
|
|
127
144
|
// screen: 1,
|
|
128
145
|
board: {
|
|
129
146
|
write: enable ? 1 : 0
|
|
147
|
+
},
|
|
148
|
+
annotation: {
|
|
149
|
+
write: enable ? 1 : 0
|
|
130
150
|
}
|
|
131
151
|
}
|
|
132
152
|
}), _error.FcrErrorModuleCode.ROOM_PRIVILEGE, 'allow write board failed');
|
|
@@ -210,6 +230,14 @@ class FcrPrivilegeControlImpl {
|
|
|
210
230
|
targetRoles,
|
|
211
231
|
payload
|
|
212
232
|
} = security;
|
|
233
|
+
if (action === _type2.FcrSecurityAction.Annotation) {
|
|
234
|
+
return _objectSpread({
|
|
235
|
+
info: {
|
|
236
|
+
action: action,
|
|
237
|
+
payload
|
|
238
|
+
}
|
|
239
|
+
}, security);
|
|
240
|
+
}
|
|
213
241
|
return {
|
|
214
242
|
enable: !!security.enable,
|
|
215
243
|
info: {
|
|
@@ -270,4 +298,4 @@ class FcrPrivilegeControlImpl {
|
|
|
270
298
|
}
|
|
271
299
|
exports.FcrPrivilegeControlImpl = FcrPrivilegeControlImpl;
|
|
272
300
|
_FcrPrivilegeControlImpl = FcrPrivilegeControlImpl;
|
|
273
|
-
[_initProto] = _applyDecs(_FcrPrivilegeControlImpl, [[_getSecurityInfoDecs, 2, "getSecurityInfo"], [_getLocalUserPermissionInfoDecs, 2, "getLocalUserPermissionInfo"], [_enableLockedRoomDecs, 2, "enableLockedRoom"], [
|
|
301
|
+
[_initProto] = _applyDecs(_FcrPrivilegeControlImpl, [[_imports.trace, 2, "allowWriteAnnotation"], [_getSecurityInfoDecs, 2, "getSecurityInfo"], [_getLocalUserPermissionInfoDecs, 2, "getLocalUserPermissionInfo"], [_enableLockedRoomDecs, 2, "enableLockedRoom"], [_allowShareAndWriteDecs, 2, "allowShareAndWrite"], [_allowWriteBoardDecs, 2, "allowWriteBoard"], [_allowSendChatDecs, 2, "allowSendChat"], [_allowStartAudioDecs, 2, "allowStartAudio"], [_allowStartVideoDecs, 2, "allowStartVideo"], [_allowJoinWithMutedAudioDecs, 2, "allowJoinWithMutedAudio"], [_allowJoinWithMutedVideoDecs, 2, "allowJoinWithMutedVideo"], [_allowWatermarkDecs, 2, "allowWatermark"], [_allowChangeUserNameDecs, 2, "allowChangeUserName"]], []).e;
|
|
@@ -31,7 +31,7 @@ export interface FcrPrivilegeControl {
|
|
|
31
31
|
* @param enable
|
|
32
32
|
* @param targetRoles
|
|
33
33
|
*/
|
|
34
|
-
|
|
34
|
+
allowShareAndWrite(enable: boolean, targetRoles: FcrPrivilegeUserRole[]): Promise<void>;
|
|
35
35
|
/**
|
|
36
36
|
* Enables or disables whiteboard write privilege.
|
|
37
37
|
* @param enable
|
|
@@ -81,6 +81,12 @@ export interface FcrPrivilegeControl {
|
|
|
81
81
|
* @param targetRoles
|
|
82
82
|
*/
|
|
83
83
|
allowChangeUserName(enable: boolean, targetRoles: FcrPrivilegeUserRole[]): Promise<void>;
|
|
84
|
+
/**
|
|
85
|
+
* Enables or disables write annotation.
|
|
86
|
+
* @param enable
|
|
87
|
+
* @param targetRoles
|
|
88
|
+
*/
|
|
89
|
+
allowWriteAnnotation(enable: boolean, targetRoles: FcrPrivilegeUserRole[]): Promise<void>;
|
|
84
90
|
/**
|
|
85
91
|
* Adds an observer.
|
|
86
92
|
* @param observer
|
|
@@ -106,6 +112,7 @@ export type FcrSecurity = {
|
|
|
106
112
|
export type FcrSecurityInfo = {
|
|
107
113
|
enable: boolean;
|
|
108
114
|
info?: FcrSecurity;
|
|
115
|
+
payload?: Record<string, unknown>;
|
|
109
116
|
};
|
|
110
117
|
export type FcrSecuritySendChatPayload = FcrSecuritySendChatPayloadSchema;
|
|
111
118
|
export type FcrSecuritySharePayload = {
|
|
@@ -252,7 +259,9 @@ export declare enum FcrPermissionAction {
|
|
|
252
259
|
BoardAllowWrite = "board:allowWrite",
|
|
253
260
|
BoardDisallowWrite = "board:disallowWrite",
|
|
254
261
|
InterpreterStart = "interpreter:start",
|
|
255
|
-
InterpreterStop = "interpreter:stop"
|
|
262
|
+
InterpreterStop = "interpreter:stop",
|
|
263
|
+
AnnotationWrite = "annotation:write",
|
|
264
|
+
AnnotationAllowWrite = "annotation:allowWrite"
|
|
256
265
|
}
|
|
257
266
|
export type FcrPermission = {
|
|
258
267
|
action: FcrPermissionAction;
|
|
@@ -288,7 +297,8 @@ export declare enum FcrSecurityAction {
|
|
|
288
297
|
ShareBoard = "shareBoard",
|
|
289
298
|
BoardAllowWrite = "boardAllowWrite",
|
|
290
299
|
Sharing = "sharing",
|
|
291
|
-
WaterMark = "watermark"
|
|
300
|
+
WaterMark = "watermark",
|
|
301
|
+
Annotation = "annotation"
|
|
292
302
|
}
|
|
293
303
|
export declare enum FcrWatermarkPermissionState {
|
|
294
304
|
ON = 1,
|
|
@@ -105,6 +105,8 @@ let FcrPermissionAction = exports.FcrPermissionAction = /*#__PURE__*/function (F
|
|
|
105
105
|
FcrPermissionAction["BoardDisallowWrite"] = "board:disallowWrite";
|
|
106
106
|
FcrPermissionAction["InterpreterStart"] = "interpreter:start";
|
|
107
107
|
FcrPermissionAction["InterpreterStop"] = "interpreter:stop";
|
|
108
|
+
FcrPermissionAction["AnnotationWrite"] = "annotation:write";
|
|
109
|
+
FcrPermissionAction["AnnotationAllowWrite"] = "annotation:allowWrite";
|
|
108
110
|
return FcrPermissionAction;
|
|
109
111
|
}({});
|
|
110
112
|
let FcrOperatePermissionType = exports.FcrOperatePermissionType = /*#__PURE__*/function (FcrOperatePermissionType) {
|
|
@@ -135,6 +137,7 @@ let FcrSecurityAction = exports.FcrSecurityAction = /*#__PURE__*/function (FcrSe
|
|
|
135
137
|
FcrSecurityAction["BoardAllowWrite"] = "boardAllowWrite";
|
|
136
138
|
FcrSecurityAction["Sharing"] = "sharing";
|
|
137
139
|
FcrSecurityAction["WaterMark"] = "watermark";
|
|
140
|
+
FcrSecurityAction["Annotation"] = "annotation";
|
|
138
141
|
return FcrSecurityAction;
|
|
139
142
|
}({});
|
|
140
143
|
let FcrWatermarkPermissionState = exports.FcrWatermarkPermissionState = /*#__PURE__*/function (FcrWatermarkPermissionState) {
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { AgoraRteEngine, AgoraRteScene } from 'agora-rte-sdk';
|
|
2
|
+
import { FcrCoreServiceApi } from '../../service/api';
|
|
3
|
+
import { FcrScreenStreamCreateConfig, FcrSize, FcrStreamControl } from '../stream-control/type';
|
|
4
|
+
import { FcrAnnotationControl } from '../whiteboard-control-v2/annotation-control/type';
|
|
5
|
+
import { FcrScreenSharingState, FcrSharingControl, FcrSharingObserver, FcrWhiteboardState } from './type';
|
|
6
|
+
import { FcrPrivilegeControl } from '../privilege-control/type';
|
|
7
|
+
import { FcrWhiteboardControl } from '../whiteboard-control-v2/whiteboard-control/type';
|
|
8
|
+
import { FcrSharedCache } from '../shared-cache';
|
|
9
|
+
export declare class FcrSharingControlImpl implements FcrSharingControl {
|
|
10
|
+
private _scene;
|
|
11
|
+
private _api;
|
|
12
|
+
private _engine;
|
|
13
|
+
private _privilegeControl;
|
|
14
|
+
private _whiteboardControl;
|
|
15
|
+
private _streamControl;
|
|
16
|
+
private _sharedCache;
|
|
17
|
+
protected logger: import("agora-foundation/lib/logger").Logger;
|
|
18
|
+
private _annotationControl?;
|
|
19
|
+
private _observable;
|
|
20
|
+
private _shareOwnerId;
|
|
21
|
+
private _streamObserver;
|
|
22
|
+
private _sceneObserver;
|
|
23
|
+
private _whiteboardObserver;
|
|
24
|
+
constructor(_scene: AgoraRteScene, _api: FcrCoreServiceApi, _engine: AgoraRteEngine, _privilegeControl: FcrPrivilegeControl, _whiteboardControl: FcrWhiteboardControl, _streamControl: FcrStreamControl, _sharedCache: FcrSharedCache);
|
|
25
|
+
get ownerId(): string;
|
|
26
|
+
startScreenSharing(config: FcrScreenStreamCreateConfig, size?: FcrSize): Promise<string>;
|
|
27
|
+
startWhiteboard(): Promise<void>;
|
|
28
|
+
updateScreenSharing(enableAnnotation: boolean): Promise<void>;
|
|
29
|
+
stop(): Promise<void>;
|
|
30
|
+
getScreenSharingState(): FcrScreenSharingState;
|
|
31
|
+
getWhiteboardState(): FcrWhiteboardState;
|
|
32
|
+
getAnnotationControl(): FcrAnnotationControl | undefined;
|
|
33
|
+
getBoardControl(): FcrWhiteboardControl;
|
|
34
|
+
addObserver(observer: FcrSharingObserver): void;
|
|
35
|
+
removeObserver(observer: FcrSharingObserver): void;
|
|
36
|
+
release(): void;
|
|
37
|
+
private _getPureSceneAnnotationState;
|
|
38
|
+
private _isStreamToHandleScreenSharing;
|
|
39
|
+
private _handleOnStreamsAdded;
|
|
40
|
+
private _handleOnStreamsRemoved;
|
|
41
|
+
private _handleOnScenePropertiesUpdated;
|
|
42
|
+
private _handleOnWhiteboardActive;
|
|
43
|
+
private _handleOnWhiteboardInActive;
|
|
44
|
+
}
|
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
require("core-js/modules/es.symbol.description.js");
|
|
4
|
+
require("core-js/modules/es.array.push.js");
|
|
5
|
+
require("core-js/modules/esnext.function.metadata.js");
|
|
6
|
+
require("core-js/modules/esnext.map.delete-all.js");
|
|
7
|
+
require("core-js/modules/esnext.map.emplace.js");
|
|
8
|
+
require("core-js/modules/esnext.map.every.js");
|
|
9
|
+
require("core-js/modules/esnext.map.filter.js");
|
|
10
|
+
require("core-js/modules/esnext.map.find.js");
|
|
11
|
+
require("core-js/modules/esnext.map.find-key.js");
|
|
12
|
+
require("core-js/modules/esnext.map.includes.js");
|
|
13
|
+
require("core-js/modules/esnext.map.key-of.js");
|
|
14
|
+
require("core-js/modules/esnext.map.map-keys.js");
|
|
15
|
+
require("core-js/modules/esnext.map.map-values.js");
|
|
16
|
+
require("core-js/modules/esnext.map.merge.js");
|
|
17
|
+
require("core-js/modules/esnext.map.reduce.js");
|
|
18
|
+
require("core-js/modules/esnext.map.some.js");
|
|
19
|
+
require("core-js/modules/esnext.map.update.js");
|
|
20
|
+
require("core-js/modules/esnext.symbol.metadata.js");
|
|
21
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
22
|
+
Object.defineProperty(exports, "__esModule", {
|
|
23
|
+
value: true
|
|
24
|
+
});
|
|
25
|
+
exports.FcrSharingControlImpl = void 0;
|
|
26
|
+
require("core-js/modules/es.error.cause.js");
|
|
27
|
+
require("core-js/modules/esnext.async-iterator.filter.js");
|
|
28
|
+
require("core-js/modules/esnext.async-iterator.for-each.js");
|
|
29
|
+
require("core-js/modules/esnext.iterator.constructor.js");
|
|
30
|
+
require("core-js/modules/esnext.iterator.filter.js");
|
|
31
|
+
require("core-js/modules/esnext.iterator.for-each.js");
|
|
32
|
+
require("core-js/modules/web.dom-collections.iterator.js");
|
|
33
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
34
|
+
var _annotationControl = require("../whiteboard-control-v2/annotation-control");
|
|
35
|
+
var _type = require("./type");
|
|
36
|
+
var _imports = require("../../imports");
|
|
37
|
+
var _ = require("../..");
|
|
38
|
+
var _enums = require("../whiteboard-control/enums");
|
|
39
|
+
var _error = require("../../utilities/error");
|
|
40
|
+
var _logger = require("../../utilities/logger");
|
|
41
|
+
var _FcrSharingControlImpl;
|
|
42
|
+
let _initProto;
|
|
43
|
+
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)]; } }; }
|
|
44
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
45
|
+
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); }
|
|
46
|
+
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; }
|
|
47
|
+
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; }
|
|
48
|
+
class FcrSharingControlImpl {
|
|
49
|
+
constructor(_scene, _api, _engine, _privilegeControl, _whiteboardControl, _streamControl, _sharedCache) {
|
|
50
|
+
(0, _defineProperty2.default)(this, "logger", (_initProto(this), (0, _logger.createLogger)({
|
|
51
|
+
prefix: 'FcrSharingControlImpl'
|
|
52
|
+
})));
|
|
53
|
+
(0, _defineProperty2.default)(this, "_observable", new _imports.AgoraObservable());
|
|
54
|
+
(0, _defineProperty2.default)(this, "_shareOwnerId", '');
|
|
55
|
+
(0, _defineProperty2.default)(this, "_streamObserver", {
|
|
56
|
+
onStreamsAdded: this._handleOnStreamsAdded.bind(this),
|
|
57
|
+
onStreamsRemoved: this._handleOnStreamsRemoved.bind(this)
|
|
58
|
+
});
|
|
59
|
+
(0, _defineProperty2.default)(this, "_sceneObserver", {
|
|
60
|
+
onScenePropertiesUpdated: this._handleOnScenePropertiesUpdated.bind(this)
|
|
61
|
+
});
|
|
62
|
+
(0, _defineProperty2.default)(this, "_whiteboardObserver", {
|
|
63
|
+
onActive: this._handleOnWhiteboardActive.bind(this),
|
|
64
|
+
onInactive: this._handleOnWhiteboardInActive.bind(this)
|
|
65
|
+
});
|
|
66
|
+
this._scene = _scene;
|
|
67
|
+
this._api = _api;
|
|
68
|
+
this._engine = _engine;
|
|
69
|
+
this._privilegeControl = _privilegeControl;
|
|
70
|
+
this._whiteboardControl = _whiteboardControl;
|
|
71
|
+
this._streamControl = _streamControl;
|
|
72
|
+
this._sharedCache = _sharedCache;
|
|
73
|
+
this._streamControl.addObserver(this._streamObserver);
|
|
74
|
+
this._whiteboardControl.addObserver(this._whiteboardObserver);
|
|
75
|
+
this._scene.addObserver(this._sceneObserver);
|
|
76
|
+
}
|
|
77
|
+
get ownerId() {
|
|
78
|
+
return this._shareOwnerId;
|
|
79
|
+
}
|
|
80
|
+
async startScreenSharing(config, size) {
|
|
81
|
+
try {
|
|
82
|
+
const streamId = await this._streamControl.addLocalScreenStream(config, size);
|
|
83
|
+
return streamId;
|
|
84
|
+
} catch (error) {
|
|
85
|
+
throw error;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
startWhiteboard() {
|
|
89
|
+
return this._whiteboardControl.active();
|
|
90
|
+
}
|
|
91
|
+
updateScreenSharing(enableAnnotation) {
|
|
92
|
+
const currentShareState = this.getScreenSharingState();
|
|
93
|
+
if (currentShareState === _type.FcrScreenSharingState.START_ONLY_SCREEN) {
|
|
94
|
+
if (enableAnnotation) {
|
|
95
|
+
return this._api.toggleAnnotationActivityState(this._scene.sceneId, _enums.FcrSharePermissionState.ON);
|
|
96
|
+
} else {
|
|
97
|
+
return this._api.toggleAnnotationActivityState(this._scene.sceneId, _enums.FcrSharePermissionState.OFF);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
return Promise.resolve();
|
|
101
|
+
}
|
|
102
|
+
stop() {
|
|
103
|
+
const currentScreenSharingState = this.getScreenSharingState();
|
|
104
|
+
if (currentScreenSharingState !== _type.FcrScreenSharingState.END) {
|
|
105
|
+
return this._streamControl.removeScreenStream();
|
|
106
|
+
}
|
|
107
|
+
const currentWhiteboardState = this.getWhiteboardState();
|
|
108
|
+
if (currentWhiteboardState === _type.FcrWhiteboardState.START) {
|
|
109
|
+
return this._whiteboardControl.inactive();
|
|
110
|
+
}
|
|
111
|
+
return Promise.resolve();
|
|
112
|
+
}
|
|
113
|
+
getScreenSharingState() {
|
|
114
|
+
const streams = this._streamControl.getStreamList();
|
|
115
|
+
const screenSharingInfos = streams.filter(streamInfo => this._isStreamToHandleScreenSharing(streamInfo));
|
|
116
|
+
if (screenSharingInfos.length === 0) {
|
|
117
|
+
return _type.FcrScreenSharingState.END;
|
|
118
|
+
} else {
|
|
119
|
+
const annotationState = this._getPureSceneAnnotationState();
|
|
120
|
+
return annotationState === 0 ? _type.FcrScreenSharingState.START_ONLY_SCREEN : _type.FcrScreenSharingState.START_WHIT_ANNOTATION;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
getWhiteboardState() {
|
|
124
|
+
const isActive = this._whiteboardControl.getActivity();
|
|
125
|
+
return isActive ? _type.FcrWhiteboardState.START : _type.FcrWhiteboardState.END;
|
|
126
|
+
}
|
|
127
|
+
getAnnotationControl() {
|
|
128
|
+
const currentAnnotationState = this.getScreenSharingState();
|
|
129
|
+
if (currentAnnotationState === _type.FcrScreenSharingState.START_WHIT_ANNOTATION && !this._annotationControl) {
|
|
130
|
+
this._annotationControl = new _annotationControl.FcrAnnotationControlImpl(this._scene, this._api, this._engine, this._privilegeControl, this._sharedCache);
|
|
131
|
+
}
|
|
132
|
+
return this._annotationControl;
|
|
133
|
+
}
|
|
134
|
+
getBoardControl() {
|
|
135
|
+
if (!this._whiteboardControl) {
|
|
136
|
+
throw (0, _error.generateFcrCoreClientError)(_error.FcrErrorModuleCode.ROOM, _error.FcrErrorCode.NOT_JOINED_ROOM, 'whiteboard control not initialized, please join room first', new Error('whiteboard control not initialized, please join room first'));
|
|
137
|
+
}
|
|
138
|
+
return this._whiteboardControl;
|
|
139
|
+
}
|
|
140
|
+
addObserver(observer) {
|
|
141
|
+
this._observable.addObserver(observer);
|
|
142
|
+
}
|
|
143
|
+
removeObserver(observer) {
|
|
144
|
+
this._observable.removeObserver(observer);
|
|
145
|
+
}
|
|
146
|
+
release() {
|
|
147
|
+
this._scene.removeObserver(this._sceneObserver);
|
|
148
|
+
this._streamControl.removeObserver(this._streamObserver);
|
|
149
|
+
this._whiteboardControl.removeObserver(this._whiteboardObserver);
|
|
150
|
+
}
|
|
151
|
+
_getPureSceneAnnotationState() {
|
|
152
|
+
return this._scene.getScenePropertiesByKeyPath('widgets.annotation.state');
|
|
153
|
+
}
|
|
154
|
+
_isStreamToHandleScreenSharing(stream) {
|
|
155
|
+
return stream.videoSourceType === _.FcrVideoSourceType.SCREEN && (stream.streamType === _imports.AgoraRteMediaStreamType.BOTH || stream.streamType === _imports.AgoraRteMediaStreamType.VIDEO);
|
|
156
|
+
}
|
|
157
|
+
_handleOnStreamsAdded(roomId, events) {
|
|
158
|
+
events.forEach(event => {
|
|
159
|
+
const {
|
|
160
|
+
modifiedStream
|
|
161
|
+
} = event;
|
|
162
|
+
if (this._isStreamToHandleScreenSharing(modifiedStream)) {
|
|
163
|
+
this._shareOwnerId = modifiedStream.owner.userId;
|
|
164
|
+
const annotationState = this._getPureSceneAnnotationState();
|
|
165
|
+
if (annotationState === 0) {
|
|
166
|
+
this._observable.notifyObservers('onScreenSharingUpdated', modifiedStream.owner.userId, _type.FcrScreenSharingState.START_ONLY_SCREEN);
|
|
167
|
+
} else {
|
|
168
|
+
this._observable.notifyObservers('onScreenSharingUpdated', modifiedStream.owner.userId, _type.FcrScreenSharingState.START_WHIT_ANNOTATION);
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
});
|
|
172
|
+
}
|
|
173
|
+
_handleOnStreamsRemoved(roomId, events) {
|
|
174
|
+
events.forEach(event => {
|
|
175
|
+
const {
|
|
176
|
+
modifiedStream
|
|
177
|
+
} = event;
|
|
178
|
+
if (this._isStreamToHandleScreenSharing(modifiedStream)) {
|
|
179
|
+
this._observable.notifyObservers('onScreenSharingUpdated', modifiedStream.owner.userId, _type.FcrScreenSharingState.END);
|
|
180
|
+
}
|
|
181
|
+
});
|
|
182
|
+
}
|
|
183
|
+
_handleOnScenePropertiesUpdated(sceneId, event) {
|
|
184
|
+
const {
|
|
185
|
+
cause
|
|
186
|
+
} = event;
|
|
187
|
+
const causeData = cause === null || cause === void 0 ? void 0 : cause.data;
|
|
188
|
+
const currentScreenSharingState = this.getScreenSharingState();
|
|
189
|
+
const causeCmd = cause === null || cause === void 0 ? void 0 : cause.cmd;
|
|
190
|
+
if (currentScreenSharingState === _type.FcrScreenSharingState.END) {
|
|
191
|
+
if (causeData && causeCmd === 10 && causeData.widgetUuid === 'annotation') {
|
|
192
|
+
var _causeData$widgetCaus;
|
|
193
|
+
if (((_causeData$widgetCaus = causeData.widgetCause) === null || _causeData$widgetCaus === void 0 ? void 0 : _causeData$widgetCaus.cmd) === 1) {
|
|
194
|
+
this._observable.notifyObservers('onScreenSharingUpdated', this.ownerId, _type.FcrScreenSharingState.END);
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
} else {
|
|
198
|
+
if (causeData && causeCmd === 10 && causeData.widgetUuid === 'annotation') {
|
|
199
|
+
var _causeData$widgetCaus2;
|
|
200
|
+
if (((_causeData$widgetCaus2 = causeData.widgetCause) === null || _causeData$widgetCaus2 === void 0 ? void 0 : _causeData$widgetCaus2.cmd) === 1) {
|
|
201
|
+
this._observable.notifyObservers('onScreenSharingUpdated', this.ownerId, _type.FcrScreenSharingState.START_WHIT_ANNOTATION);
|
|
202
|
+
} else {
|
|
203
|
+
this._observable.notifyObservers('onScreenSharingUpdated', this.ownerId, _type.FcrScreenSharingState.START_ONLY_SCREEN);
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
_handleOnWhiteboardActive(ownerId, operatorUser) {
|
|
209
|
+
this._observable.notifyObservers('onWhiteboardStarted', ownerId, operatorUser);
|
|
210
|
+
}
|
|
211
|
+
_handleOnWhiteboardInActive(reason, operatorUser) {
|
|
212
|
+
this._observable.notifyObservers('onWhiteboardEnded', reason, operatorUser);
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
exports.FcrSharingControlImpl = FcrSharingControlImpl;
|
|
216
|
+
_FcrSharingControlImpl = FcrSharingControlImpl;
|
|
217
|
+
[_initProto] = _applyDecs(_FcrSharingControlImpl, [[_imports.trace, 2, "startScreenSharing"], [_imports.trace, 2, "startWhiteboard"], [_imports.trace, 2, "updateScreenSharing"], [_imports.trace, 2, "stop"], [_imports.trace, 2, "getScreenSharingState"]], []).e;
|