fcr-core 3.7.6 → 3.7.7-rc.1
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.
|
@@ -65,6 +65,7 @@ class FcrSharingControlImpl {
|
|
|
65
65
|
(0, _defineProperty2.default)(this, "_sceneObserver", {
|
|
66
66
|
onScenePropertiesUpdated: this._handleOnScenePropertiesUpdated.bind(this)
|
|
67
67
|
});
|
|
68
|
+
// TODO: 这里不应该再维护一套白板的状态和事件了, ui-scene 应该直接用 board control 的
|
|
68
69
|
(0, _defineProperty2.default)(this, "_whiteboardObserver", {
|
|
69
70
|
onActive: this._handleOnWhiteboardActive.bind(this),
|
|
70
71
|
onInactive: this._handleOnWhiteboardInActive.bind(this)
|
|
@@ -79,6 +80,7 @@ class FcrSharingControlImpl {
|
|
|
79
80
|
this._addLogObserver();
|
|
80
81
|
this._whiteboardControl = this.getBoardControl();
|
|
81
82
|
this._annotationControl = this.getAnnotationControl();
|
|
83
|
+
this._isActive = this._whiteboardControl.getActivity();
|
|
82
84
|
this._streamControl.addObserver(this._streamObserver);
|
|
83
85
|
this._whiteboardControl.addObserver(this._whiteboardObserver);
|
|
84
86
|
this._scene.addObserver(this._sceneObserver);
|
package/lib/room-router/index.js
CHANGED
|
@@ -49,16 +49,16 @@ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol"
|
|
|
49
49
|
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
50
50
|
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; }
|
|
51
51
|
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; }
|
|
52
|
-
_ref = (_initDecs = [_imports.trace, (0, _validateParams.default)(_schema.stringSchema)], _joinRoomDecs = [_imports.trace, (0, _validateParams.default)(_schema.fcrRoomJoinOptionsSchema)], "logger");
|
|
53
52
|
/**
|
|
54
53
|
* @internal
|
|
55
54
|
*/
|
|
56
|
-
|
|
55
|
+
_ref = (_initDecs = [_imports.trace, (0, _validateParams.default)(_schema.stringSchema)], _joinRoomDecs = [_imports.trace, (0, _validateParams.default)(_schema.fcrRoomJoinOptionsSchema)], "logger");
|
|
57
56
|
class FcrRoomRouterImpl {
|
|
58
57
|
constructor(_rteEngine, _apiService, _config, _chatConnection, _sharedCache, roomId) {
|
|
59
58
|
(0, _defineProperty2.default)(this, _ref, (_initProto(this), (0, _logger.createLogger)({
|
|
60
59
|
prefix: 'FcrRoomRouterImpl'
|
|
61
60
|
})));
|
|
61
|
+
(0, _defineProperty2.default)(this, "_abortController", null);
|
|
62
62
|
(0, _defineProperty2.default)(this, "_observable", new _imports.AgoraObservable());
|
|
63
63
|
(0, _defineProperty2.default)(this, "_roomControlObservable", {
|
|
64
64
|
onRoomRouteSwitched: async event => {
|
|
@@ -98,13 +98,22 @@ class FcrRoomRouterImpl {
|
|
|
98
98
|
this._bypass = undefined;
|
|
99
99
|
}
|
|
100
100
|
async joinRoom(options) {
|
|
101
|
+
this._abortController = new AbortController();
|
|
101
102
|
this._validateRoomJoinState();
|
|
102
103
|
const [error] = await (0, _imports.to)(this._executeJoinRoomWithRetry(options));
|
|
104
|
+
this._abortController = null;
|
|
103
105
|
if (error) {
|
|
104
106
|
this._handleJoinRoomError(error);
|
|
105
107
|
throw error;
|
|
106
108
|
}
|
|
107
109
|
}
|
|
110
|
+
async leaveRoom() {
|
|
111
|
+
var _this$_abortControlle, _this$_roomControl;
|
|
112
|
+
(_this$_abortControlle = this._abortController) === null || _this$_abortControlle === void 0 || _this$_abortControlle.abort();
|
|
113
|
+
this._abortController = null;
|
|
114
|
+
(_this$_roomControl = this._roomControl) === null || _this$_roomControl === void 0 || _this$_roomControl.leave();
|
|
115
|
+
this._roomControl = null;
|
|
116
|
+
}
|
|
108
117
|
|
|
109
118
|
/**
|
|
110
119
|
* 验证房间加入状态
|
|
@@ -121,6 +130,7 @@ class FcrRoomRouterImpl {
|
|
|
121
130
|
* @private
|
|
122
131
|
*/
|
|
123
132
|
async _executeJoinRoomWithRetry(options) {
|
|
133
|
+
const abortController = this._abortController;
|
|
124
134
|
return (0, _imports.retryAttempt)(() => this._performSingleJoinAttempt(options), [], {
|
|
125
135
|
retriesMax: _type2.ROOM_ROUTER_CONSTANTS.MAX_JOIN_ATTEMPTS
|
|
126
136
|
}).fail(async _ref2 => {
|
|
@@ -129,7 +139,9 @@ class FcrRoomRouterImpl {
|
|
|
129
139
|
timeFn: waitBeforeRetry,
|
|
130
140
|
currentRetry: attemptCount
|
|
131
141
|
} = _ref2;
|
|
132
|
-
return (0, _joinHelper.handleJoinRetryFailure)(error, waitBeforeRetry, attemptCount, _retryHelpers.canRetryJoinError,
|
|
142
|
+
return (0, _joinHelper.handleJoinRetryFailure)(error, waitBeforeRetry, attemptCount, _retryHelpers.canRetryJoinError, () => {
|
|
143
|
+
this._throwIfAborted(abortController);
|
|
144
|
+
}, 'join room via router');
|
|
133
145
|
}).exec();
|
|
134
146
|
}
|
|
135
147
|
|
|
@@ -138,8 +150,11 @@ class FcrRoomRouterImpl {
|
|
|
138
150
|
* @private
|
|
139
151
|
*/
|
|
140
152
|
async _performSingleJoinAttempt(options) {
|
|
153
|
+
const abortController = this._abortController;
|
|
141
154
|
const roomResponse = await this._performCheckIn(options);
|
|
155
|
+
this._throwIfAborted(abortController);
|
|
142
156
|
const roomControl = await this._joinRoomControl(options, roomResponse);
|
|
157
|
+
this._throwIfAborted(abortController);
|
|
143
158
|
this._updateRoomState(roomResponse, roomControl);
|
|
144
159
|
}
|
|
145
160
|
|
|
@@ -174,7 +189,11 @@ class FcrRoomRouterImpl {
|
|
|
174
189
|
data,
|
|
175
190
|
ts
|
|
176
191
|
} = roomResponse;
|
|
192
|
+
const abortController = this._abortController;
|
|
177
193
|
const roomControl = this._createRoomControl(data);
|
|
194
|
+
abortController === null || abortController === void 0 || abortController.signal.addEventListener('abort', () => {
|
|
195
|
+
roomControl.leave();
|
|
196
|
+
});
|
|
178
197
|
await roomControl.join(_objectSpread(_objectSpread({}, options), {}, {
|
|
179
198
|
snapshot: data,
|
|
180
199
|
timestamp: ts,
|
|
@@ -232,6 +251,11 @@ class FcrRoomRouterImpl {
|
|
|
232
251
|
roomResponse
|
|
233
252
|
});
|
|
234
253
|
}
|
|
254
|
+
_throwIfAborted(abortController) {
|
|
255
|
+
if (abortController !== null && abortController !== void 0 && abortController.signal.aborted) {
|
|
256
|
+
throw new Error('Join room attempt aborted');
|
|
257
|
+
}
|
|
258
|
+
}
|
|
235
259
|
addObserver(observer) {
|
|
236
260
|
this._observable.addObserver(observer);
|
|
237
261
|
}
|
|
@@ -241,4 +265,4 @@ class FcrRoomRouterImpl {
|
|
|
241
265
|
}
|
|
242
266
|
exports.FcrRoomRouterImpl = FcrRoomRouterImpl;
|
|
243
267
|
_FcrRoomRouterImpl = FcrRoomRouterImpl;
|
|
244
|
-
[_initProto] = _applyDecs(_FcrRoomRouterImpl, [[_initDecs, 2, "_init"], [_joinRoomDecs, 2, "joinRoom"]], []).e;
|
|
268
|
+
[_initProto] = _applyDecs(_FcrRoomRouterImpl, [[_initDecs, 2, "_init"], [_joinRoomDecs, 2, "joinRoom"], [_imports.trace, 2, "leaveRoom"]], []).e;
|
|
@@ -35,6 +35,10 @@ export interface FcrRoomRouter {
|
|
|
35
35
|
* 加入会议
|
|
36
36
|
*/
|
|
37
37
|
joinRoom(options: FcrRoomJoinOptions): Promise<void>;
|
|
38
|
+
/**
|
|
39
|
+
* 离开会议
|
|
40
|
+
*/
|
|
41
|
+
leaveRoom(): Promise<void>;
|
|
38
42
|
addObserver(observer: FcrRoomRouterObserver): void;
|
|
39
43
|
removeObserver(observer: FcrRoomRouterObserver): void;
|
|
40
44
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "fcr-core",
|
|
3
3
|
"description": "Core APIs for building online scenes",
|
|
4
|
-
"version": "3.7.
|
|
4
|
+
"version": "3.7.7-rc.1",
|
|
5
5
|
"module": "lib/index.js",
|
|
6
6
|
"types": "lib/index.d.ts",
|
|
7
7
|
"files": [
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"@types/lodash": "^4.14.168",
|
|
41
41
|
"@types/sinon": "^17.0.2",
|
|
42
42
|
"@types/uuid": "^8.3.0",
|
|
43
|
-
"agora-toolchain": "~3.7.
|
|
43
|
+
"agora-toolchain": "~3.7.7-rc.1",
|
|
44
44
|
"core-js": "^3.33.3",
|
|
45
45
|
"decomment": "^0.9.5",
|
|
46
46
|
"husky": "^9.0.11",
|
|
@@ -55,8 +55,8 @@
|
|
|
55
55
|
"@netless/forge-room": "1.0.6",
|
|
56
56
|
"@netless/forge-rtm": "1.0.6",
|
|
57
57
|
"@netless/forge-whiteboard": "1.0.6",
|
|
58
|
-
"agora-foundation": "~3.7.
|
|
59
|
-
"agora-rte-sdk": "~3.7.
|
|
58
|
+
"agora-foundation": "~3.7.7-rc.1",
|
|
59
|
+
"agora-rte-sdk": "~3.7.7-rc.1",
|
|
60
60
|
"await-to-js": "^3.0.0",
|
|
61
61
|
"dayjs": "^1.10.4",
|
|
62
62
|
"easemob-websdk": "4.13.0",
|