fcr-core 3.8.2 → 3.9.0-alpha

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.
Files changed (159) hide show
  1. package/lib/chat-connector/type.d.ts +40 -0
  2. package/lib/{chat-connection → chat-connector}/type.js +1 -1
  3. package/lib/engine/index.d.ts +10 -11
  4. package/lib/engine/index.js +63 -72
  5. package/lib/engine/type.d.ts +96 -0
  6. package/lib/engine/type.js +5 -0
  7. package/lib/imports.d.ts +7 -4
  8. package/lib/imports.js +30 -4
  9. package/lib/index.d.ts +3 -2
  10. package/lib/index.js +21 -2
  11. package/lib/media-control/desktop.js +12 -12
  12. package/lib/media-control/mobile.js +4 -0
  13. package/lib/media-control/type.d.ts +32 -33
  14. package/lib/monitor-control/index.js +3 -3
  15. package/lib/peer-session/index.js +14 -14
  16. package/lib/peer-session/type.d.ts +1 -1
  17. package/lib/plugins/chat/chatroom.js +417 -0
  18. package/lib/{chat-connection → plugins/chat}/config.d.ts +1 -0
  19. package/lib/{chat-connection → plugins/chat}/config.js +2 -1
  20. package/lib/plugins/chat/connector.d.ts +38 -0
  21. package/lib/{chat-connection/index.js → plugins/chat/connector.js} +181 -61
  22. package/lib/room-control/ability-control/index.js +5 -4
  23. package/lib/room-control/ability-control/type.d.ts +5 -1
  24. package/lib/room-control/ability-control/type.js +4 -0
  25. package/lib/room-control/chatroom-control/type.d.ts +44 -35
  26. package/lib/room-control/group-control/index.js +9 -9
  27. package/lib/room-control/index.js +37 -22
  28. package/lib/room-control/interpreter-control/index.js +7 -4
  29. package/lib/room-control/interpreter-control/room.js +3 -3
  30. package/lib/room-control/interpreter-control/types.d.ts +2 -2
  31. package/lib/room-control/join-before-host-waitingroom-control/index.js +3 -3
  32. package/lib/room-control/mainroom-control/index.js +15 -13
  33. package/lib/room-control/privilege-control/index.js +39 -24
  34. package/lib/room-control/privilege-control/type.d.ts +15 -15
  35. package/lib/room-control/room-connector-control/index.js +7 -5
  36. package/lib/room-control/room-connector-control/type.d.ts +1 -1
  37. package/lib/room-control/room-control-factory.d.ts +3 -3
  38. package/lib/room-control/room-control-factory.js +7 -7
  39. package/lib/room-control/room-session/index.js +17 -15
  40. package/lib/room-control/room-session/type.d.ts +3 -3
  41. package/lib/room-control/sharing-control/index.js +13 -7
  42. package/lib/room-control/stream-control/index.js +18 -16
  43. package/lib/room-control/stream-control/type.d.ts +5 -5
  44. package/lib/room-control/stt-control/index.js +38 -31
  45. package/lib/room-control/type.d.ts +19 -19
  46. package/lib/room-control/user-control/index.js +20 -22
  47. package/lib/room-control/user-control/type.d.ts +1 -1
  48. package/lib/room-control/waitingroom-control/index.js +11 -11
  49. package/lib/room-control/whiteboard-control-v1/board-window.d.ts +21 -20
  50. package/lib/room-control/whiteboard-control-v1/board-window.js +27 -8
  51. package/lib/room-control/whiteboard-control-v1/factory.js +1 -1
  52. package/lib/room-control/whiteboard-control-v1/index.js +26 -18
  53. package/lib/room-control/whiteboard-control-v1/type.d.ts +26 -25
  54. package/lib/room-control/whiteboard-control-v1/type.js +1 -0
  55. package/lib/room-control/whiteboard-control-v2/annotation-control/control.d.ts +15 -6
  56. package/lib/room-control/whiteboard-control-v2/annotation-control/control.js +39 -5
  57. package/lib/room-control/whiteboard-control-v2/annotation-control/factory.d.ts +4 -5
  58. package/lib/room-control/whiteboard-control-v2/annotation-control/factory.js +6 -5
  59. package/lib/room-control/whiteboard-control-v2/annotation-control/type.d.ts +7 -1
  60. package/lib/room-control/whiteboard-control-v2/base/index.d.ts +9 -8
  61. package/lib/room-control/whiteboard-control-v2/base/index.js +84 -42
  62. package/lib/room-control/whiteboard-control-v2/base/main-window.d.ts +16 -15
  63. package/lib/room-control/whiteboard-control-v2/base/main-window.js +23 -4
  64. package/lib/room-control/whiteboard-control-v2/type.d.ts +17 -17
  65. package/lib/room-control/whiteboard-control-v2/whiteboard-control/control.d.ts +12 -6
  66. package/lib/room-control/whiteboard-control-v2/whiteboard-control/control.js +64 -18
  67. package/lib/room-control/whiteboard-control-v2/whiteboard-control/factory.d.ts +2 -2
  68. package/lib/room-control/whiteboard-control-v2/whiteboard-control/factory.js +10 -10
  69. package/lib/room-control/whiteboard-control-v2/whiteboard-control/type.d.ts +1 -1
  70. package/lib/room-router/index.js +10 -7
  71. package/lib/room-router/type.d.ts +1 -1
  72. package/lib/schema.d.ts +24 -46
  73. package/lib/schema.js +1 -2
  74. package/lib/service/api.d.ts +5 -3
  75. package/lib/service/api.js +17 -12
  76. package/lib/type.d.ts +64 -45
  77. package/lib/type.js +76 -11
  78. package/lib/utilities/abortable-retry.d.ts +38 -0
  79. package/lib/utilities/abortable-retry.js +61 -0
  80. package/lib/utilities/dual-video-stream-config.d.ts +6 -0
  81. package/lib/utilities/dual-video-stream-config.js +25 -0
  82. package/lib/utilities/error-helpers.d.ts +10 -9
  83. package/lib/utilities/error-helpers.js +12 -11
  84. package/lib/utilities/error.d.ts +4 -40
  85. package/lib/utilities/error.js +20 -77
  86. package/lib/utilities/join-helper.js +2 -2
  87. package/lib/utilities/logger.d.ts +2 -2
  88. package/lib/utilities/logger.js +6 -25
  89. package/lib/utilities/package-info.d.ts +1 -2
  90. package/lib/utilities/package-info.js +4 -8
  91. package/lib/utilities/parameters.js +88 -15
  92. package/lib/utilities/validate-params.js +1 -1
  93. package/lib/utilities/video-encoder-config.d.ts +9 -0
  94. package/lib/utilities/video-encoder-config.js +109 -0
  95. package/lib-es/{chat-connection → chat-connector}/type.js +1 -1
  96. package/lib-es/engine/index.js +46 -56
  97. package/lib-es/engine/type.js +1 -0
  98. package/lib-es/imports.js +5 -3
  99. package/lib-es/index.js +2 -1
  100. package/lib-es/media-control/desktop.js +12 -12
  101. package/lib-es/media-control/mobile.js +4 -0
  102. package/lib-es/monitor-control/index.js +3 -3
  103. package/lib-es/peer-session/index.js +16 -15
  104. package/lib-es/plugins/chat/chatroom.js +409 -0
  105. package/lib-es/{chat-connection → plugins/chat}/config.js +2 -1
  106. package/lib-es/{chat-connection/index.js → plugins/chat/connector.js} +178 -58
  107. package/lib-es/room-control/ability-control/index.js +5 -4
  108. package/lib-es/room-control/ability-control/type.js +4 -0
  109. package/lib-es/room-control/group-control/index.js +11 -10
  110. package/lib-es/room-control/index.js +40 -26
  111. package/lib-es/room-control/interpreter-control/index.js +10 -5
  112. package/lib-es/room-control/interpreter-control/room.js +3 -3
  113. package/lib-es/room-control/join-before-host-waitingroom-control/index.js +4 -3
  114. package/lib-es/room-control/mainroom-control/index.js +16 -17
  115. package/lib-es/room-control/privilege-control/index.js +43 -29
  116. package/lib-es/room-control/room-connector-control/index.js +9 -6
  117. package/lib-es/room-control/room-control-factory.js +6 -6
  118. package/lib-es/room-control/room-session/index.js +21 -22
  119. package/lib-es/room-control/sharing-control/index.js +13 -7
  120. package/lib-es/room-control/stream-control/index.js +21 -18
  121. package/lib-es/room-control/stt-control/index.js +23 -15
  122. package/lib-es/room-control/user-control/index.js +23 -23
  123. package/lib-es/room-control/waitingroom-control/index.js +10 -9
  124. package/lib-es/room-control/whiteboard-control-v1/board-window.js +27 -8
  125. package/lib-es/room-control/whiteboard-control-v1/factory.js +1 -1
  126. package/lib-es/room-control/whiteboard-control-v1/index.js +26 -17
  127. package/lib-es/room-control/whiteboard-control-v1/type.js +1 -0
  128. package/lib-es/room-control/whiteboard-control-v2/annotation-control/control.js +39 -5
  129. package/lib-es/room-control/whiteboard-control-v2/annotation-control/factory.js +7 -6
  130. package/lib-es/room-control/whiteboard-control-v2/base/index.js +86 -42
  131. package/lib-es/room-control/whiteboard-control-v2/base/main-window.js +23 -4
  132. package/lib-es/room-control/whiteboard-control-v2/whiteboard-control/control.js +60 -13
  133. package/lib-es/room-control/whiteboard-control-v2/whiteboard-control/factory.js +10 -10
  134. package/lib-es/room-router/index.js +10 -6
  135. package/lib-es/schema.js +1 -2
  136. package/lib-es/service/api.js +17 -12
  137. package/lib-es/type.js +70 -18
  138. package/lib-es/utilities/abortable-retry.js +54 -0
  139. package/lib-es/utilities/dual-video-stream-config.js +19 -0
  140. package/lib-es/utilities/error-helpers.js +13 -12
  141. package/lib-es/utilities/error.js +9 -75
  142. package/lib-es/utilities/join-helper.js +4 -3
  143. package/lib-es/utilities/logger.js +7 -23
  144. package/lib-es/utilities/package-info.js +4 -6
  145. package/lib-es/utilities/parameters.js +88 -15
  146. package/lib-es/utilities/validate-params.js +3 -2
  147. package/lib-es/utilities/video-encoder-config.js +103 -0
  148. package/package.json +7 -7
  149. package/lib/chat-connection/index.d.ts +0 -24
  150. package/lib/chat-connection/type.d.ts +0 -17
  151. package/lib/plugins/chatroom.js +0 -454
  152. package/lib/room-control/chatroom-control/config.d.ts +0 -51
  153. package/lib/room-control/chatroom-control/config.js +0 -105
  154. package/lib/utilities/storage.d.ts +0 -8
  155. package/lib/utilities/storage.js +0 -33
  156. package/lib-es/plugins/chatroom.js +0 -446
  157. package/lib-es/room-control/chatroom-control/config.js +0 -100
  158. package/lib-es/utilities/storage.js +0 -27
  159. /package/lib/plugins/{chatroom.d.ts → chat/chatroom.d.ts} +0 -0
@@ -22,116 +22,188 @@ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol"
22
22
  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); }
23
23
  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; }
24
24
  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; }
25
- import { AgoraObservable, EasemobChatSDK, retryAttempt, to, AgoraRestfulClientError, trace } from '../imports';
26
- import { FcrChatConnectionState } from './type';
25
+ import { AgoraObservable, AgoraScheduler, EasemobChatSDK, trace } from '../../imports';
26
+ import { FcrReturnCode } from '../../type';
27
+ import { abortableRetry } from '../../utilities/abortable-retry';
28
+ import { createLogger, generateLogObserver } from '../../utilities/logger';
29
+ import { getDependenciesInfo } from '../../utilities/package-info';
27
30
  import { agoraChatConfig } from './config';
28
- import { createLogger } from '../utilities/logger';
29
- import { getDependenciesInfo } from '../utilities/package-info';
30
- export class FcrChatConnectionImpl {
31
+ import { FcrChatConnectionState } from '../../chat-connector/type';
32
+ export class FcrChatConnectorImpl {
31
33
  static {
32
34
  [_initProto] = _applyDecs(this, [[trace, 2, "login"], [trace, 2, "logout"]], []).e;
33
35
  }
34
36
  logger = (_initProto(this), createLogger({
35
- prefix: 'FcrChatConnectionImpl'
37
+ prefix: 'FcrChatConnectorImpl'
36
38
  }));
37
39
  _observable = new AgoraObservable();
40
+ _loginPromise = null;
41
+ _logoutPromise = null;
42
+ _isLogoutRequested = false;
43
+ _abortLogin = null;
44
+ _conn = null;
38
45
  _connectionState = FcrChatConnectionState.DISCONNECTED;
46
+ _reconnectionTimer = null;
47
+ _reconnectPromise = null;
39
48
  constructor(_userId, _api, _chatIpList, _restIpList) {
40
49
  this._userId = _userId;
41
50
  this._api = _api;
42
51
  this._chatIpList = _chatIpList;
43
52
  this._restIpList = _restIpList;
44
53
  this.logger.info(`Chat Version: easemob-websdk@${getDependenciesInfo('easemob-websdk')}`);
54
+ this._addLogObserver();
45
55
  }
46
56
  async login() {
57
+ if (this._logoutPromise) {
58
+ await this._logoutPromise;
59
+ }
60
+ if (this._connectionState === FcrChatConnectionState.CONNECTED) {
61
+ return;
62
+ }
63
+ if (this._loginPromise) {
64
+ return this._loginPromise;
65
+ }
66
+ this._isLogoutRequested = false;
67
+ this._setConnectionState(FcrChatConnectionState.CONNECTING);
68
+ this._loginPromise = this._performLogin();
69
+ try {
70
+ await this._loginPromise;
71
+ } finally {
72
+ this._loginPromise = null;
73
+ }
74
+ }
75
+ logout() {
76
+ if (this._logoutPromise) {
77
+ return FcrReturnCode.SUCCESS;
78
+ }
79
+ this._isLogoutRequested = true;
80
+ this._logoutPromise = this._performLogout();
81
+ return FcrReturnCode.SUCCESS;
82
+ }
83
+ getConnectionState() {
84
+ return this._connectionState;
85
+ }
86
+ getConnectionInstance() {
87
+ return this._conn;
88
+ }
89
+ addObserver(observer) {
90
+ this._observable.addObserver(observer);
91
+ }
92
+ removeObserver(observer) {
93
+ this._observable.removeObserver(observer);
94
+ }
95
+ async _performLogin() {
47
96
  const privateConfig = this._getPrivateConfig();
48
97
  if (privateConfig) {
49
98
  this.logger.info('use private config:', JSON.stringify(privateConfig));
50
99
  }
51
- await to(retryAttempt(async () => {
100
+ const [abort, promise] = abortableRetry(async signal => {
52
101
  const tokenResult = await this._api.getUserToken(this._userId);
102
+ signal.throwIfAborted();
53
103
  this._initConfig = tokenResult;
104
+ const appKey = tokenResult.appKey;
54
105
  const connParams = {
55
106
  ...agoraChatConfig,
56
107
  ...privateConfig,
57
- appKey: tokenResult.appKey,
58
- autoReconnectNumMax: 99999,
59
- isFixedDeviceId: false
108
+ appKey
60
109
  };
61
110
  EasemobChatSDK.logger.setConsoleLogVisibility(false);
62
111
  this._conn = new EasemobChatSDK.connection(connParams);
63
- this._addEventListeners();
112
+ this._addEventListeners(this._conn);
64
113
  await this._conn.open({
65
114
  accessToken: this._initConfig.token,
66
115
  user: this._userId
67
116
  });
68
- this.logger.info(`onConnectionLoginSuccess, token: ${this._initConfig.token}, userId: ${this._userId}`);
69
- this._observable.notifyObservers('onConnectionLoginSuccess');
70
- }, [], {
71
- retriesMax: 3
72
- }).fail(async ({
73
- error,
74
- timeFn,
75
- currentRetry
76
- }) => {
77
- if (error instanceof AgoraRestfulClientError) {
78
- throw error;
117
+ this.logger.info(`login success, token: ${this._initConfig.token}, userId: ${this._userId}`);
118
+ }, {
119
+ retriesMax: Infinity
120
+ });
121
+ this._abortLogin = abort;
122
+ const [error] = await promise;
123
+ this._abortLogin = null;
124
+ if (error) {
125
+ await this._closeConnection();
126
+ if (error.name === 'AbortError' && this._isLogoutRequested) {
127
+ return;
79
128
  }
80
- this.logger.error(`retry to login ChatConnection, ${error.message},retry ${currentRetry} times`);
81
- await timeFn();
82
- return true;
83
- }).exec());
129
+ throw error;
130
+ }
131
+ if (this._isLogoutRequested) {
132
+ await this._closeConnection();
133
+ }
84
134
  }
85
- _addEventListeners() {
86
- this._conn?.addEventHandler('connectionListener', {
135
+ _addEventListeners(conn) {
136
+ conn.addEventHandler('connectionListener', {
87
137
  onError: e => {
88
138
  this.logger.error('onError', e.message);
89
139
  },
90
140
  onConnected: () => {
91
141
  this.logger.info('onConnected');
92
- if (this._connectionState !== FcrChatConnectionState.CONNECTED) {
93
- this._setConnectionState(FcrChatConnectionState.CONNECTED);
94
- }
95
- },
96
- onDisconnected: () => {
97
- if (this._connectionState !== FcrChatConnectionState.DISCONNECTED) {
98
- this.logger.info('onDisconnected');
99
- this._setConnectionState(FcrChatConnectionState.DISCONNECTED);
100
- }
142
+ this._handleConnected();
101
143
  },
102
144
  onOnline: () => {
103
145
  this.logger.info('onOnline');
104
- if (this._connectionState !== FcrChatConnectionState.CONNECTED) {
105
- this._setConnectionState(FcrChatConnectionState.CONNECTED);
106
- }
146
+ this._handleConnected();
107
147
  },
108
148
  onOffline: () => {
109
- if (this._connectionState !== FcrChatConnectionState.DISCONNECTED) {
110
- this.logger.info('onOffline');
111
- this._setConnectionState(FcrChatConnectionState.DISCONNECTED);
112
- }
149
+ this.logger.info('onOffline');
150
+ this._handleDisconnected();
151
+ },
152
+ onDisconnected: () => {
153
+ this.logger.info('onDisconnected');
154
+ this._handleDisconnected();
113
155
  }
114
156
  });
115
157
  }
116
- logout() {
117
- this._conn?.close();
158
+ async _performLogout() {
159
+ try {
160
+ if (this._reconnectionTimer) {
161
+ clearTimeout(this._reconnectionTimer);
162
+ this._reconnectionTimer = null;
163
+ }
164
+ if (this._abortLogin) {
165
+ this._abortLogin();
166
+ this._abortLogin = null;
167
+ }
168
+ await this._waitForLoginComplete();
169
+ await this._closeConnection();
170
+ } catch (error) {
171
+ this.logger.error('logout error', error.message);
172
+ } finally {
173
+ this._logoutPromise = null;
174
+ this._isLogoutRequested = false;
175
+ }
176
+ }
177
+ async _waitForLoginComplete() {
178
+ if (!this._loginPromise) {
179
+ return;
180
+ }
181
+ try {
182
+ await this._loginPromise;
183
+ } catch (error) {
184
+ this.logger.error('login error during logout', error.message);
185
+ }
186
+ }
187
+ async _closeConnection() {
188
+ const conn = this._conn;
189
+ this._conn = null;
190
+ if (conn) {
191
+ try {
192
+ conn.removeEventHandler('connectionListener');
193
+ await Promise.resolve(conn.close?.());
194
+ } catch (error) {
195
+ this.logger.error('close connection error', error.message);
196
+ }
197
+ }
198
+ this._setConnectionState(FcrChatConnectionState.DISCONNECTED);
118
199
  }
119
200
  _setConnectionState(state) {
201
+ if (this._connectionState === state) {
202
+ return;
203
+ }
120
204
  this._connectionState = state;
121
205
  this._observable.notifyObservers('onConnectionStateUpdated', state);
122
206
  }
123
- getConnectionState() {
124
- return this._connectionState;
125
- }
126
- getConnectionInstance() {
127
- return this._conn;
128
- }
129
- addObserver(observer) {
130
- this._observable.addObserver(observer);
131
- }
132
- removeObserver(observer) {
133
- this._observable.removeObserver(observer);
134
- }
135
207
  _getPrivateConfig() {
136
208
  if (this._chatIpList?.length || this._restIpList?.length) {
137
209
  const privateConfig = {
@@ -146,4 +218,52 @@ export class FcrChatConnectionImpl {
146
218
  return privateConfig;
147
219
  }
148
220
  }
221
+ _handleConnected() {
222
+ if (this._isLogoutRequested) {
223
+ return;
224
+ }
225
+ if (this._connectionState !== FcrChatConnectionState.CONNECTED) {
226
+ this._setConnectionState(FcrChatConnectionState.CONNECTED);
227
+ } else {
228
+ // notify again in case of reconnection
229
+ this._observable.notifyObservers('onConnectionStateUpdated', FcrChatConnectionState.CONNECTED);
230
+ }
231
+ }
232
+ _handleDisconnected() {
233
+ if (this._connectionState !== FcrChatConnectionState.DISCONNECTED) {
234
+ this._setConnectionState(FcrChatConnectionState.DISCONNECTED);
235
+ }
236
+ if (this._isLogoutRequested) {
237
+ return;
238
+ }
239
+ this._reconnect();
240
+ }
241
+ async _reconnect() {
242
+ if (this._loginPromise || this._reconnectPromise) {
243
+ return;
244
+ }
245
+ const doReconnect = async () => {
246
+ await this._closeConnection();
247
+
248
+ // add a short delay to avoid tight reconnect loops
249
+ await new Promise(resolve => {
250
+ this._reconnectionTimer = setTimeout(resolve, AgoraScheduler.Duration.second(1));
251
+ });
252
+ this._reconnectionTimer = null;
253
+ if (this._isLogoutRequested) {
254
+ return;
255
+ }
256
+ try {
257
+ await this.login();
258
+ } catch (error) {
259
+ this.logger.error('reconnect error', error.message);
260
+ }
261
+ };
262
+ this._reconnectPromise = doReconnect().finally(() => {
263
+ this._reconnectPromise = null;
264
+ });
265
+ }
266
+ _addLogObserver() {
267
+ this.addObserver(generateLogObserver(this.logger, [['onConnectionStateUpdated', ['state']]]));
268
+ }
149
269
  }
@@ -15,13 +15,14 @@ import "core-js/modules/esnext.map.reduce.js";
15
15
  import "core-js/modules/esnext.map.some.js";
16
16
  import "core-js/modules/esnext.map.update.js";
17
17
  import "core-js/modules/esnext.symbol.metadata.js";
18
- let _initProto;
18
+ let _initProto, _isPlatformAbilitySupportedDecs;
19
19
  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)]; } }; }
20
20
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
21
21
  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); }
22
22
  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; }
23
23
  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; }
24
24
  import { getPlatform, trace } from '../../imports';
25
+ import { FcrPlatform } from '../../type';
25
26
  import { createLogger } from '../../utilities/logger';
26
27
  /**
27
28
  * 平台能力控制的实现类
@@ -29,10 +30,10 @@ import { createLogger } from '../../utilities/logger';
29
30
  */
30
31
  export class FcrAbilityControlImpl {
31
32
  static {
32
- [_initProto] = _applyDecs(this, [[trace, 2, "isPlatformAbilitySupported"]], []).e;
33
+ [_initProto] = _applyDecs(this, [[_isPlatformAbilitySupportedDecs, 2, "isPlatformAbilitySupported"]], []).e;
33
34
  }
34
35
  //@internal
35
- logger = (_initProto(this), createLogger({
36
+ [(_isPlatformAbilitySupportedDecs = trace(['platform', 'ability']), "logger")] = (_initProto(this), createLogger({
36
37
  prefix: 'FcrAbilityControlImpl'
37
38
  }));
38
39
  constructor(_scene) {
@@ -41,7 +42,7 @@ export class FcrAbilityControlImpl {
41
42
  getPlatformAbility(ability) {
42
43
  const platforms = this._scene.getScenePropertiesByKeyPath(`setting.ability.${ability}`);
43
44
  if (!Array.isArray(platforms)) {
44
- return [];
45
+ return [FcrPlatform.WEB_DESKTOP, FcrPlatform.MACOS, FcrPlatform.WINDOWS, FcrPlatform.IOS, FcrPlatform.ANDROID, FcrPlatform.WEB_MOBILE, FcrPlatform.HARMONY, FcrPlatform.CONNECTOR_PSTN, FcrPlatform.CONNECTOR_SIP, FcrPlatform.CONNECTOR_H323];
45
46
  }
46
47
  return platforms;
47
48
  }
@@ -7,5 +7,9 @@ export let FcrAbility = /*#__PURE__*/function (FcrAbility) {
7
7
  FcrAbility["Caption"] = "caption";
8
8
  FcrAbility["Transcribe"] = "transcribe";
9
9
  FcrAbility["Recording"] = "recording";
10
+ FcrAbility["Board"] = "board";
11
+ FcrAbility["SettingVirtualBackground"] = "setting:virtualBackground";
12
+ FcrAbility["SettingBeautyMode"] = "setting:beautyMode";
13
+ FcrAbility["PstnCallOut"] = "pstn:callOut";
10
14
  return FcrAbility;
11
15
  }({});
@@ -28,15 +28,16 @@ import { trace } from '../../imports';
28
28
  import { AgoraObservable } from '../../imports';
29
29
  import { convertRteUserToFcrUser } from '../../utilities/user';
30
30
  import { createLogger, generateLogObserver } from '../../utilities/logger';
31
- import { FcrErrorModuleCode, handleRequestError } from '../../utilities/error';
31
+ import { handleRequestError } from '../../utilities/error';
32
32
  import validateParams from '../../utilities/validate-params';
33
33
  import { fcrGroupUpdateOptionsArraySchema, fcrGroupCreateConfigArraySchema, stringArraySchema, stringSchema } from '../../schema';
34
+ import { ErrorModuleCode } from '../../imports';
34
35
  export class FcrGroupControl {
35
36
  static {
36
37
  [_initProto] = _applyDecs(this, [[trace, 2, "getGroupList"], [_getGroupUserListDecs, 2, "getGroupUserList"], [_addGroupsDecs, 2, "addGroups"], [_updateGroupsDecs, 2, "updateGroups"], [_deleteGroupsDecs, 2, "deleteGroups"], [trace, 2, "deleteAllGroups"], [_addUsersDecs, 2, "addUsers"], [_removeUsersDecs, 2, "removeUsers"], [_moveUsersDecs, 2, "moveUsers"]], []).e;
37
38
  }
38
39
  //@internal
39
- [(_getGroupUserListDecs = [trace, validateParams(stringSchema)], _addGroupsDecs = [trace, validateParams(fcrGroupCreateConfigArraySchema)], _updateGroupsDecs = [trace, validateParams(fcrGroupUpdateOptionsArraySchema)], _deleteGroupsDecs = [trace, validateParams(stringArraySchema)], _addUsersDecs = [trace, validateParams(stringArraySchema, stringSchema)], _removeUsersDecs = [trace, validateParams(stringArraySchema, stringSchema)], _moveUsersDecs = [trace, validateParams(stringArraySchema, stringSchema, stringSchema)], "logger")] = (_initProto(this), createLogger({
40
+ [(_getGroupUserListDecs = [trace(['groupId']), validateParams(stringSchema)], _addGroupsDecs = [trace(['groups']), validateParams(fcrGroupCreateConfigArraySchema)], _updateGroupsDecs = [trace(['groups']), validateParams(fcrGroupUpdateOptionsArraySchema)], _deleteGroupsDecs = [trace(['groupIds']), validateParams(stringArraySchema)], _addUsersDecs = [trace(['userList', 'groupId']), validateParams(stringArraySchema, stringSchema)], _removeUsersDecs = [trace(['userList', 'groupId']), validateParams(stringArraySchema, stringSchema)], _moveUsersDecs = [trace(['userList', 'fromGroupId', 'toGroupId']), validateParams(stringArraySchema, stringSchema, stringSchema)], "logger")] = (_initProto(this), createLogger({
40
41
  prefix: 'FcrGroupControl'
41
42
  }));
42
43
  //@internal
@@ -202,37 +203,37 @@ export class FcrGroupControl {
202
203
  return handleRequestError(() => this._api.addGroups(groups, {
203
204
  roomId: this._scene.sceneId,
204
205
  startTime: Date.now()
205
- }), FcrErrorModuleCode.ROOM_GROUP, 'add groups failed');
206
+ }), ErrorModuleCode.FCR_ROOM_GROUP, 'add groups failed');
206
207
  }
207
208
  updateGroups(groups) {
208
209
  return handleRequestError(() => this._api.updateGroups(groups, {
209
210
  roomId: this._scene.sceneId
210
- }), FcrErrorModuleCode.ROOM_GROUP, 'update groups failed');
211
+ }), ErrorModuleCode.FCR_ROOM_GROUP, 'update groups failed');
211
212
  }
212
213
  deleteGroups(groupIds) {
213
214
  return handleRequestError(() => this._api.deleteGroups(groupIds, {
214
215
  roomId: this._scene.sceneId
215
- }), FcrErrorModuleCode.ROOM_GROUP, 'delete groups failed');
216
+ }), ErrorModuleCode.FCR_ROOM_GROUP, 'delete groups failed');
216
217
  }
217
218
  deleteAllGroups() {
218
219
  return handleRequestError(() => this._api.deleteAllGroups({
219
220
  roomId: this._scene.sceneId
220
- }), FcrErrorModuleCode.ROOM_GROUP, 'delete all groups failed');
221
+ }), ErrorModuleCode.FCR_ROOM_GROUP, 'delete all groups failed');
221
222
  }
222
223
  addUsers(userList, groupId) {
223
224
  return handleRequestError(() => this._api.addUsers(userList, groupId, {
224
225
  roomId: this._scene.sceneId
225
- }), FcrErrorModuleCode.ROOM_GROUP, 'add users failed');
226
+ }), ErrorModuleCode.FCR_ROOM_GROUP, 'add users failed');
226
227
  }
227
228
  removeUsers(userList, groupId) {
228
229
  return handleRequestError(() => this._api.removeUsers(userList, groupId, {
229
230
  roomId: this._scene.sceneId
230
- }), FcrErrorModuleCode.ROOM_GROUP, 'remove users failed');
231
+ }), ErrorModuleCode.FCR_ROOM_GROUP, 'remove users failed');
231
232
  }
232
233
  moveUsers(userList, fromGroupId, toGroupId) {
233
234
  return handleRequestError(() => this._api.moveUsers(userList, fromGroupId, toGroupId, {
234
235
  roomId: this._scene.sceneId
235
- }), FcrErrorModuleCode.ROOM_GROUP, 'move users failed');
236
+ }), ErrorModuleCode.FCR_ROOM_GROUP, 'move users failed');
236
237
  }
237
238
  // createSubRoomControl(groupId: string) {
238
239
  // return new FcrSubRoomControlImpl(
@@ -250,6 +251,6 @@ export class FcrGroupControl {
250
251
  this._observable.removeObserver(observer);
251
252
  }
252
253
  _addLogObserver() {
253
- this.addObserver(generateLogObserver(this.logger, ['onGroupsAdded', 'onGroupsUpdated', 'onGroupsRemoved', 'onUserListAddedToGroup', 'onUserListRemovedFromGroup', 'onUserListMoveToGroup']));
254
+ this.addObserver(generateLogObserver(this.logger, [['onGroupsAdded', ['events']], ['onGroupsUpdated', ['events']], ['onGroupsRemoved', ['events']], ['onUserListAddedToGroup', ['events']], ['onUserListRemovedFromGroup', ['events']], ['onUserListMoveToGroup', ['events']]]));
254
255
  }
255
256
  }
@@ -15,45 +15,44 @@ import "core-js/modules/esnext.map.reduce.js";
15
15
  import "core-js/modules/esnext.map.some.js";
16
16
  import "core-js/modules/esnext.map.update.js";
17
17
  import "core-js/modules/esnext.symbol.metadata.js";
18
- let _initProto;
18
+ let _initProto, _joinDecs, _updateRoomPropertiesDecs, _updateIncrementRoomPropertiesDecs, _deleteRoomPropertiesDecs, _startCloudRecordingDecs, _startLiveStreamingDecs, _updateLiveStreamingLayoutDecs, _sendRoomMessageDecs;
19
19
  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)]; } }; }
20
20
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
21
21
  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); }
22
22
  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; }
23
23
  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; }
24
24
  // Core SDK imports
25
- import { AgoraObservable, jsonstring, trace, to } from '../imports';
25
+ import { AgoraObservable, jsonstring, to, trace } from '../imports';
26
26
 
27
27
  // Service and API imports
28
28
 
29
29
  // Type definitions
30
- import { FcrLiveStreamingLayoutType, FcrLiveStreamingState, FcrRecordingState, FcrUserRole, FcrUserRoleToStringMap } from '../type';
30
+ import { FcrLiveStreamingLayoutType, FcrLiveStreamingState, FcrRecordingState, FcrReturnCode, FcrUserRole, FcrUserRoleToStringMap } from '../type';
31
31
 
32
32
  // Room control types and interfaces
33
33
  import { FcrRoomType } from './type';
34
34
 
35
35
  // Control implementations
36
-
36
+ import { FcrAbilityControlImpl } from './ability-control';
37
+ import { FcrPrivilegeControlImpl } from './privilege-control';
37
38
  import { FcrRoomConnectorControlImpl } from './room-connector-control';
38
39
  import { FcrRoomSessionControlImpl } from './room-session';
39
- import { FcrPrivilegeControlImpl } from './privilege-control';
40
- import { FcrUserControlImpl } from './user-control';
41
- import { FcrStreamControlImpl } from './stream-control';
42
- import { FcrAbilityControlImpl } from './ability-control';
43
40
  import { FcrSharingControlImpl } from './sharing-control';
41
+ import { FcrStreamControlImpl } from './stream-control';
42
+ import { FcrUserControlImpl } from './user-control';
44
43
  // Error handling and utilities
45
- import { FcrErrorModuleCode, handleRequestError } from '../utilities/error';
44
+ import { ErrorModuleCode } from '../imports';
46
45
  import { convertToStructure } from '../utilities/collection';
46
+ import { handleRequestError } from '../utilities/error';
47
47
  import { createLogger } from '../utilities/logger';
48
48
 
49
49
  // Core state
50
50
  import { FcrConnectionState } from '..';
51
51
 
52
52
  // Helpers and utilities
53
- import { ROOM_CONTROL_CONSTANTS, ROOM_MESSAGE_COMMANDS, RECORDING_STATE_VALUES, LIVE_STREAMING_STATE_VALUES, ROOM_STATE_VALUES, RESPONSE_CODES, roomControlErrorHelper, liveStreamingErrorHelper, validateControllerInitialized, validateRoomJoined, validateJoinRoomPreconditions, FcrJoinHelper } from './helpers';
54
53
  import { ControllerType } from '../utilities/error-helpers';
54
+ import { FcrJoinHelper, LIVE_STREAMING_STATE_VALUES, liveStreamingErrorHelper, RECORDING_STATE_VALUES, RESPONSE_CODES, ROOM_CONTROL_CONSTANTS, ROOM_MESSAGE_COMMANDS, ROOM_STATE_VALUES, roomControlErrorHelper, validateControllerInitialized, validateJoinRoomPreconditions, validateRoomJoined } from './helpers';
55
55
  import { FcrSttControlImpl } from './stt-control';
56
-
57
56
  /**
58
57
  * 房间控制基础实现类
59
58
  *
@@ -64,10 +63,10 @@ import { FcrSttControlImpl } from './stt-control';
64
63
  */
65
64
  export class FcrBaseRoomControlImpl {
66
65
  static {
67
- [_initProto] = _applyDecs(this, [[trace, 2, "getSyncTimestamp"], [trace, 2, "getRoomInfo"], [trace, 2, "getRoomSchedule"], [trace, 2, "join"], [trace, 2, "leave"], [trace, 2, "start"], [trace, 2, "end"], [trace, 2, "close"], [trace, 2, "getRoomState"], [trace, 2, "getRoomProperties"], [trace, 2, "getRoomPropertiesByKeyPath"], [trace, 2, "updateRoomProperties"], [trace, 2, "updateIncrementRoomProperties"], [trace, 2, "deleteRoomProperties"], [trace, 2, "startCloudRecording"], [trace, 2, "pauseCloudRecording"], [trace, 2, "resumeCloudRecording"], [trace, 2, "stopCloudRecording"], [trace, 2, "getLiveStreamingState"], [trace, 2, "getLiveStreamingConfig"], [trace, 2, "startLiveStreaming"], [trace, 2, "updateLiveStreamingLayout"], [trace, 2, "stopLiveStreaming"], [trace, 2, "getCloudRecordingState"], [trace, 2, "sendRoomMessage"]], []).e;
66
+ [_initProto] = _applyDecs(this, [[trace, 2, "getSyncTimestamp"], [trace, 2, "getRoomInfo"], [trace, 2, "getRoomSchedule"], [_joinDecs, 2, "join"], [trace, 2, "leave"], [trace, 2, "start"], [trace, 2, "end"], [trace, 2, "close"], [trace, 2, "getRoomState"], [trace, 2, "getRoomProperties"], [trace, 2, "getRoomPropertiesByKeyPath"], [_updateRoomPropertiesDecs, 2, "updateRoomProperties"], [_updateIncrementRoomPropertiesDecs, 2, "updateIncrementRoomProperties"], [_deleteRoomPropertiesDecs, 2, "deleteRoomProperties"], [_startCloudRecordingDecs, 2, "startCloudRecording"], [trace, 2, "pauseCloudRecording"], [trace, 2, "resumeCloudRecording"], [trace, 2, "stopCloudRecording"], [trace, 2, "getLiveStreamingState"], [trace, 2, "getLiveStreamingConfig"], [_startLiveStreamingDecs, 2, "startLiveStreaming"], [_updateLiveStreamingLayoutDecs, 2, "updateLiveStreamingLayout"], [trace, 2, "stopLiveStreaming"], [trace, 2, "getCloudRecordingState"], [_sendRoomMessageDecs, 2, "sendRoomMessage"]], []).e;
68
67
  }
69
68
  //@internal
70
- logger = (_initProto(this), createLogger({
69
+ [(_joinDecs = trace(['options']), _updateRoomPropertiesDecs = trace(['properties', 'cause']), _updateIncrementRoomPropertiesDecs = trace(['increments', 'cause']), _deleteRoomPropertiesDecs = trace(['properties', 'cause']), _startCloudRecordingDecs = trace(['config']), _startLiveStreamingDecs = trace(['data']), _updateLiveStreamingLayoutDecs = trace(['layoutType']), _sendRoomMessageDecs = trace(['payload', 'guaranteedDelivery']), "logger")] = (_initProto(this), createLogger({
71
70
  prefix: 'FcrBaseRoomControlImpl'
72
71
  }));
73
72
  _observable = new AgoraObservable();
@@ -109,7 +108,7 @@ export class FcrBaseRoomControlImpl {
109
108
  if (this._streamControl && !this.sharingControl &&
110
109
  // TODO: 确认是否需要限制在主房间
111
110
  this._roomType === FcrRoomType.Mainroom) {
112
- this.logger.info('[whiteboard]: join scene success, start create sharing control');
111
+ this.logger.info('join scene success, start create sharing control');
113
112
  this.sharingControl = new FcrSharingControlImpl(this._scene, this._api, this._engine, this._privilegeControl, this._streamControl, this._sharedCache, this._userControl);
114
113
  }
115
114
  this._sttControl = new FcrSttControlImpl(this._scene, this._api, this._sharedCache);
@@ -120,7 +119,7 @@ export class FcrBaseRoomControlImpl {
120
119
  // 'onJoinRoomFailure',
121
120
  // sceneId,
122
121
  // generateFcrCoreClientError(
123
- // FcrErrorModuleCode.ROOM,
122
+ // ErrorModuleCode.ROOM,
124
123
  // FcrErrorCode.NOT_JOINED_ROOM,
125
124
  // 'join room failed',
126
125
  // error,
@@ -355,7 +354,9 @@ export class FcrBaseRoomControlImpl {
355
354
 
356
355
  // 处理机器人用户的特殊逻辑
357
356
  await this._handleRobotUserSetup(options);
357
+ return FcrReturnCode.SUCCESS;
358
358
  } catch (error) {
359
+ this._cleanup();
359
360
  // 处理加入失败
360
361
  this._handleJoinFailure(error);
361
362
  throw error;
@@ -418,7 +419,7 @@ export class FcrBaseRoomControlImpl {
418
419
  */
419
420
  async _handleRobotUserSetup(options) {
420
421
  if (options.userRole === FcrUserRole.ROBOT) {
421
- const res = handleRequestError(() => this._api.setCloudRecordingReady(this._scene.sceneId), FcrErrorModuleCode.ROOM, 'set cloud recording ready failed');
422
+ const res = handleRequestError(() => this._api.setCloudRecordingReady(this._scene.sceneId), ErrorModuleCode.FCR_ROOM, 'set cloud recording ready failed');
422
423
  this.logger.info(`set cloud recording ready, response: ${jsonstring(res)}`);
423
424
  }
424
425
  }
@@ -440,6 +441,7 @@ export class FcrBaseRoomControlImpl {
440
441
  async leave() {
441
442
  this._joinState = ROOM_CONTROL_CONSTANTS.JOIN_STATE.CANCELED;
442
443
  await this._cleanup();
444
+ return FcrReturnCode.SUCCESS;
443
445
  }
444
446
 
445
447
  /**
@@ -449,6 +451,7 @@ export class FcrBaseRoomControlImpl {
449
451
  */
450
452
  async start() {
451
453
  await this._api.startRoom(this._scene.sceneId);
454
+ return FcrReturnCode.SUCCESS;
452
455
  }
453
456
 
454
457
  /**
@@ -458,9 +461,11 @@ export class FcrBaseRoomControlImpl {
458
461
  */
459
462
  async end() {
460
463
  await this._api.endRoom(this._scene.sceneId);
464
+ return FcrReturnCode.SUCCESS;
461
465
  }
462
466
  async close() {
463
467
  await this._api.closeRoom(this._scene.sceneId);
468
+ return FcrReturnCode.SUCCESS;
464
469
  }
465
470
  getRoomState() {
466
471
  return this._scene.getScenePropertiesByKeyPath('schedule.state');
@@ -476,33 +481,40 @@ export class FcrBaseRoomControlImpl {
476
481
  roomId: this._scene.sceneId,
477
482
  properties,
478
483
  cause
479
- }), FcrErrorModuleCode.ROOM, 'update room properties failed');
484
+ }), ErrorModuleCode.FCR_ROOM, 'update room properties failed');
485
+ return FcrReturnCode.SUCCESS;
480
486
  }
481
487
  async updateIncrementRoomProperties(increments, cause) {
482
488
  await handleRequestError(() => this._api.updateRoomProperties({
483
489
  roomId: this._scene.sceneId,
484
490
  increments,
485
491
  cause
486
- }), FcrErrorModuleCode.ROOM, 'update room properties failed');
492
+ }), ErrorModuleCode.FCR_ROOM, 'update room properties failed');
493
+ return FcrReturnCode.SUCCESS;
487
494
  }
488
495
  async deleteRoomProperties(properties, cause) {
489
496
  await handleRequestError(() => this._api.deleteRoomProperties({
490
497
  roomId: this._scene.sceneId,
491
498
  properties,
492
499
  cause
493
- }), FcrErrorModuleCode.ROOM, 'delete room rroperties failed');
500
+ }), ErrorModuleCode.FCR_ROOM, 'delete room rroperties failed');
501
+ return FcrReturnCode.SUCCESS;
494
502
  }
495
503
  async startCloudRecording(config) {
496
- await handleRequestError(() => this._api.startCloudRecording(config, this._scene.sceneId), FcrErrorModuleCode.ROOM, 'start cloud recording failed');
504
+ await handleRequestError(() => this._api.startCloudRecording(config, this._scene.sceneId), ErrorModuleCode.FCR_ROOM, 'start cloud recording failed');
505
+ return FcrReturnCode.SUCCESS;
497
506
  }
498
507
  async pauseCloudRecording() {
499
- await handleRequestError(() => this._api.pauseCloudRecording(this._scene.sceneId), FcrErrorModuleCode.ROOM, 'pause cloud recording failed');
508
+ await handleRequestError(() => this._api.pauseCloudRecording(this._scene.sceneId), ErrorModuleCode.FCR_ROOM, 'pause cloud recording failed');
509
+ return FcrReturnCode.SUCCESS;
500
510
  }
501
511
  async resumeCloudRecording() {
502
- await handleRequestError(() => this._api.resumeCloudRecording(this._scene.sceneId), FcrErrorModuleCode.ROOM, 'resume cloud recording failed');
512
+ await handleRequestError(() => this._api.resumeCloudRecording(this._scene.sceneId), ErrorModuleCode.FCR_ROOM, 'resume cloud recording failed');
513
+ return FcrReturnCode.SUCCESS;
503
514
  }
504
515
  async stopCloudRecording() {
505
- await handleRequestError(() => this._api.stopCloudRecording(this._scene.sceneId), FcrErrorModuleCode.ROOM, 'stop cloud recording failed');
516
+ await handleRequestError(() => this._api.stopCloudRecording(this._scene.sceneId), ErrorModuleCode.FCR_ROOM, 'stop cloud recording failed');
517
+ return FcrReturnCode.SUCCESS;
506
518
  }
507
519
  getLiveStreamingState() {
508
520
  let liveStreamingState = this._scene.getScenePropertiesByKeyPath('live.state');
@@ -533,12 +545,15 @@ export class FcrBaseRoomControlImpl {
533
545
  }
534
546
  async startLiveStreaming(data) {
535
547
  await this._liveStreamingAction(() => this._api.startLiveStreaming(this._scene.sceneId, data), 'start live streaming failed');
548
+ return FcrReturnCode.SUCCESS;
536
549
  }
537
550
  async updateLiveStreamingLayout(layoutType) {
538
551
  await this._liveStreamingAction(() => this._api.updateLiveStreamingLayout(this._scene.sceneId, layoutType), 'update live streaming layout failed');
552
+ return FcrReturnCode.SUCCESS;
539
553
  }
540
554
  async stopLiveStreaming() {
541
555
  await this._liveStreamingAction(() => this._api.stopLiveStreaming(this._scene.sceneId), 'stop live streaming failed');
556
+ return FcrReturnCode.SUCCESS;
542
557
  }
543
558
  getCloudRecordingState() {
544
559
  const {
@@ -551,6 +566,7 @@ export class FcrBaseRoomControlImpl {
551
566
  async sendRoomMessage(payload, guaranteedDelivery) {
552
567
  try {
553
568
  await this._scene.localUser.sendSceneMessage(payload, '101', guaranteedDelivery);
569
+ return FcrReturnCode.SUCCESS;
554
570
  } catch (e) {
555
571
  throw roomControlErrorHelper.createSendMessageError(e);
556
572
  }
@@ -568,9 +584,7 @@ export class FcrBaseRoomControlImpl {
568
584
  this._scene.removeObserver(this._sceneObserver);
569
585
  this._engine.removeObserver(this._engineObserver);
570
586
  try {
571
- return await Promise.all([
572
- // @ts-ignore
573
- this._chatRoomControl?.leave(), this.sharingControl?.getBoardControl().close(), this.sharingControl?.getAnnotationControl().close(), this._scene.leave()]);
587
+ return await Promise.all([this._chatRoomControl?.leave(), this.sharingControl?.getBoardControl().close(), this.sharingControl?.getAnnotationControl().close(), this._scene.leave()]);
574
588
  } finally {
575
589
  this._joinRoomSuccess = false;
576
590
  }