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
@@ -15,7 +15,7 @@ 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, _startScreenSharingDecs, _updateScreenSharingDecs;
19
19
  import "core-js/modules/esnext.iterator.constructor.js";
20
20
  import "core-js/modules/esnext.iterator.for-each.js";
21
21
  import "core-js/modules/esnext.iterator.some.js";
@@ -33,11 +33,12 @@ import { FcrWhiteboardControlFactoryImpl } from '../whiteboard-control-v2/whiteb
33
33
  import { FcrAnnotationControlFactoryImpl } from '../whiteboard-control-v2/annotation-control/factory';
34
34
  import { hasAnnotationWritePermission, hasBoardWritePermission } from '../whiteboard-control/utils';
35
35
  import { FcrWidgetCauseCmd, FcrWidgetUuid } from '../type';
36
+ import { FcrBoardPropertiesState } from '../whiteboard-control/type';
36
37
  export class FcrSharingControlImpl {
37
38
  static {
38
- [_initProto] = _applyDecs(this, [[trace, 2, "startScreenSharing"], [trace, 2, "startWhiteboard"], [trace, 2, "updateScreenSharing"], [trace, 2, "stop"], [trace, 2, "getScreenSharingState"]], []).e;
39
+ [_initProto] = _applyDecs(this, [[_startScreenSharingDecs, 2, "startScreenSharing"], [trace, 2, "startWhiteboard"], [_updateScreenSharingDecs, 2, "updateScreenSharing"], [trace, 2, "stop"], [trace, 2, "getScreenSharingState"]], []).e;
39
40
  }
40
- logger = (_initProto(this), createLogger({
41
+ [(_startScreenSharingDecs = trace(['config', 'size', 'labels']), _updateScreenSharingDecs = trace(['enableAnnotation']), "logger")] = (_initProto(this), createLogger({
41
42
  prefix: 'FcrSharingControlImpl'
42
43
  }));
43
44
  _observable = new AgoraObservable();
@@ -147,7 +148,12 @@ export class FcrSharingControlImpl {
147
148
  const hasOperationPrivilege = hasAnnotationWritePermission(permissions);
148
149
  this._annotationControl = new FcrAnnotationControlFactoryImpl().createForMainProcess(
149
150
  // @ts-ignore
150
- this._engine._rtmClient._client, hasOperationPrivilege, annotationConfig, this._api);
151
+ this._engine._rtmClient._client, hasOperationPrivilege, annotationConfig, {
152
+ sceneId: this._scene.sceneId,
153
+ getAnnotationState: () => {
154
+ return this._scene.getScenePropertiesByKeyPath('widgets.annotation.state') ?? FcrBoardPropertiesState.INACTIVE;
155
+ }
156
+ }, this._api);
151
157
  }
152
158
  return this._annotationControl;
153
159
  }
@@ -223,7 +229,7 @@ export class FcrSharingControlImpl {
223
229
  if (this.getScreenSharingState() === FcrScreenSharingState.END) {
224
230
  const isMeSharing = ownerId === this._userControl.getLocalUser().userId;
225
231
  if (isMeSharing) {
226
- this.logger.info('[sharing]: on stream removed, clean before terminal Annotation app');
232
+ this.logger.info('on stream removed, clean before terminal Annotation app');
227
233
  this._annotationControl.getMainWindow()?.clean();
228
234
  }
229
235
  }
@@ -291,11 +297,11 @@ export class FcrSharingControlImpl {
291
297
  }
292
298
  _getScreenShareStreamByUuid() {
293
299
  const screenStreamUuid = this._scene.getScenePropertiesByKeyPath('widgets.annotation.extra.screenStreamUuid');
294
- this.logger.info('[sharing]: scene properties screenStreamUuid: ', screenStreamUuid);
300
+ this.logger.info('scene properties screenStreamUuid: ', screenStreamUuid);
295
301
  const stream = this._streamControl.getStreamByStreamId(screenStreamUuid);
296
302
  return typeof stream === 'undefined' ? null : stream;
297
303
  }
298
304
  _addLogObserver() {
299
- this.addObserver(generateLogObserver(this.logger, ['onScreenSharingUpdated', 'onWhiteboardStarted', 'onWhiteboardEnded']));
305
+ this.addObserver(generateLogObserver(this.logger, [['onScreenSharingUpdated', ['streamInfo', 'state']], ['onWhiteboardStarted', ['ownerId', 'operatorUser']], ['onWhiteboardEnded', ['reason', 'operatorUser']]]));
300
306
  }
301
307
  }
@@ -1,6 +1,6 @@
1
1
  import "core-js/modules/esnext.function.metadata.js";
2
2
  import "core-js/modules/esnext.symbol.metadata.js";
3
- let _initProto, _addLocalStreamsDecs, _bindLocalStreamsDecs, _updatePublishPrivilegeOfStreamsDecs, _removeStreamsDecs, _setVideoEncoderConfigDecs, _setScreenScenarioDecs, _startRenderRemoteVideoStreamDecs, _stopRenderRemoteVideoStreamDecs, _startPlayRemoteAudioStreamDecs, _stopPlayRemoteAudioStreamDecs, _takeSnapshotDecs, _addLocalScreenStreamDecs, _adjustRemoteAudioStreamVolumeDecs, _mergeAudioStreamDecs, _splitAudioStreamDecs;
3
+ let _initProto, _addLocalStreamsDecs, _bindLocalStreamsDecs, _updatePublishPrivilegeOfStreamsDecs, _removeStreamsDecs, _setVideoEncoderConfigDecs, _setDualStreamModeDecs, _setScreenScenarioDecs, _startRenderRemoteVideoStreamDecs, _stopRenderRemoteVideoStreamDecs, _startPlayRemoteAudioStreamDecs, _stopPlayRemoteAudioStreamDecs, _takeSnapshotDecs, _addLocalScreenStreamDecs, _adjustRemoteAudioStreamVolumeDecs, _mergeAudioStreamDecs, _splitAudioStreamDecs;
4
4
  import "core-js/modules/es.array.push.js";
5
5
  import "core-js/modules/es.json.stringify.js";
6
6
  import "core-js/modules/esnext.iterator.constructor.js";
@@ -28,24 +28,25 @@ function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e =
28
28
  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; }
29
29
  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; }
30
30
  import { AgoraObservable, bound, convertStreamTypeToPublishState, objectSchema, trace, AgoraRteVideoSourceType, v4 } from '../../imports';
31
- import { FcrUserRoleToStringMap } from '../../type';
31
+ import { FcrReturnCode, FcrUserRoleToStringMap } from '../../type';
32
32
  import { FcrVideoSourceType, FcrAudioSourceType, FcrMediaSourceState } from '../../type';
33
33
  import { convertRteUserToFcrUser } from '../../utilities/user';
34
- import { FcrErrorModuleCode, handleRequestError } from '../../utilities/error';
34
+ import { handleRequestError } from '../../utilities/error';
35
35
  import { createLogger, generateLogObserver } from '../../utilities/logger';
36
36
  import validateParams from '../../utilities/validate-params';
37
37
  import { stringArraySchema, stringSchema, numberSchema, fcrStreamBindConfigArrySchema, agoraRtcVideoEncoderConfigurationSchema, fcrVideoStreamTypeSchema, fcrRenderConfigSchema, fcrRenderViewSchema, fcrScreenStreamCreateConfigSchema, fcrLocalStreamCreateArrayConfigSchema, fcrUpdateStreamPrivilegeScopeSchema, fcrUpdateStreamCustomSchema, createUnionSchema, fcrSizeSchema, fcrScreenScenarioTypeSchema } from '../../schema';
38
38
  import { AgoraRteStreamPrivilegeOperation } from '../../imports';
39
+ import { ErrorModuleCode } from '../../imports';
39
40
 
40
41
  /**
41
42
  * @internal
42
43
  */
43
44
  export class FcrStreamControlImpl {
44
45
  static {
45
- [_initProto] = _applyDecs(this, [[bound, 2, "getStreams"], [bound, 2, "getStreamList"], [bound, 2, "getStreamsByUserId"], [bound, 2, "getStreamByStreamId"], [_addLocalStreamsDecs, 2, "addLocalStreams"], [_bindLocalStreamsDecs, 2, "bindLocalStreams"], [_updatePublishPrivilegeOfStreamsDecs, 2, "updatePublishPrivilegeOfStreams"], [_removeStreamsDecs, 2, "removeStreams"], [_setVideoEncoderConfigDecs, 2, "setVideoEncoderConfig"], [[bound, trace], 2, "setDualStreamMode"], [_setScreenScenarioDecs, 2, "setScreenScenario"], [_startRenderRemoteVideoStreamDecs, 2, "startRenderRemoteVideoStream"], [_stopRenderRemoteVideoStreamDecs, 2, "stopRenderRemoteVideoStream"], [_startPlayRemoteAudioStreamDecs, 2, "startPlayRemoteAudioStream"], [_stopPlayRemoteAudioStreamDecs, 2, "stopPlayRemoteAudioStream"], [_takeSnapshotDecs, 2, "takeSnapshot"], [_addLocalScreenStreamDecs, 2, "addLocalScreenStream"], [[bound, trace], 2, "removeScreenStream"], [_adjustRemoteAudioStreamVolumeDecs, 2, "adjustRemoteAudioStreamVolume"], [_mergeAudioStreamDecs, 2, "mergeAudioStream"], [_splitAudioStreamDecs, 2, "splitAudioStream"]], []).e;
46
+ [_initProto] = _applyDecs(this, [[bound, 2, "getStreams"], [bound, 2, "getStreamList"], [bound, 2, "getStreamsByUserId"], [bound, 2, "getStreamByStreamId"], [_addLocalStreamsDecs, 2, "addLocalStreams"], [_bindLocalStreamsDecs, 2, "bindLocalStreams"], [_updatePublishPrivilegeOfStreamsDecs, 2, "updatePublishPrivilegeOfStreams"], [_removeStreamsDecs, 2, "removeStreams"], [_setVideoEncoderConfigDecs, 2, "setVideoEncoderConfig"], [_setDualStreamModeDecs, 2, "setDualStreamMode"], [_setScreenScenarioDecs, 2, "setScreenScenario"], [_startRenderRemoteVideoStreamDecs, 2, "startRenderRemoteVideoStream"], [_stopRenderRemoteVideoStreamDecs, 2, "stopRenderRemoteVideoStream"], [_startPlayRemoteAudioStreamDecs, 2, "startPlayRemoteAudioStream"], [_stopPlayRemoteAudioStreamDecs, 2, "stopPlayRemoteAudioStream"], [_takeSnapshotDecs, 2, "takeSnapshot"], [_addLocalScreenStreamDecs, 2, "addLocalScreenStream"], [[bound, trace], 2, "removeScreenStream"], [_adjustRemoteAudioStreamVolumeDecs, 2, "adjustRemoteAudioStreamVolume"], [_mergeAudioStreamDecs, 2, "mergeAudioStream"], [_splitAudioStreamDecs, 2, "splitAudioStream"]], []).e;
46
47
  }
47
48
  //@internal
48
- [(_addLocalStreamsDecs = [bound, trace, validateParams(fcrLocalStreamCreateArrayConfigSchema)], _bindLocalStreamsDecs = [bound, trace, validateParams(fcrStreamBindConfigArrySchema)], _updatePublishPrivilegeOfStreamsDecs = [bound, trace, validateParams(fcrUpdateStreamCustomSchema, fcrUpdateStreamPrivilegeScopeSchema.optional())], _removeStreamsDecs = [bound, trace, validateParams(stringArraySchema)], _setVideoEncoderConfigDecs = [bound, trace, validateParams(stringSchema, agoraRtcVideoEncoderConfigurationSchema, fcrVideoStreamTypeSchema)], _setScreenScenarioDecs = [bound, trace, validateParams(fcrScreenScenarioTypeSchema)], _startRenderRemoteVideoStreamDecs = [bound, trace, validateParams(stringSchema, fcrVideoStreamTypeSchema, fcrRenderConfigSchema, createUnionSchema([fcrRenderViewSchema, objectSchema]))], _stopRenderRemoteVideoStreamDecs = [bound, trace, validateParams(stringSchema, fcrRenderViewSchema)], _startPlayRemoteAudioStreamDecs = [bound, trace, validateParams(stringSchema)], _stopPlayRemoteAudioStreamDecs = [bound, trace, validateParams(stringSchema)], _takeSnapshotDecs = [bound, trace, validateParams(stringSchema, stringSchema)], _addLocalScreenStreamDecs = [bound, trace, validateParams(fcrScreenStreamCreateConfigSchema, fcrSizeSchema)], _adjustRemoteAudioStreamVolumeDecs = [bound, trace, validateParams(stringSchema, numberSchema)], _mergeAudioStreamDecs = [bound, trace, validateParams(stringSchema)], _splitAudioStreamDecs = [bound, trace, validateParams(stringSchema)], "logger")] = (_initProto(this), createLogger({
49
+ [(_addLocalStreamsDecs = [bound, trace(['streams']), validateParams(fcrLocalStreamCreateArrayConfigSchema)], _bindLocalStreamsDecs = [bound, trace(['streams']), validateParams(fcrStreamBindConfigArrySchema)], _updatePublishPrivilegeOfStreamsDecs = [bound, trace, validateParams(fcrUpdateStreamCustomSchema, fcrUpdateStreamPrivilegeScopeSchema.optional())], _removeStreamsDecs = [bound, trace(['streams']), validateParams(stringArraySchema)], _setVideoEncoderConfigDecs = [bound, trace(['streamId', 'config', 'streamType']), validateParams(stringSchema, agoraRtcVideoEncoderConfigurationSchema, fcrVideoStreamTypeSchema)], _setDualStreamModeDecs = [bound, trace(['streamId', 'enable'])], _setScreenScenarioDecs = [bound, trace(['type']), validateParams(fcrScreenScenarioTypeSchema)], _startRenderRemoteVideoStreamDecs = [bound, trace(['streamId', 'type', 'config', 'element']), validateParams(stringSchema, fcrVideoStreamTypeSchema, fcrRenderConfigSchema, createUnionSchema([fcrRenderViewSchema, objectSchema]))], _stopRenderRemoteVideoStreamDecs = [bound, trace(['streamId', 'element']), validateParams(stringSchema, fcrRenderViewSchema)], _startPlayRemoteAudioStreamDecs = [bound, trace(['streamId']), validateParams(stringSchema)], _stopPlayRemoteAudioStreamDecs = [bound, trace(['streamId']), validateParams(stringSchema)], _takeSnapshotDecs = [bound, trace(['streamId', 'filePath']), validateParams(stringSchema, stringSchema)], _addLocalScreenStreamDecs = [bound, trace(['config', 'size']), validateParams(fcrScreenStreamCreateConfigSchema, fcrSizeSchema)], _adjustRemoteAudioStreamVolumeDecs = [bound, trace(['streamId', 'volume']), validateParams(stringSchema, numberSchema)], _mergeAudioStreamDecs = [bound, trace(['targetUserId']), validateParams(stringSchema)], _splitAudioStreamDecs = [bound, trace(['userId']), validateParams(stringSchema)], "logger")] = (_initProto(this), createLogger({
49
50
  prefix: 'FcrStreamControlImpl'
50
51
  }));
51
52
  //@internal
@@ -187,7 +188,7 @@ export class FcrStreamControlImpl {
187
188
  videoSourceUuid: config.videoSourceId,
188
189
  audioSourceUuid: config.audioSourceId,
189
190
  ...convertStreamTypeToPublishState(config.streamType)
190
- }))), FcrErrorModuleCode.ROOM_STREAM, 'add local streams failed');
191
+ }))), ErrorModuleCode.FCR_ROOM_STREAM, 'add local streams failed');
191
192
 
192
193
  // 处理需要 token 的流
193
194
  this._handleStreamTokensPreparation(streams, streamCreateResult.data);
@@ -230,7 +231,7 @@ export class FcrStreamControlImpl {
230
231
  streamUuid: streamId,
231
232
  audioState: this._getPublishStateByPrivilege(privileges[streamId].audioPrivilege),
232
233
  videoState: this._getPublishStateByPrivilege(privileges[streamId].videoPrivilege)
233
- }))), FcrErrorModuleCode.ROOM_STREAM, 'update publish privilege of streams failed');
234
+ }))), ErrorModuleCode.FCR_ROOM_STREAM, 'update publish privilege of streams failed');
234
235
  } else if (args.length === 2) {
235
236
  const [privilege, scope] = args;
236
237
  const targetRteRoles = scope.targetRoleType.map(role => FcrUserRoleToStringMap[role]);
@@ -254,13 +255,13 @@ export class FcrStreamControlImpl {
254
255
  videoState,
255
256
  audioState,
256
257
  condition
257
- }), FcrErrorModuleCode.ROOM_STREAM, 'update publish privilege of streams failed');
258
+ }), ErrorModuleCode.FCR_ROOM_STREAM, 'update publish privilege of streams failed');
258
259
  }
259
260
  }
260
261
  async removeStreams(streams) {
261
262
  const res = await handleRequestError(() => this._api.deleteStreamBatch(this._scene.sceneId, streams.map(streamUuid => ({
262
263
  streamUuid
263
- }))), FcrErrorModuleCode.ROOM_STREAM, 'remove streams failed');
264
+ }))), ErrorModuleCode.FCR_ROOM_STREAM, 'remove streams failed');
264
265
  streams.forEach(streamUuid => {
265
266
  this._scene.localUser.removePreparePublishStream(streamUuid);
266
267
  });
@@ -283,6 +284,7 @@ export class FcrStreamControlImpl {
283
284
  this._scene.streamPlayer.startRenderRemoteVideoStream(streamId, config.renderMode, config.isMirror, element);
284
285
  const viewId = this._subscribedStreamsControl.getViewId(element);
285
286
  this._subscribedStreamsControl.bind(viewId, streamId);
287
+ return FcrReturnCode.SUCCESS;
286
288
  } catch (error) {
287
289
  this.logger.error(`[FcrStreamControl][start-render-remote-video-stream] render failed, streamId: ${streamId}, error: ${error}, parameters: ${parameters}, duration: ${Date.now() - startTime}ms`);
288
290
  throw error;
@@ -301,16 +303,17 @@ export class FcrStreamControlImpl {
301
303
  } else {
302
304
  this.logger.info(`[FcrStreamControl][unsubscribe-remote-video-stream] still has other views, do not unsubscribe, streamId: ${streamId}, parameters: ${parameters}, duration: ${Date.now() - startTime}ms`);
303
305
  }
306
+ return FcrReturnCode.SUCCESS;
304
307
  } catch (error) {
305
308
  this.logger.error(`[FcrStreamControl][stop-render-remote-video-stream] stop render failed, streamId: ${streamId}, error: ${error}, parameters: ${parameters}, duration: ${Date.now() - startTime}ms`);
306
309
  throw error;
307
310
  }
308
311
  }
309
312
  startPlayRemoteAudioStream(streamId) {
310
- this._scene.streamPlayer.startPlayRemoteAudioStream(streamId);
313
+ return this._scene.streamPlayer.startPlayRemoteAudioStream(streamId);
311
314
  }
312
315
  stopPlayRemoteAudioStream(streamId) {
313
- this._scene.streamPlayer.stopPlayRemoteAudioStream(streamId);
316
+ return this._scene.streamPlayer.stopPlayRemoteAudioStream(streamId);
314
317
  }
315
318
  takeSnapshot(streamId, filePath) {
316
319
  return this._scene.streamPlayer.takeSnapshot(streamId, filePath);
@@ -339,7 +342,7 @@ export class FcrStreamControlImpl {
339
342
  }
340
343
  }
341
344
  }
342
- }), FcrErrorModuleCode.ROOM_STREAM, 'add local screen stream failed');
345
+ }), ErrorModuleCode.FCR_ROOM_STREAM, 'add local screen stream failed');
343
346
  const {
344
347
  data: {
345
348
  rtcToken: token,
@@ -360,7 +363,7 @@ export class FcrStreamControlImpl {
360
363
  roomId: this._scene.sceneId,
361
364
  userId: this._scene.localUser.getLocalUserId()
362
365
  });
363
- }, FcrErrorModuleCode.ROOM_STREAM, 'remove screen stream failed');
366
+ }, ErrorModuleCode.FCR_ROOM_STREAM, 'remove screen stream failed');
364
367
  if (this._screenStreamId) {
365
368
  this._scene.removeLocalStreamLabel(this._screenStreamId);
366
369
  this._scene.localUser.removePreparePublishStream(this._screenStreamId);
@@ -368,17 +371,17 @@ export class FcrStreamControlImpl {
368
371
  return res;
369
372
  }
370
373
  adjustRemoteAudioStreamVolume(streamId, volume) {
371
- this._scene.streamPlayer.adjustRemoteAudioStreamVolume(streamId, volume);
374
+ return this._scene.streamPlayer.adjustRemoteAudioStreamVolume(streamId, volume);
372
375
  }
373
376
  mergeAudioStream(targetUserId) {
374
377
  return handleRequestError(() => this._api.mergeAudioStream(targetUserId, {
375
378
  roomId: this._scene.sceneId
376
- }), FcrErrorModuleCode.ROOM_STREAM, 'merge audio stream failed');
379
+ }), ErrorModuleCode.FCR_ROOM_STREAM, 'merge audio stream failed');
377
380
  }
378
381
  splitAudioStream(userId) {
379
382
  return handleRequestError(() => this._api.splitAudioStream(userId, {
380
383
  roomId: this._scene.sceneId
381
- }), FcrErrorModuleCode.ROOM_STREAM, 'split audio stream failed');
384
+ }), ErrorModuleCode.FCR_ROOM_STREAM, 'split audio stream failed');
382
385
  }
383
386
 
384
387
  // @bound
@@ -463,9 +466,9 @@ export class FcrStreamControlImpl {
463
466
  // 'onLocalAudioStatsUpdated',
464
467
  // 'onRemoteVideoStatsUpdated',
465
468
  // 'onRemoteAudioStatsUpdated',
466
- 'onFirstRemoteVideoFrameRendered',
469
+ ['onFirstRemoteVideoFrameRendered', ['roomId', 'streamId']],
467
470
  // 'onStreamVolumeIndicationUpdated',
468
- 'onStreamsAdded', 'onStreamsRemoved', 'onStreamsUpdated']));
471
+ ['onStreamsAdded', ['roomId', 'events']], ['onStreamsRemoved', ['roomId', 'events']], ['onStreamsUpdated', ['roomId', 'events']]]));
469
472
  }
470
473
  }
471
474
  export class FcrSubscribedStreamsControl {
@@ -2,6 +2,7 @@ import "core-js/modules/esnext.function.metadata.js";
2
2
  import "core-js/modules/esnext.symbol.metadata.js";
3
3
  let _initProto, _startCaptionDecs, _startTranscribingDecs, _updateSourceLanguageDecs, _subscribeTranscribingLanguageDecs;
4
4
  import "core-js/modules/es.array.push.js";
5
+ import "core-js/modules/es.json.stringify.js";
5
6
  import "core-js/modules/esnext.iterator.constructor.js";
6
7
  import "core-js/modules/esnext.iterator.filter.js";
7
8
  import "core-js/modules/esnext.iterator.map.js";
@@ -24,15 +25,16 @@ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol"
24
25
  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); }
25
26
  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; }
26
27
  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; }
27
- import { AgoraObservable, trace, deCompressGzipToJson, merge } from '../../imports';
28
+ import { ErrorModuleCode } from '../../imports';
29
+ import { AgoraObservable, deCompressGzipToJson, merge, trace } from '../../imports';
30
+ import { fcrLanguageConfigSchema, fcrLanguageSchema } from '../../schema';
31
+ import { FcrLanguage, FcrReturnCode } from '../../type';
32
+ import { handleRequestError } from '../../utilities/error';
28
33
  import { createLogger, generateLogObserver } from '../../utilities/logger';
29
- import { fcrLanguageSchema, fcrLanguageConfigSchema } from '../../schema';
30
- import { FcrCaptionState, FcrTranscribingState } from './type';
31
- import { FcrErrorModuleCode, handleRequestError } from '../../utilities/error';
32
- import { FcrLanguage } from '../../type';
33
- import validateParams from '../../utilities/validate-params';
34
34
  import { convertRteUserToFcrUser } from '../../utilities/user';
35
+ import validateParams from '../../utilities/validate-params';
35
36
  import { FcrWidgetCauseCmd, FcrWidgetUuid } from '../type';
37
+ import { FcrCaptionState, FcrTranscribingState } from './type';
36
38
  /**
37
39
  * @internal
38
40
  */
@@ -41,7 +43,7 @@ export class FcrSttControlImpl {
41
43
  [_initProto] = _applyDecs(this, [[_startCaptionDecs, 2, "startCaption"], [trace, 2, "stopCaption"], [_startTranscribingDecs, 2, "startTranscribing"], [trace, 2, "stopTranscribing"], [_updateSourceLanguageDecs, 2, "updateSourceLanguage"], [_subscribeTranscribingLanguageDecs, 2, "subscribeTranscribingLanguage"], [trace, 2, "unsubscribeTranscribingLanguage"], [trace, 2, "release"]], []).e;
42
44
  }
43
45
  //@internal
44
- [(_startCaptionDecs = [trace, validateParams(fcrLanguageConfigSchema)], _startTranscribingDecs = [trace, validateParams(fcrLanguageConfigSchema)], _updateSourceLanguageDecs = [trace, validateParams(fcrLanguageSchema)], _subscribeTranscribingLanguageDecs = [trace, validateParams(fcrLanguageSchema)], "logger")] = (_initProto(this), createLogger({
46
+ [(_startCaptionDecs = [trace(['config']), validateParams(fcrLanguageConfigSchema)], _startTranscribingDecs = [trace(['config']), validateParams(fcrLanguageConfigSchema)], _updateSourceLanguageDecs = [trace(['language']), validateParams(fcrLanguageSchema)], _subscribeTranscribingLanguageDecs = [trace, validateParams(fcrLanguageSchema)], "logger")] = (_initProto(this), createLogger({
45
47
  prefix: 'FcrUserControlImpl'
46
48
  }));
47
49
 
@@ -57,11 +59,16 @@ export class FcrSttControlImpl {
57
59
  _sceneObserver = {
58
60
  onStreamMessageReceived: async (sceneId, data) => {
59
61
  const sttUids = this._scene.getScenePropertiesByKeyPath('widgets.stt.extra.pubBotUids');
62
+ if (!Array.isArray(sttUids)) {
63
+ this.logger.error('sttUids is not an array');
64
+ return;
65
+ }
60
66
  const isSttBot = sttUids.includes(Number(data.streamId));
61
67
  if (!isSttBot) {
62
68
  return;
63
69
  }
64
70
  const sttStreamMessageData = await deCompressGzipToJson(data.payload);
71
+ this.logger.info('onStreamMessageReceived sttStreamMessageData: ', JSON.stringify(sttStreamMessageData));
65
72
  this._handleSttStreamMessageData(sttStreamMessageData, sceneId);
66
73
  },
67
74
  onUserPropertiesUpdated: (sceneId, event) => {
@@ -130,46 +137,46 @@ export class FcrSttControlImpl {
130
137
  roomUuid: this._scene.sceneId,
131
138
  userUuid: this._scene.localUser.getLocalUserId(),
132
139
  config
133
- }), FcrErrorModuleCode.ROOM_STT, 'start caption failed');
140
+ }), ErrorModuleCode.FCR_ROOM_STT, 'start caption failed');
134
141
  }
135
142
  stopCaption() {
136
143
  return handleRequestError(() => this._api.stopCaption({
137
144
  roomUuid: this._scene.sceneId,
138
145
  userUuid: this._scene.localUser.getLocalUserId()
139
- }), FcrErrorModuleCode.ROOM_STT, 'stop caption failed');
146
+ }), ErrorModuleCode.FCR_ROOM_STT, 'stop caption failed');
140
147
  }
141
148
  startTranscribing(config) {
142
149
  return handleRequestError(() => this._api.startTranscribing({
143
150
  roomUuid: this._scene.sceneId,
144
151
  userUuid: this._scene.localUser.getLocalUserId(),
145
152
  config
146
- }), FcrErrorModuleCode.ROOM_STT, 'start transcribing failed');
153
+ }), ErrorModuleCode.FCR_ROOM_STT, 'start transcribing failed');
147
154
  }
148
155
  stopTranscribing() {
149
156
  return handleRequestError(() => this._api.stopTranscribing({
150
157
  roomUuid: this._scene.sceneId,
151
158
  userUuid: this._scene.localUser.getLocalUserId()
152
- }), FcrErrorModuleCode.ROOM_STT, 'stop transcribing failed');
159
+ }), ErrorModuleCode.FCR_ROOM_STT, 'stop transcribing failed');
153
160
  }
154
161
  updateSourceLanguage(language) {
155
162
  return handleRequestError(() => this._api.updateSourceLanguage({
156
163
  roomUuid: this._scene.sceneId,
157
164
  userUuid: this._scene.localUser.getLocalUserId(),
158
165
  language
159
- }), FcrErrorModuleCode.ROOM_STT, 'update source language failed');
166
+ }), ErrorModuleCode.FCR_ROOM_STT, 'update source language failed');
160
167
  }
161
168
  subscribeTranscribingLanguage(language) {
162
169
  return handleRequestError(() => this._api.subscribeTranscribingLanguage({
163
170
  roomUuid: this._scene.sceneId,
164
171
  userUuid: this._scene.localUser.getLocalUserId(),
165
172
  language
166
- }), FcrErrorModuleCode.ROOM_STT, 'subscribe transcribing language failed');
173
+ }), ErrorModuleCode.FCR_ROOM_STT, 'subscribe transcribing language failed');
167
174
  }
168
175
  unsubscribeTranscribingLanguage() {
169
176
  return handleRequestError(() => this._api.unsubscribeTranscribingLanguage({
170
177
  roomUuid: this._scene.sceneId,
171
178
  userUuid: this._scene.localUser.getLocalUserId()
172
- }), FcrErrorModuleCode.ROOM_STT, 'unsubscribe transcribing language failed');
179
+ }), ErrorModuleCode.FCR_ROOM_STT, 'unsubscribe transcribing language failed');
173
180
  }
174
181
  getLocalCaptionState() {
175
182
  return this._getLocalCaptionState();
@@ -206,6 +213,7 @@ export class FcrSttControlImpl {
206
213
  release() {
207
214
  this._sttEventWrapperListMap.clear();
208
215
  this._scene.removeObserver(this._sceneObserver);
216
+ return FcrReturnCode.SUCCESS;
209
217
  }
210
218
  _getLocalCaptionState() {
211
219
  const captionState = this._scene.getUserPropertiesByKeyPath('widgets.stt.caption', this._scene.localUser.getLocalUserId());
@@ -337,6 +345,6 @@ export class FcrSttControlImpl {
337
345
  }
338
346
  }
339
347
  _addLogObserver() {
340
- this.addObserver(generateLogObserver(this.logger, ['onSttEventReceived', 'onLocalCaptionStateUpdated', 'onTranscribingStateUpdated', 'onSourceLanguageUpdated']));
348
+ this.addObserver(generateLogObserver(this.logger, [['onSttEventReceived', ['roomId', 'event']], ['onLocalCaptionStateUpdated', ['roomId', 'state', 'operatorUser']], ['onTranscribingStateUpdated', ['roomId', 'state', 'operatorUser']], ['onSourceLanguageUpdated', ['roomId', 'operatorUser']]]));
341
349
  }
342
350
  }
@@ -14,7 +14,7 @@ import "core-js/modules/esnext.map.reduce.js";
14
14
  import "core-js/modules/esnext.map.some.js";
15
15
  import "core-js/modules/esnext.map.update.js";
16
16
  import "core-js/modules/esnext.symbol.metadata.js";
17
- let _initProto, _getUserDecs, _updateUserNameDecs, _updateUserPropertiesDecs, _updateIncrementUserPropertiesDecs, _deleteUserPropertiesDecs, _getUserPropertiesByUserIdDecs, _getUserPropertiesByKeyPathDecs, _updateRemoteUserRoleDecs, _claimHostDecs, _kickOutDecs, _kickOutByUserIdsDecs, _kickOutByUserRolesDecs, _mergeAudioStreamDecs;
17
+ let _initProto, _getUserDecs, _fetchUserListDecs, _updateUserNameDecs, _updateUserPropertiesDecs, _updateIncrementUserPropertiesDecs, _deleteUserPropertiesDecs, _getUserPropertiesByUserIdDecs, _getUserPropertiesByKeyPathDecs, _updateRemoteUserRoleDecs, _claimHostDecs, _kickOutDecs, _kickOutByUserIdsDecs, _kickOutByUserRolesDecs, _mergeAudioStreamDecs;
18
18
  import "core-js/modules/es.array.push.js";
19
19
  import "core-js/modules/esnext.iterator.constructor.js";
20
20
  import "core-js/modules/esnext.iterator.find.js";
@@ -34,18 +34,20 @@ import { FcrUserKickedOutType, FcrUserLeftReason } from './type';
34
34
  import { bound } from '../../imports';
35
35
  import { convertToStructure } from '../../utilities/collection';
36
36
  import { createLogger, generateLogObserver } from '../../utilities/logger';
37
- import { FcrErrorModuleCode, handleRequestError } from '../../utilities/error';
37
+ import { handleRequestError } from '../../utilities/error';
38
38
  import validateParams from '../../utilities/validate-params';
39
39
  import { fcrUserKickedOutTypeSchema, fcrUserRolesSchema, stringKeyUnknownValueSchema, stringSchema, stringArraySchema, fcrUserRoleSchema, stringKeyNumberValueSchema } from '../../schema';
40
+ import { ErrorModuleCode } from '../../imports';
41
+
40
42
  /**
41
43
  * @internal
42
44
  */
43
45
  export class FcrUserControlImpl {
44
46
  static {
45
- [_initProto] = _applyDecs(this, [[bound, 2, "getLocalUser"], [bound, 2, "getUsers"], [bound, 2, "getUserList"], [_getUserDecs, 2, "getUser"], [[bound, trace], 2, "getAllUserCount"], [bound, 2, "getWaterMarkContent"], [[bound, trace], 2, "fetchUserList"], [_updateUserNameDecs, 2, "updateUserName"], [_updateUserPropertiesDecs, 2, "updateUserProperties"], [_updateIncrementUserPropertiesDecs, 2, "updateIncrementUserProperties"], [_deleteUserPropertiesDecs, 2, "deleteUserProperties"], [[bound, trace], 2, "getUserProperties"], [_getUserPropertiesByUserIdDecs, 2, "getUserPropertiesByUserId"], [_getUserPropertiesByKeyPathDecs, 2, "getUserPropertiesByKeyPath"], [_updateRemoteUserRoleDecs, 2, "updateRemoteUserRole"], [[bound, trace], 2, "revokeHost"], [_claimHostDecs, 2, "claimHost"], [_kickOutDecs, 2, "kickOut"], [_kickOutByUserIdsDecs, 2, "kickOutByUserIds"], [_kickOutByUserRolesDecs, 2, "kickOutByUserRoles"], [_mergeAudioStreamDecs, 2, "mergeAudioStream"]], []).e;
47
+ [_initProto] = _applyDecs(this, [[bound, 2, "getLocalUser"], [bound, 2, "getUsers"], [bound, 2, "getUserList"], [_getUserDecs, 2, "getUser"], [[bound, trace], 2, "getAllUserCount"], [bound, 2, "getWaterMarkContent"], [_fetchUserListDecs, 2, "fetchUserList"], [_updateUserNameDecs, 2, "updateUserName"], [_updateUserPropertiesDecs, 2, "updateUserProperties"], [_updateIncrementUserPropertiesDecs, 2, "updateIncrementUserProperties"], [_deleteUserPropertiesDecs, 2, "deleteUserProperties"], [[bound, trace], 2, "getUserProperties"], [_getUserPropertiesByUserIdDecs, 2, "getUserPropertiesByUserId"], [_getUserPropertiesByKeyPathDecs, 2, "getUserPropertiesByKeyPath"], [_updateRemoteUserRoleDecs, 2, "updateRemoteUserRole"], [[bound, trace], 2, "revokeHost"], [_claimHostDecs, 2, "claimHost"], [_kickOutDecs, 2, "kickOut"], [_kickOutByUserIdsDecs, 2, "kickOutByUserIds"], [_kickOutByUserRolesDecs, 2, "kickOutByUserRoles"], [_mergeAudioStreamDecs, 2, "mergeAudioStream"]], []).e;
46
48
  }
47
49
  //@internal
48
- [(_getUserDecs = [bound, validateParams(stringSchema)], _updateUserNameDecs = [bound, trace, validateParams(stringSchema, stringSchema)], _updateUserPropertiesDecs = [bound, trace, validateParams(stringKeyUnknownValueSchema, stringKeyUnknownValueSchema, stringSchema)], _updateIncrementUserPropertiesDecs = [bound, trace, validateParams(stringKeyNumberValueSchema, stringKeyUnknownValueSchema, stringSchema)], _deleteUserPropertiesDecs = [bound, trace, validateParams(stringArraySchema, stringKeyUnknownValueSchema, stringSchema)], _getUserPropertiesByUserIdDecs = [bound, trace, validateParams(stringSchema)], _getUserPropertiesByKeyPathDecs = [bound, trace, validateParams(stringSchema, stringSchema)], _updateRemoteUserRoleDecs = [bound, trace, validateParams(stringSchema, fcrUserRoleSchema)], _claimHostDecs = [bound, trace, validateParams(stringSchema)], _kickOutDecs = [bound, trace, validateParams(stringSchema, fcrUserKickedOutTypeSchema)], _kickOutByUserIdsDecs = [trace, validateParams(stringArraySchema, fcrUserKickedOutTypeSchema)], _kickOutByUserRolesDecs = [trace, validateParams(fcrUserRolesSchema, fcrUserKickedOutTypeSchema)], _mergeAudioStreamDecs = [trace, validateParams(stringSchema)], "logger")] = (_initProto(this), createLogger({
50
+ [(_getUserDecs = [bound, validateParams(stringSchema)], _fetchUserListDecs = [bound, trace(['params'])], _updateUserNameDecs = [bound, trace(['userId', 'userName']), validateParams(stringSchema, stringSchema)], _updateUserPropertiesDecs = [bound, trace(['properties', 'cause', 'userId']), validateParams(stringKeyUnknownValueSchema, stringKeyUnknownValueSchema, stringSchema)], _updateIncrementUserPropertiesDecs = [bound, trace(['increments', 'cause', 'userId']), validateParams(stringKeyNumberValueSchema, stringKeyUnknownValueSchema, stringSchema)], _deleteUserPropertiesDecs = [bound, trace(['keyPath', 'cause', 'userId']), validateParams(stringArraySchema, stringKeyUnknownValueSchema, stringSchema)], _getUserPropertiesByUserIdDecs = [bound, trace(['userId']), validateParams(stringSchema)], _getUserPropertiesByKeyPathDecs = [bound, trace(['keyPath', 'userId']), validateParams(stringSchema, stringSchema)], _updateRemoteUserRoleDecs = [bound, trace(['userId', 'userRole']), validateParams(stringSchema, fcrUserRoleSchema)], _claimHostDecs = [bound, trace(['hostKey']), validateParams(stringSchema)], _kickOutDecs = [bound, trace(['userId', 'type']), validateParams(stringSchema, fcrUserKickedOutTypeSchema)], _kickOutByUserIdsDecs = [trace(['userIds', 'type']), validateParams(stringArraySchema, fcrUserKickedOutTypeSchema)], _kickOutByUserRolesDecs = [trace(['userRoles', 'type']), validateParams(fcrUserRolesSchema, fcrUserKickedOutTypeSchema)], _mergeAudioStreamDecs = [trace(['userId']), validateParams(stringSchema)], "logger")] = (_initProto(this), createLogger({
49
51
  prefix: 'FcrUserControlImpl'
50
52
  }));
51
53
  //@internal
@@ -242,7 +244,7 @@ export class FcrUserControlImpl {
242
244
  roomId: this._scene.sceneId,
243
245
  userId,
244
246
  userName
245
- }), FcrErrorModuleCode.ROOM_USER, 'update user name failed');
247
+ }), ErrorModuleCode.FCR_ROOM_USER, 'update user name failed');
246
248
  }
247
249
  updateUserProperties(properties, cause, userId) {
248
250
  return handleRequestError(() => this._api.updateUserProperties({
@@ -250,7 +252,7 @@ export class FcrUserControlImpl {
250
252
  userUuid: userId,
251
253
  properties,
252
254
  cause
253
- }), FcrErrorModuleCode.ROOM_USER, 'update user properties failed');
255
+ }), ErrorModuleCode.FCR_ROOM_USER, 'update user properties failed');
254
256
  }
255
257
  updateIncrementUserProperties(increments, cause, userId) {
256
258
  return handleRequestError(() => this._api.updateUserProperties({
@@ -258,15 +260,15 @@ export class FcrUserControlImpl {
258
260
  userUuid: userId,
259
261
  increments,
260
262
  cause
261
- }), FcrErrorModuleCode.ROOM_USER, 'update increment user properties failed');
263
+ }), ErrorModuleCode.FCR_ROOM_USER, 'update increment user properties failed');
262
264
  }
263
265
  async deleteUserProperties(keyPath, cause, userId) {
264
- await handleRequestError(() => this._api.deleteUserProperties({
266
+ return handleRequestError(() => this._api.deleteUserProperties({
265
267
  roomId: this._scene.sceneId,
266
268
  userUuid: userId,
267
269
  properties: keyPath,
268
270
  cause
269
- }), FcrErrorModuleCode.ROOM_USER, 'delete user properties failed');
271
+ }), ErrorModuleCode.FCR_ROOM_USER, 'delete user properties failed');
270
272
  }
271
273
  getUserProperties() {
272
274
  const userProperties = this._scene.getUserProperties();
@@ -283,23 +285,21 @@ export class FcrUserControlImpl {
283
285
  return this._scene.getUserPropertiesByKeyPath('flexProps.' + keyPath, userId);
284
286
  }
285
287
  async updateRemoteUserRole(userId, userRole) {
286
- await handleRequestError(() => this._api.updateUserRole({
288
+ return handleRequestError(() => this._api.updateUserRole({
287
289
  roomId: this._scene.sceneId,
288
290
  userId,
289
291
  localRole: userRole === FcrUserRole.HOST ? FcrUserRoleToStringMap[FcrUserRole.PARTICIPANT] : undefined,
290
292
  remoteRole: FcrUserRoleToStringMap[userRole]
291
- }), FcrErrorModuleCode.ROOM_USER, 'update remote user role failed');
293
+ }), ErrorModuleCode.FCR_ROOM_USER, 'update remote user role failed');
292
294
  }
293
295
  async revokeHost() {
294
296
  const userList = this.getUserList();
295
297
  const originHostUser = userList.find(user => user.userRole === FcrUserRole.HOST);
296
298
  if (originHostUser) {
297
- await handleRequestError(() => this._api.revokeUserRole({
299
+ return handleRequestError(() => this._api.revokeUserRole({
298
300
  roomId: this._scene.sceneId,
299
- localRole: FcrUserRoleToStringMap[FcrUserRole.HOST],
300
- remoteRole: FcrUserRoleToStringMap[FcrUserRole.PARTICIPANT],
301
- userId: originHostUser?.userId
302
- }), FcrErrorModuleCode.ROOM_USER, 'revoke host failed');
301
+ remoteRole: FcrUserRoleToStringMap[FcrUserRole.PARTICIPANT]
302
+ }), ErrorModuleCode.FCR_ROOM_USER, 'revoke host failed');
303
303
  }
304
304
  }
305
305
  async claimHost(hostKey) {
@@ -310,27 +310,27 @@ export class FcrUserControlImpl {
310
310
  roomId: this._scene.sceneId,
311
311
  hostKey,
312
312
  userId
313
- }), FcrErrorModuleCode.ROOM_USER, 'claim host by ticket failed');
313
+ }), ErrorModuleCode.FCR_ROOM_USER, 'claim host by ticket failed');
314
314
  }
315
315
  async kickOut(userId, type) {
316
- await handleRequestError(() => this._api.kickOut(userId, type, {
316
+ return handleRequestError(() => this._api.kickOut(userId, type, {
317
317
  roomId: this._scene.sceneId
318
- }), FcrErrorModuleCode.ROOM_USER, 'kick out failed');
318
+ }), ErrorModuleCode.FCR_ROOM_USER, 'kick out failed');
319
319
  }
320
320
  async kickOutByUserIds(userIds, type) {
321
321
  return handleRequestError(() => this._api.kickOutByUserIds(userIds, type, {
322
322
  roomId: this._scene.sceneId
323
- }), FcrErrorModuleCode.ROOM_USER, 'kick out by user ids failed');
323
+ }), ErrorModuleCode.FCR_ROOM_USER, 'kick out by user ids failed');
324
324
  }
325
325
  async kickOutByUserRoles(userRoles, type) {
326
326
  return handleRequestError(() => this._api.kickOutByUserRoles(type, {
327
327
  roomId: this._scene.sceneId
328
- }, userRoles.map(role => FcrUserRoleToStringMap[role])), FcrErrorModuleCode.ROOM_USER, 'kick out by user roles failed');
328
+ }, userRoles.map(role => FcrUserRoleToStringMap[role])), ErrorModuleCode.FCR_ROOM_USER, 'kick out by user roles failed');
329
329
  }
330
330
  mergeAudioStream(userId) {
331
331
  return handleRequestError(() => this._api.mergeAudioStream(userId, {
332
332
  roomId: this._scene.sceneId
333
- }), FcrErrorModuleCode.ROOM_USER, 'merge audio stream failed');
333
+ }), ErrorModuleCode.FCR_ROOM_USER, 'merge audio stream failed');
334
334
  }
335
335
  addObserver(observer) {
336
336
  this._observable.addObserver(observer);
@@ -339,6 +339,6 @@ export class FcrUserControlImpl {
339
339
  this._observable.removeObserver(observer);
340
340
  }
341
341
  _addLogObserver() {
342
- this.addObserver(generateLogObserver(this.logger, ['onRemoteUsersJoined', 'onRemoteUsersLeft', 'onUserInfoUpdated', 'onAllUserCountUpdated', 'onLocalUserKickedOut', 'onUserPropertiesUpdated', 'onUserPropertiesDeleted']));
342
+ this.addObserver(generateLogObserver(this.logger, [['onRemoteUsersJoined', ['roomId', 'events']], ['onRemoteUsersLeft', ['roomId', 'events']], ['onUserInfoUpdated', ['roomId', 'event']], ['onAllUserCountUpdated', ['roomId', 'count']], ['onLocalUserKickedOut', ['roomId', 'event']], ['onUserPropertiesUpdated', ['roomId', 'event']], ['onUserPropertiesDeleted', ['roomId', 'event']]]));
343
343
  }
344
344
  }
@@ -23,14 +23,15 @@ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol"
23
23
  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); }
24
24
  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; }
25
25
  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; }
26
- import { trace } from '../../imports';
27
26
  import { FcrBaseRoomControlImpl } from '..';
28
- import { FcrRoomType } from '../type';
27
+ import { ErrorModuleCode, trace } from '../../imports';
28
+ import { fcrUserRolesSchema, stringArraySchema } from '../../schema';
29
29
  import { FcrUserRoleToStringMap } from '../../type';
30
+ import { handleRequestError } from '../../utilities/error';
30
31
  import { createLogger, generateLogObserver } from '../../utilities/logger';
31
- import { FcrErrorModuleCode, handleRequestError } from '../../utilities/error';
32
32
  import validateParams from '../../utilities/validate-params';
33
- import { stringArraySchema, fcrUserRolesSchema } from '../../schema';
33
+ import { FcrRoomType } from '../type';
34
+
34
35
  /**
35
36
  * @internal
36
37
  */
@@ -39,7 +40,7 @@ export class FcrWaitingRoomControlImpl extends FcrBaseRoomControlImpl {
39
40
  [_initProto] = _applyDecs(this, [[_moveToMainRoomByUserIdsDecs, 2, "moveToMainRoomByUserIds"], [_moveToMainRoomByUserRolesDecs, 2, "moveToMainRoomByUserRoles"]], [], 0, void 0, FcrBaseRoomControlImpl).e;
40
41
  }
41
42
  //@internal
42
- [(_moveToMainRoomByUserIdsDecs = [trace, validateParams(stringArraySchema)], _moveToMainRoomByUserRolesDecs = [trace, validateParams(fcrUserRolesSchema)], "logger")] = (_initProto(this), createLogger({
43
+ [(_moveToMainRoomByUserIdsDecs = [trace(['userIds']), validateParams(stringArraySchema)], _moveToMainRoomByUserRolesDecs = [trace(['userRoles']), validateParams(fcrUserRolesSchema)], "logger")] = (_initProto(this), createLogger({
43
44
  prefix: 'FcrWaitingRoomControlImpl'
44
45
  }));
45
46
  constructor(engine, scene, api, config, sharedCache, chatConnection, chatRoomControl) {
@@ -53,15 +54,15 @@ export class FcrWaitingRoomControlImpl extends FcrBaseRoomControlImpl {
53
54
  super.removeObserver(observer);
54
55
  }
55
56
  async moveToMainRoomByUserIds(userIds) {
56
- return handleRequestError(() => this._api.moveToMainRoomByUserIds(userIds, this._scene.getScenePropertiesByKeyPath('info.mainRoomUuid')), FcrErrorModuleCode.ROOM, 'move to main room by user ids failed');
57
+ return handleRequestError(() => this._api.moveToMainRoomByUserIds(userIds, this._scene.getScenePropertiesByKeyPath('info.mainRoomUuid')), ErrorModuleCode.FCR_ROOM, 'move to main room by user ids failed');
57
58
  }
58
59
  async moveToMainRoomByUserRoles(userRoles) {
59
- return handleRequestError(() => this._api.moveToMainRoomByUserRoles(userRoles.map(role => FcrUserRoleToStringMap[role]), this._scene.getScenePropertiesByKeyPath('info.mainRoomUuid')), FcrErrorModuleCode.ROOM, 'move to main room by user roles failed');
60
+ return handleRequestError(() => this._api.moveToMainRoomByUserRoles(userRoles.map(role => FcrUserRoleToStringMap[role]), this._scene.getScenePropertiesByKeyPath('info.mainRoomUuid')), ErrorModuleCode.FCR_ROOM, 'move to main room by user roles failed');
60
61
  }
61
62
  _addLogObserver() {
62
- this.addObserver(generateLogObserver(this.logger, ['onCloudRecordingStateUpdated', 'onJoinRoomFailure', 'onJoinRoomSuccess', 'onLiveStreamingStateUpdated',
63
+ this.addObserver(generateLogObserver(this.logger, [['onCloudRecordingStateUpdated', ['roomId', 'state']], ['onJoinRoomFailure', ['roomId', 'error']], ['onJoinRoomSuccess', ['roomId']], ['onLiveStreamingStateUpdated', ['roomId', 'state', 'url', 'reason']],
63
64
  // 'onNetworkQualityUpdated',
64
65
  // 'onNetworkStatsUpdated',
65
- 'onRoomMessageReceived', 'onRoomPropertiesDeleted', 'onRoomPropertiesUpdated', 'onRoomStateUpdated']));
66
+ ['onRoomMessageReceived', ['roomId', 'message']], ['onRoomPropertiesDeleted', ['roomId', 'event']], ['onRoomPropertiesUpdated', ['roomId', 'event']], ['onRoomStateUpdated', ['roomId', 'state']]]));
66
67
  }
67
68
  }