fcr-ui-scene 3.7.7 → 3.7.8-rc.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (212) hide show
  1. package/installer/icons/icon.png +0 -0
  2. package/installer/mac/entitlements.mac.plist +5 -1
  3. package/lib/creator/provider-initializer.browser.js +2 -2
  4. package/lib/creator/provider-initializer.electron.js +2 -2
  5. package/lib/electron/bootstrap-sdk.js +70 -33
  6. package/lib/electron/hang-detection/index.d.ts +3 -0
  7. package/lib/electron/hang-detection/index.js +15 -0
  8. package/lib/electron/hang-detection/manager.d.ts +28 -0
  9. package/lib/electron/hang-detection/manager.js +231 -0
  10. package/lib/electron/hang-detection/types.d.ts +14 -0
  11. package/lib/electron/until.d.ts +1 -4
  12. package/lib/electron/until.js +9 -4
  13. package/lib/modules/action-bar/components/screen-share/index.electron.js +1 -1
  14. package/lib/modules/components/control-bar/components/switch-theme/index.js +4 -2
  15. package/lib/modules/components/control-bar/index.js +1 -3
  16. package/lib/modules/participant/store.base.js +0 -1
  17. package/lib/modules/share-screen/store.electron.js +9 -0
  18. package/lib/modules/state-bar/store.base.electron.js +6 -2
  19. package/lib/providers/board-share/bar-control/base.d.ts +2 -0
  20. package/lib/providers/board-share/bar-control/base.js +13 -3
  21. package/lib/providers/board-share/bar-control/electron.d.ts +1 -0
  22. package/lib/providers/board-share/bar-control/electron.js +15 -4
  23. package/lib/providers/board-share/provider.base.d.ts +1 -0
  24. package/lib/providers/board-share/provider.base.js +3 -1
  25. package/lib/providers/board-share/provider.electron.d.ts +1 -0
  26. package/lib/providers/board-share/provider.electron.js +8 -2
  27. package/lib/providers/board-share/type.d.ts +2 -0
  28. package/lib/providers/dialog/provider.electron.js +10 -2
  29. package/lib/providers/screen-share/strategy/browser.js +50 -3
  30. package/lib/providers/screen-share/strategy/electron.js +77 -8
  31. package/lib/providers/screen-share/stream-state-sync.d.ts +3 -1
  32. package/lib/providers/screen-share/stream-state-sync.js +133 -40
  33. package/package.json +5 -5
  34. package/lib/creator.d.ts +0 -36
  35. package/lib/creator.js +0 -465
  36. package/lib/modules/action-bar/index.d.ts +0 -58
  37. package/lib/modules/action-bar/index.dev.d.ts +0 -0
  38. package/lib/modules/action-bar/index.dev.js +0 -94
  39. package/lib/modules/action-bar/index.js +0 -109
  40. package/lib/modules/action-bar/store.d.ts +0 -259
  41. package/lib/modules/action-bar/store.js +0 -1529
  42. package/lib/modules/action-bar/types.d.ts +0 -90
  43. package/lib/modules/action-bar/view.d.ts +0 -5
  44. package/lib/modules/action-bar/view.js +0 -112
  45. package/lib/modules/annotation/annotation-index.d.ts +0 -2
  46. package/lib/modules/annotation/annotation-index.js +0 -80
  47. package/lib/modules/annotation/annotation-toolbar-store.d.ts +0 -75
  48. package/lib/modules/annotation/annotation-toolbar-store.js +0 -459
  49. package/lib/modules/annotation/board-cursor.css +0 -77
  50. package/lib/modules/annotation/components/color-picker/components/color.d.ts +0 -5
  51. package/lib/modules/annotation/components/color-picker/components/color.js +0 -38
  52. package/lib/modules/annotation/components/color-picker/components/panel.d.ts +0 -1
  53. package/lib/modules/annotation/components/color-picker/components/panel.js +0 -109
  54. package/lib/modules/annotation/components/color-picker/components/picker.d.ts +0 -1
  55. package/lib/modules/annotation/components/color-picker/components/picker.js +0 -75
  56. package/lib/modules/annotation/components/color-picker/index.d.ts +0 -2
  57. package/lib/modules/annotation/components/color-picker/index.js +0 -47
  58. package/lib/modules/annotation/components/eraser-picker.d.ts +0 -4
  59. package/lib/modules/annotation/components/eraser-picker.js +0 -144
  60. package/lib/modules/annotation/components/expansion/index.d.ts +0 -1
  61. package/lib/modules/annotation/components/expansion/index.js +0 -100
  62. package/lib/modules/annotation/components/extra-tool-picker.d.ts +0 -1
  63. package/lib/modules/annotation/components/extra-tool-picker.js +0 -62
  64. package/lib/modules/annotation/components/history.d.ts +0 -2
  65. package/lib/modules/annotation/components/history.js +0 -78
  66. package/lib/modules/annotation/components/icons/fold-icon.d.ts +0 -2
  67. package/lib/modules/annotation/components/icons/fold-icon.js +0 -41
  68. package/lib/modules/annotation/components/icons/move-icon.d.ts +0 -1
  69. package/lib/modules/annotation/components/icons/move-icon.js +0 -66
  70. package/lib/modules/annotation/components/item/index.d.ts +0 -1
  71. package/lib/modules/annotation/components/item/index.js +0 -43
  72. package/lib/modules/annotation/components/move-handle.d.ts +0 -5
  73. package/lib/modules/annotation/components/move-handle.js +0 -134
  74. package/lib/modules/annotation/components/pen-picker.d.ts +0 -4
  75. package/lib/modules/annotation/components/pen-picker.js +0 -155
  76. package/lib/modules/annotation/components/screen-capture-picker.d.ts +0 -4
  77. package/lib/modules/annotation/components/screen-capture-picker.js +0 -85
  78. package/lib/modules/annotation/components/shape-picker.d.ts +0 -4
  79. package/lib/modules/annotation/components/shape-picker.js +0 -210
  80. package/lib/modules/annotation/hooks/index.d.ts +0 -14
  81. package/lib/modules/annotation/hooks/index.js +0 -292
  82. package/lib/modules/annotation/index.d.ts +0 -45
  83. package/lib/modules/annotation/index.js +0 -168
  84. package/lib/modules/annotation/store.d.ts +0 -98
  85. package/lib/modules/annotation/store.js +0 -620
  86. package/lib/modules/annotation/style.css +0 -36
  87. package/lib/modules/annotation/view.d.ts +0 -3
  88. package/lib/modules/annotation/view.js +0 -44
  89. package/lib/modules/components/device-control/store.d.ts +0 -42
  90. package/lib/modules/components/device-control/store.js +0 -241
  91. package/lib/modules/components/leave-meeting/store.d.ts +0 -39
  92. package/lib/modules/components/leave-meeting/store.js +0 -270
  93. package/lib/modules/control-bar/components/annotation-button/index.d.ts +0 -1
  94. package/lib/modules/control-bar/components/annotation-button/index.js +0 -72
  95. package/lib/modules/control-bar/types.d.ts +0 -20
  96. package/lib/modules/control-bar/types.js +0 -6
  97. package/lib/modules/dialog/dialogs/pre-setting/index.css +0 -26
  98. package/lib/modules/dialog/dialogs/pre-setting/index.d.ts +0 -6
  99. package/lib/modules/dialog/dialogs/pre-setting/index.js +0 -62
  100. package/lib/modules/dialog/dialogs/widget/electron.d.ts +0 -6
  101. package/lib/modules/dialog/dialogs/widget/electron.js +0 -38
  102. package/lib/modules/dialog/hooks/use-popover-watcher.d.ts +0 -14
  103. package/lib/modules/dialog/hooks/use-popover-watcher.js +0 -110
  104. package/lib/modules/dialog/hooks/useElectron.d.ts +0 -28
  105. package/lib/modules/dialog/hooks/useElectron.js +0 -277
  106. package/lib/modules/dialog/store.d.ts +0 -135
  107. package/lib/modules/dialog/store.js +0 -616
  108. package/lib/modules/event-confirm/components/window/index.d.ts +0 -7
  109. package/lib/modules/event-confirm/components/window/index.js +0 -221
  110. package/lib/modules/event-confirm/index.css +0 -24
  111. package/lib/modules/event-confirm/index.d.ts +0 -27
  112. package/lib/modules/event-confirm/index.js +0 -76
  113. package/lib/modules/event-confirm/store.d.ts +0 -50
  114. package/lib/modules/event-confirm/store.js +0 -394
  115. package/lib/modules/event-confirm/view.d.ts +0 -2
  116. package/lib/modules/event-confirm/view.js +0 -55
  117. package/lib/modules/event-toast/store.d.ts +0 -27
  118. package/lib/modules/event-toast/store.js +0 -205
  119. package/lib/modules/layout/store.d.ts +0 -176
  120. package/lib/modules/layout/store.js +0 -1452
  121. package/lib/modules/participant/store.d.ts +0 -222
  122. package/lib/modules/participant/store.js +0 -1929
  123. package/lib/modules/pc-audio-connect/index.d.ts +0 -22
  124. package/lib/modules/pc-audio-connect/index.js +0 -67
  125. package/lib/modules/pc-audio-connect/store.d.ts +0 -46
  126. package/lib/modules/pc-audio-connect/store.js +0 -304
  127. package/lib/modules/setting/common/advance-link.d.ts +0 -3
  128. package/lib/modules/setting/common/advance-link.js +0 -27
  129. package/lib/modules/setting/common/index.css +0 -26
  130. package/lib/modules/setting/common/useNamespace.d.ts +0 -15
  131. package/lib/modules/setting/common/useNamespace.js +0 -66
  132. package/lib/modules/setting/dialog-wrapper.d.ts +0 -2
  133. package/lib/modules/setting/dialog-wrapper.js +0 -110
  134. package/lib/modules/setting/store.d.ts +0 -261
  135. package/lib/modules/setting/store.js +0 -1321
  136. package/lib/modules/share-screen/store.d.ts +0 -148
  137. package/lib/modules/share-screen/store.js +0 -960
  138. package/lib/modules/share-screen/types.d.ts +0 -26
  139. package/lib/modules/share-screen/types.js +0 -6
  140. package/lib/modules/state-bar/store.d.ts +0 -124
  141. package/lib/modules/state-bar/store.js +0 -664
  142. package/lib/modules/whiteboard/components/progress/electron.d.ts +0 -1
  143. package/lib/modules/whiteboard/components/progress/electron.js +0 -33
  144. package/lib/modules/widget/store.d.ts +0 -14
  145. package/lib/modules/widget/store.js +0 -28
  146. package/lib/providers/annotation-provider.d.ts +0 -124
  147. package/lib/providers/annotation-provider.js +0 -369
  148. package/lib/providers/dialog-provider.d.ts +0 -137
  149. package/lib/providers/dialog-provider.js +0 -194
  150. package/lib/providers/message-provider.d.ts +0 -69
  151. package/lib/providers/message-provider.js +0 -140
  152. package/lib/providers/room-provider.d.ts +0 -194
  153. package/lib/providers/room-provider.js +0 -916
  154. package/lib/providers/screen-share-provider.d.ts +0 -245
  155. package/lib/providers/screen-share-provider.js +0 -850
  156. package/lib/providers/sharing-provider.d.ts +0 -42
  157. package/lib/providers/sharing-provider.js +0 -228
  158. package/lib/providers/user-setting-storage-provider.d.ts +0 -21
  159. package/lib/providers/user-setting-storage-provider.js +0 -65
  160. package/lib/providers/whiteboard-provider.d.ts +0 -24
  161. package/lib/providers/whiteboard-provider.js +0 -128
  162. package/lib/shared-data-source/annotation-data.d.ts +0 -17
  163. package/lib/shared-data-source/annotation-data.js +0 -110
  164. package/lib/shared-data-source/app-list-data.d.ts +0 -34
  165. package/lib/shared-data-source/app-list-data.js +0 -133
  166. package/lib/shared-data-source/chat-data.d.ts +0 -25
  167. package/lib/shared-data-source/chat-data.js +0 -139
  168. package/lib/shared-data-source/config.d.ts +0 -35
  169. package/lib/shared-data-source/config.js +0 -40
  170. package/lib/shared-data-source/confirm-data.d.ts +0 -44
  171. package/lib/shared-data-source/confirm-data.js +0 -201
  172. package/lib/shared-data-source/device-privilege-data.d.ts +0 -8
  173. package/lib/shared-data-source/device-privilege-data.js +0 -25
  174. package/lib/shared-data-source/interpreter.d.ts +0 -77
  175. package/lib/shared-data-source/interpreter.js +0 -247
  176. package/lib/shared-data-source/layout-data.d.ts +0 -31
  177. package/lib/shared-data-source/layout-data.js +0 -189
  178. package/lib/shared-data-source/meeting-time.d.ts +0 -90
  179. package/lib/shared-data-source/meeting-time.js +0 -416
  180. package/lib/shared-data-source/member-data.d.ts +0 -139
  181. package/lib/shared-data-source/member-data.js +0 -517
  182. package/lib/shared-data-source/pin-data.d.ts +0 -13
  183. package/lib/shared-data-source/pin-data.js +0 -111
  184. package/lib/shared-data-source/screen-share-data.d.ts +0 -357
  185. package/lib/shared-data-source/screen-share-data.js +0 -513
  186. package/lib/shared-data-source/security-data.d.ts +0 -39
  187. package/lib/shared-data-source/security-data.js +0 -156
  188. package/lib/shared-data-source/setting.d.ts +0 -67
  189. package/lib/shared-data-source/setting.js +0 -220
  190. package/lib/shared-data-source/speaker-spotlight.d.ts +0 -5
  191. package/lib/shared-data-source/speaker-spotlight.js +0 -15
  192. package/lib/shared-data-source/video-window.d.ts +0 -165
  193. package/lib/shared-data-source/video-window.js +0 -1266
  194. package/lib/shared-data-source/waiting-room.d.ts +0 -46
  195. package/lib/shared-data-source/waiting-room.js +0 -222
  196. package/lib/shared-data-source/whiteboard-data.d.ts +0 -70
  197. package/lib/shared-data-source/whiteboard-data.js +0 -348
  198. package/lib/utilities/board-context.d.ts +0 -4
  199. package/lib/utilities/board-context.js +0 -12
  200. package/lib/utilities/copyText.d.ts +0 -2
  201. package/lib/utilities/copyText.js +0 -48
  202. package/lib/utilities/renderer-event.d.ts +0 -10
  203. package/lib/utilities/renderer-event.js +0 -95
  204. package/lib/utilities/screen-capture-permission.d.ts +0 -2
  205. package/lib/utilities/screen-capture-permission.js +0 -24
  206. package/lib/utilities/screen.d.ts +0 -3
  207. package/lib/utilities/screen.js +0 -53
  208. package/lib/utilities/video-track-render-context.d.ts +0 -6
  209. package/lib/utilities/video-track-render-context.js +0 -9
  210. package/lib/waiting-room-control-manager.d.ts +0 -28
  211. package/lib/waiting-room-control-manager.js +0 -230
  212. /package/lib/{modules/action-bar → electron/hang-detection}/types.js +0 -0
@@ -1,1266 +0,0 @@
1
- "use strict";
2
-
3
- require("core-js/modules/es.symbol.js");
4
- require("core-js/modules/es.symbol.description.js");
5
- require("core-js/modules/es.symbol.iterator.js");
6
- require("core-js/modules/es.symbol.to-primitive.js");
7
- require("core-js/modules/es.error.cause.js");
8
- require("core-js/modules/es.error.to-string.js");
9
- require("core-js/modules/es.array.from.js");
10
- require("core-js/modules/es.array.is-array.js");
11
- require("core-js/modules/es.array.slice.js");
12
- require("core-js/modules/es.date.to-primitive.js");
13
- require("core-js/modules/es.date.to-string.js");
14
- require("core-js/modules/es.function.name.js");
15
- require("core-js/modules/es.number.constructor.js");
16
- require("core-js/modules/es.object.create.js");
17
- require("core-js/modules/es.object.define-property.js");
18
- require("core-js/modules/es.object.get-own-property-descriptor.js");
19
- require("core-js/modules/es.regexp.exec.js");
20
- require("core-js/modules/es.regexp.test.js");
21
- require("core-js/modules/es.regexp.to-string.js");
22
- require("core-js/modules/esnext.function.metadata.js");
23
- require("core-js/modules/esnext.symbol.metadata.js");
24
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
25
- var _typeof = require("@babel/runtime/helpers/typeof");
26
- Object.defineProperty(exports, "__esModule", {
27
- value: true
28
- });
29
- exports.FcrUIVideoWindowDataSourceImpl = exports.FcrUIVideoWindowDataImpl = exports.FcrUISpeakerSpotlightPool = void 0;
30
- require("core-js/modules/es.array.filter.js");
31
- require("core-js/modules/es.array.find.js");
32
- require("core-js/modules/es.array.find-index.js");
33
- require("core-js/modules/es.array.find-last-index.js");
34
- require("core-js/modules/es.array.for-each.js");
35
- require("core-js/modules/es.array.iterator.js");
36
- require("core-js/modules/es.array.push.js");
37
- require("core-js/modules/es.array.some.js");
38
- require("core-js/modules/es.array.sort.js");
39
- require("core-js/modules/es.array.splice.js");
40
- require("core-js/modules/es.array.unshift.js");
41
- require("core-js/modules/es.date.now.js");
42
- require("core-js/modules/es.function.bind.js");
43
- require("core-js/modules/es.map.js");
44
- require("core-js/modules/es.object.assign.js");
45
- require("core-js/modules/es.object.to-string.js");
46
- require("core-js/modules/es.string.iterator.js");
47
- require("core-js/modules/es.weak-map.js");
48
- require("core-js/modules/esnext.iterator.constructor.js");
49
- require("core-js/modules/esnext.iterator.filter.js");
50
- require("core-js/modules/esnext.iterator.find.js");
51
- require("core-js/modules/esnext.iterator.for-each.js");
52
- require("core-js/modules/esnext.iterator.some.js");
53
- require("core-js/modules/esnext.map.delete-all.js");
54
- require("core-js/modules/esnext.map.emplace.js");
55
- require("core-js/modules/esnext.map.every.js");
56
- require("core-js/modules/esnext.map.filter.js");
57
- require("core-js/modules/esnext.map.find.js");
58
- require("core-js/modules/esnext.map.find-key.js");
59
- require("core-js/modules/esnext.map.includes.js");
60
- require("core-js/modules/esnext.map.key-of.js");
61
- require("core-js/modules/esnext.map.map-keys.js");
62
- require("core-js/modules/esnext.map.map-values.js");
63
- require("core-js/modules/esnext.map.merge.js");
64
- require("core-js/modules/esnext.map.reduce.js");
65
- require("core-js/modules/esnext.map.some.js");
66
- require("core-js/modules/esnext.map.update.js");
67
- require("core-js/modules/esnext.weak-map.delete-all.js");
68
- require("core-js/modules/esnext.weak-map.emplace.js");
69
- require("core-js/modules/web.dom-collections.for-each.js");
70
- require("core-js/modules/web.dom-collections.iterator.js");
71
- require("core-js/modules/web.timers.js");
72
- var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
73
- var _readOnlyError2 = _interopRequireDefault(require("@babel/runtime/helpers/readOnlyError"));
74
- var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
75
- var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
76
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
77
- var _observable = require("agora-foundation/lib/utilities/observable");
78
- var _type = require("./../type");
79
- var _mobx = require("mobx");
80
- var _type2 = require("fcr-core/lib/type");
81
- var _fcrCore = require("fcr-core");
82
- var _base = require("../base");
83
- var _FcrUIVideoWindowDataImpl, _FcrUIVideoWindowDataSourceImpl;
84
- var _initProto, _init__boardUserInfo, _init__videoStream, _init__audioStream, _init__spotlightEnabled, _init__isSpeakerSpotlight, _init__boardCanEdit, _init__isFirstCameraOpen, _init_isPin, _init_hasScreenSharing, _init_hasBoardSharing, _init_hasLoopbackSharing, _setVideoStreamDecs, _setVideoStreamOwnerInfoDecs, _setAudioStreamDecs, _setAudioStreamOwnerInfoDecs, _setPinDecs, _setSpotlightEnabledDecs, _setHasBoardSharingDecs, _setBoardUserInfoDecs, _setSpeakerSpotlightDecs, _setHasScreenSharingDecs, _setHasLoopbackSharingDecs, _setBoardCanEditDecs, _getVideoStreamDecs, _ref, _initProto2, _init_spotlightEnabled, _init_layoutType, _init_manualLayout, _init_pinLimitedCount, _init_mainListLimitedCount, _init_foldListLimitedCount, _init_mainList, _init_foldList, _init_spotlightStreamId, _setSpotlightEnabledDecs2, _setLayoutDecs, _onSpotlightRemovedDecs, _resetListDecs, _addBoardDecs, _updateBoardDecs, _removeBoardDecs, _mergePstnStreamOrInsertNewDataDecs, _addDecs, _updateDecs, _deleteDecs, _addPinDecs, _updateSpeakerSpotlightPositionDecs, _removePinDecs, _setSpeakerSpotlightDecs2, _toggleMainStreamDecs, _insertBeginningByPriorityDecs, _insertEndByPriorityDecs, _findInsertBeginningIndexDecs, _findInsertEndIndexDecs, _insertBoardDecs, _insertNewDataDecs, _ref5;
85
- function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; }
86
- function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
87
- function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
88
- function _classPrivateFieldInitSpec(e, t, a) { _checkPrivateRedeclaration(e, t), t.set(e, a); }
89
- function _checkPrivateRedeclaration(e, t) { if (t.has(e)) throw new TypeError("Cannot initialize the same private elements twice on an object"); }
90
- function _classPrivateFieldSet(s, a, r) { return s.set(_assertClassBrand(s, a), r), r; }
91
- function _classPrivateFieldGet(s, a) { return s.get(_assertClassBrand(s, a)); }
92
- function _assertClassBrand(e, t, n) { if ("function" == typeof e ? e === t : e.has(t)) return arguments.length < 3 ? t : n; throw new TypeError("Private element is not present on this object"); }
93
- 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 set(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 k(e) { return m(e), w.value; } : (o < 4 && (k = i(w, "get", m)), 3 !== o && (F = i(w, "set", m))) : (k = function k(e) { return e[n]; }, (o < 2 || 4 === o) && (F = function F(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 s(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)]; } }; }
94
- function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
95
- 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); }
96
- 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; }
97
- 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; }
98
- var _A = /*#__PURE__*/new WeakMap();
99
- var _B = /*#__PURE__*/new WeakMap();
100
- var _C = /*#__PURE__*/new WeakMap();
101
- var _D = /*#__PURE__*/new WeakMap();
102
- var _E = /*#__PURE__*/new WeakMap();
103
- var _F = /*#__PURE__*/new WeakMap();
104
- var _G = /*#__PURE__*/new WeakMap();
105
- var _H = /*#__PURE__*/new WeakMap();
106
- var _I = /*#__PURE__*/new WeakMap();
107
- var _J = /*#__PURE__*/new WeakMap();
108
- var _K = /*#__PURE__*/new WeakMap();
109
- _ref = (_setVideoStreamDecs = [_mobx.action, _mobx.action.bound], _setVideoStreamOwnerInfoDecs = [_mobx.action, _mobx.action.bound], _setAudioStreamDecs = [_mobx.action, _mobx.action.bound], _setAudioStreamOwnerInfoDecs = [_mobx.action, _mobx.action.bound], _setPinDecs = [_mobx.action, _mobx.action.bound], _setSpotlightEnabledDecs = [_mobx.action, _mobx.action.bound], _setHasBoardSharingDecs = [_mobx.action, _mobx.action.bound], _setBoardUserInfoDecs = [_mobx.action, _mobx.action.bound], _setSpeakerSpotlightDecs = [_mobx.action, _mobx.action.bound], _setHasScreenSharingDecs = [_mobx.action, _mobx.action.bound], _setHasLoopbackSharingDecs = [_mobx.action, _mobx.action.bound], _setBoardCanEditDecs = [_mobx.action, _mobx.action.bound], _getVideoStreamDecs = [_mobx.action, _mobx.action.bound], "_boardUserInfo");
110
- var FcrUIVideoWindowDataImpl = exports.FcrUIVideoWindowDataImpl = /*#__PURE__*/function () {
111
- function FcrUIVideoWindowDataImpl(type, _ref2, _placement, _isMySelf) {
112
- var videoStream = _ref2.videoStream,
113
- audioStream = _ref2.audioStream,
114
- boardUserInfo = _ref2.boardUserInfo;
115
- var layoutType = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : _type.FcrUIVideoWindowLayoutType.Gallery;
116
- var spotlightEnabled = arguments.length > 5 ? arguments[5] : undefined;
117
- var canEdit = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : false;
118
- (0, _classCallCheck2["default"])(this, FcrUIVideoWindowDataImpl);
119
- _classPrivateFieldInitSpec(this, _A, (_initProto(this), _init__boardUserInfo(this)));
120
- (0, _defineProperty2["default"])(this, "_layoutType", _type.FcrUIVideoWindowLayoutType.Gallery);
121
- _classPrivateFieldInitSpec(this, _B, _init__videoStream(this));
122
- _classPrivateFieldInitSpec(this, _C, _init__audioStream(this));
123
- _classPrivateFieldInitSpec(this, _D, _init__spotlightEnabled(this, true));
124
- _classPrivateFieldInitSpec(this, _E, _init__isSpeakerSpotlight(this, false));
125
- _classPrivateFieldInitSpec(this, _F, _init__boardCanEdit(this, false));
126
- _classPrivateFieldInitSpec(this, _G, _init__isFirstCameraOpen(this, false));
127
- (0, _defineProperty2["default"])(this, "needToSort", false);
128
- _classPrivateFieldInitSpec(this, _H, _init_isPin(this, false));
129
- _classPrivateFieldInitSpec(this, _I, _init_hasScreenSharing(this, false));
130
- _classPrivateFieldInitSpec(this, _J, _init_hasBoardSharing(this, false));
131
- _classPrivateFieldInitSpec(this, _K, _init_hasLoopbackSharing(this, false));
132
- this._placement = _placement;
133
- this._isMySelf = _isMySelf;
134
- this.type = type;
135
- this.setVideoStream(videoStream);
136
- this.setAudioStream(audioStream);
137
- this.setLayoutType(layoutType);
138
- this.setSpotlightEnabled(spotlightEnabled);
139
- this._boardUserInfo = boardUserInfo;
140
- this._boardCanEdit = canEdit;
141
- }
142
- return (0, _createClass2["default"])(FcrUIVideoWindowDataImpl, [{
143
- key: _ref,
144
- get: function get() {
145
- return _classPrivateFieldGet(_A, this);
146
- }
147
- }, {
148
- key: "_boardUserInfo",
149
- set: function set(v) {
150
- _classPrivateFieldSet(_A, this, v);
151
- }
152
- }, {
153
- key: "_videoStream",
154
- get: function get() {
155
- return _classPrivateFieldGet(_B, this);
156
- },
157
- set: function set(v) {
158
- _classPrivateFieldSet(_B, this, v);
159
- }
160
- }, {
161
- key: "_audioStream",
162
- get: function get() {
163
- return _classPrivateFieldGet(_C, this);
164
- },
165
- set: function set(v) {
166
- _classPrivateFieldSet(_C, this, v);
167
- }
168
- }, {
169
- key: "_spotlightEnabled",
170
- get: function get() {
171
- return _classPrivateFieldGet(_D, this);
172
- },
173
- set: function set(v) {
174
- _classPrivateFieldSet(_D, this, v);
175
- }
176
- }, {
177
- key: "_isSpeakerSpotlight",
178
- get: function get() {
179
- return _classPrivateFieldGet(_E, this);
180
- },
181
- set: function set(v) {
182
- _classPrivateFieldSet(_E, this, v);
183
- }
184
- }, {
185
- key: "_boardCanEdit",
186
- get: function get() {
187
- return _classPrivateFieldGet(_F, this);
188
- },
189
- set: function set(v) {
190
- _classPrivateFieldSet(_F, this, v);
191
- }
192
- }, {
193
- key: "_isFirstCameraOpen",
194
- get: function get() {
195
- return _classPrivateFieldGet(_G, this);
196
- },
197
- set: function set(v) {
198
- _classPrivateFieldSet(_G, this, v);
199
- }
200
- }, {
201
- key: "isPin",
202
- get: function get() {
203
- return _classPrivateFieldGet(_H, this);
204
- },
205
- set: function set(v) {
206
- _classPrivateFieldSet(_H, this, v);
207
- }
208
- }, {
209
- key: "hasScreenSharing",
210
- get: function get() {
211
- return _classPrivateFieldGet(_I, this);
212
- },
213
- set: function set(v) {
214
- _classPrivateFieldSet(_I, this, v);
215
- }
216
- }, {
217
- key: "hasBoardSharing",
218
- get: function get() {
219
- return _classPrivateFieldGet(_J, this);
220
- },
221
- set: function set(v) {
222
- _classPrivateFieldSet(_J, this, v);
223
- }
224
- }, {
225
- key: "hasLoopbackSharing",
226
- get: function get() {
227
- return _classPrivateFieldGet(_K, this);
228
- },
229
- set: function set(v) {
230
- _classPrivateFieldSet(_K, this, v);
231
- }
232
- }, {
233
- key: "isSpeakerSpotlight",
234
- get: function get() {
235
- return this._isSpeakerSpotlight && this._spotlightEnabled;
236
- }
237
- }, {
238
- key: "windowId",
239
- get: function get() {
240
- return this.type === _type.FcrUIWindowType.BOARD ? 'boardId' : this.videoStreamId || this.audioStreamId || '';
241
- }
242
- }, {
243
- key: "videoStreamId",
244
- get: function get() {
245
- var _this$_videoStream;
246
- return (_this$_videoStream = this._videoStream) === null || _this$_videoStream === void 0 ? void 0 : _this$_videoStream.streamId;
247
- }
248
- }, {
249
- key: "audioStreamId",
250
- get: function get() {
251
- var _this$_audioStream;
252
- return (_this$_audioStream = this._audioStream) === null || _this$_audioStream === void 0 ? void 0 : _this$_audioStream.streamId;
253
- }
254
- }, {
255
- key: "audioStreamConnectorType",
256
- get: function get() {
257
- var _this$_audioStream2;
258
- return ((_this$_audioStream2 = this._audioStream) === null || _this$_audioStream2 === void 0 ? void 0 : _this$_audioStream2.connectorType) || _fcrCore.FcrRoomConnectorType.NONE;
259
- }
260
- }, {
261
- key: "videoStreamConnectorType",
262
- get: function get() {
263
- var _this$_videoStream2;
264
- return ((_this$_videoStream2 = this._videoStream) === null || _this$_videoStream2 === void 0 ? void 0 : _this$_videoStream2.connectorType) || _fcrCore.FcrRoomConnectorType.NONE;
265
- }
266
-
267
- // @computed
268
- // get hasMicrophoneAudioStream() {
269
- // if (this.audioStreamConnectorType === FcrRoomConnectorType.NONE) {
270
- // return (
271
- // this._videoStream?.audioSourceState === FcrMediaSourceState.OPEN &&
272
- // (this._videoStream.streamType === FcrStreamType.BOTH ||
273
- // this._videoStream.streamType === FcrStreamType.AUDIO)
274
- // );
275
- // } else {
276
- // return true;
277
- // }
278
- // }
279
- }, {
280
- key: "hasMicrophoneAudioStream",
281
- get: function get() {
282
- if (this.audioStreamConnectorType === _fcrCore.FcrRoomConnectorType.NONE) {
283
- var _ref3 = this._videoStream || {},
284
- audioSourceState = _ref3.audioSourceState;
285
- return audioSourceState === _fcrCore.FcrMediaSourceState.OPEN;
286
- } else {
287
- return true;
288
- }
289
- }
290
- }, {
291
- key: "hasLoopbackAudioStream",
292
- get: function get() {
293
- var _this$_videoStream3;
294
- if (((_this$_videoStream3 = this._videoStream) === null || _this$_videoStream3 === void 0 ? void 0 : _this$_videoStream3.audioSourceType) === _fcrCore.FcrAudioSourceType.LOOPBACK
295
- // &&
296
- // this._videoStream?.audioSourceState === FcrMediaSourceState.OPEN
297
- ) {
298
- return true;
299
- }
300
- return false;
301
- }
302
- }, {
303
- key: "phoneMicEnabled",
304
- get: function get() {
305
- if (this.audioStreamConnectorType === _fcrCore.FcrRoomConnectorType.PSTN) {
306
- var _ref4 = this._audioStream || {},
307
- audioSourceState = _ref4.audioSourceState,
308
- streamType = _ref4.streamType;
309
- var isAudioStream = streamType === _fcrCore.FcrStreamType.AUDIO || streamType === _fcrCore.FcrStreamType.BOTH;
310
- return audioSourceState === _fcrCore.FcrMediaSourceState.OPEN && isAudioStream;
311
- } else {
312
- return false;
313
- }
314
- }
315
- }, {
316
- key: "hasVideoStream",
317
- get: function get() {
318
- var _this$_videoStream4, _this$_videoStream5, _this$_videoStream6;
319
- return ((_this$_videoStream4 = this._videoStream) === null || _this$_videoStream4 === void 0 ? void 0 : _this$_videoStream4.videoSourceState) === _fcrCore.FcrMediaSourceState.OPEN && (((_this$_videoStream5 = this._videoStream) === null || _this$_videoStream5 === void 0 ? void 0 : _this$_videoStream5.streamType) === _fcrCore.FcrStreamType.BOTH || ((_this$_videoStream6 = this._videoStream) === null || _this$_videoStream6 === void 0 ? void 0 : _this$_videoStream6.streamType) === _fcrCore.FcrStreamType.VIDEO);
320
- }
321
- }, {
322
- key: "hasBoard",
323
- get: function get() {
324
- return this.type === _type.FcrUIWindowType.BOARD;
325
- }
326
- }, {
327
- key: "userId",
328
- get: function get() {
329
- var _this$_videoStream7, _this$_audioStream3, _this$_boardUserInfo;
330
- return ((_this$_videoStream7 = this._videoStream) === null || _this$_videoStream7 === void 0 ? void 0 : _this$_videoStream7.owner.userId) || ((_this$_audioStream3 = this._audioStream) === null || _this$_audioStream3 === void 0 ? void 0 : _this$_audioStream3.owner.userId) || ((_this$_boardUserInfo = this._boardUserInfo) === null || _this$_boardUserInfo === void 0 ? void 0 : _this$_boardUserInfo.userId) || '';
331
- }
332
- }, {
333
- key: "userName",
334
- get: function get() {
335
- var _this$_videoStream8, _this$_audioStream4, _this$_boardUserInfo2;
336
- return ((_this$_videoStream8 = this._videoStream) === null || _this$_videoStream8 === void 0 ? void 0 : _this$_videoStream8.owner.userName) || ((_this$_audioStream4 = this._audioStream) === null || _this$_audioStream4 === void 0 ? void 0 : _this$_audioStream4.owner.userName) || ((_this$_boardUserInfo2 = this._boardUserInfo) === null || _this$_boardUserInfo2 === void 0 ? void 0 : _this$_boardUserInfo2.userName) || '';
337
- }
338
- }, {
339
- key: "ownerRoleType",
340
- get: function get() {
341
- var _this$_videoStream9, _this$_audioStream5, _this$_boardUserInfo3;
342
- return ((_this$_videoStream9 = this._videoStream) === null || _this$_videoStream9 === void 0 ? void 0 : _this$_videoStream9.owner.userRole) || ((_this$_audioStream5 = this._audioStream) === null || _this$_audioStream5 === void 0 ? void 0 : _this$_audioStream5.owner.userRole) || ((_this$_boardUserInfo3 = this._boardUserInfo) === null || _this$_boardUserInfo3 === void 0 ? void 0 : _this$_boardUserInfo3.userRole) || _type2.FcrUserRole.AUDIENCE;
343
- }
344
- }, {
345
- key: "videoSourceType",
346
- get: function get() {
347
- var _this$_videoStream0;
348
- return ((_this$_videoStream0 = this._videoStream) === null || _this$_videoStream0 === void 0 ? void 0 : _this$_videoStream0.videoSourceType) || _fcrCore.FcrVideoSourceType.CAMERA;
349
- }
350
- }, {
351
- key: "audioSourceType",
352
- get: function get() {
353
- var _this$_audioStream6;
354
- return ((_this$_audioStream6 = this._audioStream) === null || _this$_audioStream6 === void 0 ? void 0 : _this$_audioStream6.audioSourceType) || _fcrCore.FcrAudioSourceType.MICROPHONE;
355
- }
356
- }, {
357
- key: "isMySelf",
358
- get: function get() {
359
- return this._isMySelf;
360
- }
361
- }, {
362
- key: "avatar",
363
- get: function get() {
364
- var _this$_videoStream1;
365
- // 如果是pstn没有头像
366
- // 其他用户取videoStream的owner的avatar
367
- if (this.audioStreamConnectorType === _fcrCore.FcrRoomConnectorType.PSTN) {
368
- return '';
369
- }
370
- return ((_this$_videoStream1 = this._videoStream) === null || _this$_videoStream1 === void 0 ? void 0 : _this$_videoStream1.owner.avatar) || '';
371
- }
372
- }, {
373
- key: "sortingPriority",
374
- get: function get() {
375
- if (this._placement === 'main-list') {
376
- var _this$_videoStream10;
377
- if (this.type === _type.FcrUIWindowType.BOARD && this._boardCanEdit) {
378
- return _type.FcrUIVideoWindowMainSortingPriority.HIGHEST;
379
- }
380
- if (this.isPin || ((_this$_videoStream10 = this._videoStream) === null || _this$_videoStream10 === void 0 ? void 0 : _this$_videoStream10.videoSourceType) === _fcrCore.FcrVideoSourceType.SCREEN || this.type === _type.FcrUIWindowType.BOARD) {
381
- return _type.FcrUIVideoWindowMainSortingPriority.FOCUS;
382
- }
383
- if (this.isSpeakerSpotlight) {
384
- return _type.FcrUIVideoWindowMainSortingPriority.SPEAKER_SPOTLIGHT;
385
- }
386
- if (this.hasScreenSharing) {
387
- return _type.FcrUIVideoWindowMainSortingPriority.SCREEN_SHARING_OWNER;
388
- }
389
- if (this.ownerRoleType === _type2.FcrUserRole.HOST) {
390
- return _type.FcrUIVideoWindowMainSortingPriority.HOST;
391
- }
392
- if (this.isMySelf) {
393
- return _type.FcrUIVideoWindowMainSortingPriority.MYSELF;
394
- }
395
- if (this.ownerRoleType === _type2.FcrUserRole.COHOST) {
396
- return _type.FcrUIVideoWindowMainSortingPriority.CO_HOST;
397
- }
398
- // if (this.hasMicrophoneAudioStream && this.hasVideoStream) {
399
- // return FcrUIVideoWindowMainSortingPriority.BOTH_OPEN;
400
- // }
401
- var isFirstCameraOpen = this.hasVideoStream && !this._isFirstCameraOpen;
402
- if (isFirstCameraOpen) {
403
- return _type.FcrUIVideoWindowMainSortingPriority.CAMERA_OPEN;
404
- }
405
- // if (this.hasMicrophoneAudioStream) {
406
- // return FcrUIVideoWindowMainSortingPriority.MICROPHONE_OPEN;
407
- // }
408
- } else {
409
- var _this$_videoStream11;
410
- if (this.isSpeakerSpotlight) {
411
- return _type.FcrUIVideoWindowFoldSortingPriority.FOCUS;
412
- }
413
- if (this.isPin) {
414
- return _type.FcrUIVideoWindowFoldSortingPriority.PIN;
415
- }
416
- if (((_this$_videoStream11 = this._videoStream) === null || _this$_videoStream11 === void 0 ? void 0 : _this$_videoStream11.videoSourceType) === _fcrCore.FcrVideoSourceType.SCREEN) {
417
- return _type.FcrUIVideoWindowFoldSortingPriority.SCREEN_SHARING_STREAM;
418
- }
419
- if (this.hasScreenSharing) {
420
- return _type.FcrUIVideoWindowFoldSortingPriority.SCREEN_SHARING_OWNER;
421
- }
422
- if (this.ownerRoleType === _type2.FcrUserRole.HOST) {
423
- return _type.FcrUIVideoWindowFoldSortingPriority.HOST;
424
- }
425
- if (this.isMySelf) {
426
- return _type.FcrUIVideoWindowFoldSortingPriority.MYSELF;
427
- }
428
- if (this.ownerRoleType === _type2.FcrUserRole.COHOST) {
429
- return _type.FcrUIVideoWindowFoldSortingPriority.CO_HOST;
430
- }
431
- // if (this.hasMicrophoneAudioStream && this.hasVideoStream) {
432
- // return FcrUIVideoWindowFoldSortingPriority.BOTH_OPEN;
433
- // }
434
- if (this.hasVideoStream) {
435
- return _type.FcrUIVideoWindowFoldSortingPriority.CAMERA_OPEN;
436
- }
437
- // if (this.hasMicrophoneAudioStream) {
438
- // return FcrUIVideoWindowFoldSortingPriority.MICROPHONE_OPEN;
439
- // }
440
- }
441
- return _type.FcrUIVideoWindowMainSortingPriority.NONE;
442
- }
443
- }, {
444
- key: "setLayoutType",
445
- value: function setLayoutType(layoutType) {
446
- this._layoutType = layoutType;
447
- }
448
- }, {
449
- key: "setIsFirstCameraOpen",
450
- value: function setIsFirstCameraOpen(isFirstCameraOpen) {
451
- this._isFirstCameraOpen = isFirstCameraOpen;
452
- }
453
- }, {
454
- key: "setVideoStream",
455
- value: function setVideoStream(videoStream) {
456
- this._videoStream = videoStream;
457
- }
458
- }, {
459
- key: "setVideoStreamOwnerInfo",
460
- value: function setVideoStreamOwnerInfo(userInfo) {
461
- if (this._videoStream) {
462
- this._videoStream.owner = userInfo;
463
- }
464
- }
465
- }, {
466
- key: "setAudioStream",
467
- value: function setAudioStream(audioStream) {
468
- this._audioStream = audioStream;
469
- }
470
- }, {
471
- key: "setAudioStreamOwnerInfo",
472
- value: function setAudioStreamOwnerInfo(userInfo) {
473
- if (this._audioStream) {
474
- this._audioStream.owner = userInfo;
475
- }
476
- }
477
- }, {
478
- key: "setPin",
479
- value: function setPin(pin) {
480
- this.isPin = pin;
481
- }
482
- }, {
483
- key: "setSpotlightEnabled",
484
- value: function setSpotlightEnabled(enabled) {
485
- this._spotlightEnabled = enabled;
486
- }
487
- }, {
488
- key: "setHasBoardSharing",
489
- value: function setHasBoardSharing(isSharing) {
490
- this.hasBoardSharing = isSharing;
491
- }
492
- }, {
493
- key: "setBoardUserInfo",
494
- value: function setBoardUserInfo(userInfo) {
495
- if (this.type === _type.FcrUIWindowType.BOARD) {
496
- this._boardUserInfo = userInfo;
497
- }
498
- }
499
- }, {
500
- key: "setSpeakerSpotlight",
501
- value: function setSpeakerSpotlight(speakerSpotlight) {
502
- this._isSpeakerSpotlight = speakerSpotlight;
503
- }
504
- }, {
505
- key: "setHasScreenSharing",
506
- value: function setHasScreenSharing(screenSharing) {
507
- this.hasScreenSharing = screenSharing;
508
- }
509
- }, {
510
- key: "setHasLoopbackSharing",
511
- value: function setHasLoopbackSharing(hasLoopbackSharing) {
512
- this.hasLoopbackSharing = hasLoopbackSharing;
513
- }
514
- }, {
515
- key: "setBoardCanEdit",
516
- value: function setBoardCanEdit(canEdit) {
517
- this._boardCanEdit = canEdit;
518
- }
519
- }, {
520
- key: "getVideoStream",
521
- value: function getVideoStream() {
522
- return this._videoStream;
523
- }
524
- }]);
525
- }();
526
- _FcrUIVideoWindowDataImpl = FcrUIVideoWindowDataImpl;
527
- var _applyDecs$e = (0, _slicedToArray2["default"])(_applyDecs(_FcrUIVideoWindowDataImpl, [[_mobx.observable, 1, "_boardUserInfo"], [_mobx.observable, 1, "_videoStream"], [_mobx.observable, 1, "_audioStream"], [_mobx.observable, 1, "_spotlightEnabled"], [_mobx.observable, 1, "_isSpeakerSpotlight"], [_mobx.observable, 1, "_boardCanEdit"], [_mobx.observable, 1, "_isFirstCameraOpen"], [_mobx.observable, 1, "isPin"], [_mobx.observable, 1, "hasScreenSharing"], [_mobx.observable, 1, "hasBoardSharing"], [_mobx.observable, 1, "hasLoopbackSharing"], [_mobx.computed, 3, "isSpeakerSpotlight"], [_mobx.computed, 3, "windowId"], [_mobx.computed, 3, "videoStreamId"], [_mobx.computed, 3, "audioStreamId"], [_mobx.computed, 3, "audioStreamConnectorType"], [_mobx.computed, 3, "videoStreamConnectorType"], [_mobx.computed, 3, "hasMicrophoneAudioStream"], [_mobx.computed, 3, "hasLoopbackAudioStream"], [_mobx.computed, 3, "phoneMicEnabled"], [_mobx.computed, 3, "hasVideoStream"], [_mobx.computed, 3, "hasBoard"], [_mobx.computed, 3, "userId"], [_mobx.computed, 3, "ownerRoleType"], [_mobx.computed, 3, "videoSourceType"], [_mobx.computed, 3, "audioSourceType"], [_mobx.computed, 3, "avatar"], [_mobx.computed, 3, "sortingPriority"], [_setVideoStreamDecs, 18, "setVideoStream"], [_setVideoStreamOwnerInfoDecs, 18, "setVideoStreamOwnerInfo"], [_setAudioStreamDecs, 18, "setAudioStream"], [_setAudioStreamOwnerInfoDecs, 18, "setAudioStreamOwnerInfo"], [_setPinDecs, 18, "setPin"], [_setSpotlightEnabledDecs, 18, "setSpotlightEnabled"], [_setHasBoardSharingDecs, 18, "setHasBoardSharing"], [_setBoardUserInfoDecs, 18, "setBoardUserInfo"], [_setSpeakerSpotlightDecs, 18, "setSpeakerSpotlight"], [_setHasScreenSharingDecs, 18, "setHasScreenSharing"], [_setHasLoopbackSharingDecs, 18, "setHasLoopbackSharing"], [_setBoardCanEditDecs, 18, "setBoardCanEdit"], [_getVideoStreamDecs, 18, "getVideoStream"]], []).e, 12);
528
- _init__boardUserInfo = _applyDecs$e[0];
529
- _init__videoStream = _applyDecs$e[1];
530
- _init__audioStream = _applyDecs$e[2];
531
- _init__spotlightEnabled = _applyDecs$e[3];
532
- _init__isSpeakerSpotlight = _applyDecs$e[4];
533
- _init__boardCanEdit = _applyDecs$e[5];
534
- _init__isFirstCameraOpen = _applyDecs$e[6];
535
- _init_isPin = _applyDecs$e[7];
536
- _init_hasScreenSharing = _applyDecs$e[8];
537
- _init_hasBoardSharing = _applyDecs$e[9];
538
- _init_hasLoopbackSharing = _applyDecs$e[10];
539
- _initProto = _applyDecs$e[11];
540
- var _A2 = /*#__PURE__*/new WeakMap();
541
- var _B2 = /*#__PURE__*/new WeakMap();
542
- var _C2 = /*#__PURE__*/new WeakMap();
543
- var _D2 = /*#__PURE__*/new WeakMap();
544
- var _E2 = /*#__PURE__*/new WeakMap();
545
- var _F2 = /*#__PURE__*/new WeakMap();
546
- var _G2 = /*#__PURE__*/new WeakMap();
547
- var _H2 = /*#__PURE__*/new WeakMap();
548
- var _I2 = /*#__PURE__*/new WeakMap();
549
- _ref5 = (_setSpotlightEnabledDecs2 = [_mobx.action, _mobx.action.bound], _setLayoutDecs = [_mobx.action, _mobx.action.bound], _onSpotlightRemovedDecs = [_mobx.action, _mobx.action.bound], _resetListDecs = [_mobx.action, _mobx.action.bound], _addBoardDecs = [_mobx.action, _mobx.action.bound], _updateBoardDecs = [_mobx.action, _mobx.action.bound], _removeBoardDecs = [_mobx.action, _mobx.action.bound], _mergePstnStreamOrInsertNewDataDecs = [_mobx.action, _mobx.action.bound], _addDecs = [_mobx.action, _mobx.action.bound], _updateDecs = [_mobx.action, _mobx.action.bound], _deleteDecs = [_mobx.action, _mobx.action.bound], _addPinDecs = [_mobx.action, _mobx.action.bound], _updateSpeakerSpotlightPositionDecs = [_mobx.action, _mobx.action.bound], _removePinDecs = [_mobx.action, _mobx.action.bound], _setSpeakerSpotlightDecs2 = [_mobx.action, _mobx.action.bound], _toggleMainStreamDecs = [_mobx.action, _mobx.action.bound], _insertBeginningByPriorityDecs = [_mobx.action, _mobx.action.bound], _insertEndByPriorityDecs = [_mobx.action, _mobx.action.bound], _findInsertBeginningIndexDecs = [_mobx.action, _mobx.action.bound], _findInsertEndIndexDecs = [_mobx.action, _mobx.action.bound], _insertBoardDecs = [_mobx.action, _mobx.action.bound], _insertNewDataDecs = [_mobx.action, _mobx.action.bound], "_observer");
550
- var FcrUIVideoWindowDataSourceImpl = exports.FcrUIVideoWindowDataSourceImpl = /*#__PURE__*/function () {
551
- function FcrUIVideoWindowDataSourceImpl(_sharedSettingDataSource) {
552
- (0, _classCallCheck2["default"])(this, FcrUIVideoWindowDataSourceImpl);
553
- (0, _defineProperty2["default"])(this, _ref5, (_initProto2(this), new _observable.AgoraObservable()));
554
- (0, _defineProperty2["default"])(this, "_spotlightPool", new FcrUISpeakerSpotlightPool());
555
- _classPrivateFieldInitSpec(this, _A2, _init_spotlightEnabled(this, true));
556
- _classPrivateFieldInitSpec(this, _B2, _init_layoutType(this, _type.FcrUIVideoWindowLayoutType.Gallery));
557
- _classPrivateFieldInitSpec(this, _C2, _init_manualLayout(this, undefined));
558
- _classPrivateFieldInitSpec(this, _D2, _init_pinLimitedCount(this, 1));
559
- _classPrivateFieldInitSpec(this, _E2, _init_mainListLimitedCount(this, 255));
560
- _classPrivateFieldInitSpec(this, _F2, _init_foldListLimitedCount(this, 255));
561
- _classPrivateFieldInitSpec(this, _G2, _init_mainList(this, []));
562
- _classPrivateFieldInitSpec(this, _H2, _init_foldList(this, []));
563
- _classPrivateFieldInitSpec(this, _I2, _init_spotlightStreamId(this, ''));
564
- this._sharedSettingDataSource = _sharedSettingDataSource;
565
- this.spotlightEnabled = _sharedSettingDataSource.setting.spotlightEnabled;
566
- this._spotlightPool.addObserver({
567
- onRemoved: this.onSpotlightRemoved
568
- });
569
- }
570
- return (0, _createClass2["default"])(FcrUIVideoWindowDataSourceImpl, [{
571
- key: "spotlightEnabled",
572
- get: function get() {
573
- return _classPrivateFieldGet(_A2, this);
574
- },
575
- set: function set(v) {
576
- _classPrivateFieldSet(_A2, this, v);
577
- }
578
- }, {
579
- key: "layoutType",
580
- get: function get() {
581
- return _classPrivateFieldGet(_B2, this);
582
- },
583
- set: function set(v) {
584
- _classPrivateFieldSet(_B2, this, v);
585
- }
586
- }, {
587
- key: "manualLayout",
588
- get: function get() {
589
- return _classPrivateFieldGet(_C2, this);
590
- },
591
- set: function set(v) {
592
- _classPrivateFieldSet(_C2, this, v);
593
- }
594
- }, {
595
- key: "pinLimitedCount",
596
- get: function get() {
597
- return _classPrivateFieldGet(_D2, this);
598
- },
599
- set: function set(v) {
600
- _classPrivateFieldSet(_D2, this, v);
601
- }
602
- }, {
603
- key: "mainListLimitedCount",
604
- get: function get() {
605
- return _classPrivateFieldGet(_E2, this);
606
- },
607
- set: function set(v) {
608
- _classPrivateFieldSet(_E2, this, v);
609
- }
610
- }, {
611
- key: "foldListLimitedCount",
612
- get: function get() {
613
- return _classPrivateFieldGet(_F2, this);
614
- },
615
- set: function set(v) {
616
- _classPrivateFieldSet(_F2, this, v);
617
- }
618
- }, {
619
- key: "mainList",
620
- get: function get() {
621
- return _classPrivateFieldGet(_G2, this);
622
- },
623
- set: function set(v) {
624
- _classPrivateFieldSet(_G2, this, v);
625
- }
626
- }, {
627
- key: "foldList",
628
- get: function get() {
629
- return _classPrivateFieldGet(_H2, this);
630
- },
631
- set: function set(v) {
632
- _classPrivateFieldSet(_H2, this, v);
633
- }
634
- }, {
635
- key: "spotlightStreamId",
636
- get: function get() {
637
- return _classPrivateFieldGet(_I2, this);
638
- },
639
- set: function set(v) {
640
- _classPrivateFieldSet(_I2, this, v);
641
- }
642
- }, {
643
- key: "shouldHideNonVideoParticipants",
644
- get: function get() {
645
- return this._sharedSettingDataSource.setting.shouldHideNonVideoParticipants || false;
646
- }
647
- }, {
648
- key: "setSpotlightEnabled",
649
- value: function setSpotlightEnabled(enabled) {
650
- var _this = this;
651
- var currentSpeakerSpotlightIndex_mainList = this._findCurrentSpeakerSpotlight(this.mainList);
652
- var currentSpeakerSpotlightIndex_foldList = this._findCurrentSpeakerSpotlight(this.foldList);
653
- this.spotlightEnabled = enabled;
654
- this.mainList.forEach(function (item) {
655
- item.setSpotlightEnabled(enabled);
656
- });
657
- this.foldList.forEach(function (item) {
658
- item.setSpotlightEnabled(enabled);
659
- });
660
- this._spotlightPool.streams.forEach(function (_ts, streamId) {
661
- _this.setSpeakerSpotlight(streamId);
662
- });
663
- // update speaker spotlight position
664
- this._updateSpeakerSpotlightPosition(currentSpeakerSpotlightIndex_mainList, this.mainList, this.mainListLimitedCount, 'main-list');
665
- this._updateSpeakerSpotlightPosition(currentSpeakerSpotlightIndex_foldList, this.foldList, this.foldListLimitedCount, 'fold-list');
666
- }
667
- }, {
668
- key: "setLayout",
669
- value: function setLayout(layout, manual) {
670
- var _this2 = this;
671
- if (manual) {
672
- this.manualLayout = layout;
673
- }
674
- var windowList = this.mainList.filter(function (item) {
675
- if (_this2.shouldHideNonVideoParticipants) {
676
- return item.hasVideoStream;
677
- }
678
- return true;
679
- });
680
- // 有白板共享时,即使隐藏了未开启视频的参数者,数量总是大于等于2,不应提前return,setLayout失效
681
- var boardInShow = this.mainList.some(function (item) {
682
- return item.hasBoard;
683
- });
684
- if (this.layoutType === _type.FcrUIVideoWindowLayoutType.Gallery && layout === _type.FcrUIVideoWindowLayoutType.Speaker && windowList.length < 2 && !boardInShow || this.layoutType === layout) {
685
- return;
686
- }
687
- this.layoutType = layout;
688
- this._observer.notifyObservers('onLayoutUpdated', layout);
689
- this.mainList.forEach(function (item) {
690
- item.setLayoutType(layout);
691
- });
692
- this.foldList.forEach(function (item) {
693
- item.setLayoutType(layout);
694
- });
695
- // if (layout === FcrUIVideoWindowLayoutType.Gallery) {
696
- // this.resetList();
697
- // }
698
- }
699
- }, {
700
- key: "onSpotlightRemoved",
701
- value: function onSpotlightRemoved(streamId) {
702
- var _this3 = this;
703
- var removeSpotlight = function removeSpotlight(streamId, list) {
704
- var index = _this3._findItemIndexWithWindowId(streamId, list);
705
- if (index !== -1) {
706
- var item = list[index];
707
- if (item) {
708
- item.setSpeakerSpotlight(false);
709
- if (_this3.layoutType === _type.FcrUIVideoWindowLayoutType.Speaker) {
710
- item.needToSort = true;
711
- }
712
- }
713
- }
714
- };
715
- removeSpotlight(streamId, this.mainList);
716
- removeSpotlight(streamId, this.foldList);
717
- this.spotlightStreamId = '';
718
- this._observer.notifyObservers('onSpotlightRemoved', streamId);
719
- }
720
- }, {
721
- key: "resetList",
722
- value: function resetList() {
723
- this.mainList = this.mainList.sort(function (a, b) {
724
- return b.sortingPriority - a.sortingPriority;
725
- });
726
- this.foldList = this.foldList.sort(function (a, b) {
727
- return b.sortingPriority - a.sortingPriority;
728
- });
729
- this._observer.notifyObservers('onMainListUpdated', -1);
730
- this._observer.notifyObservers('onFoldListUpdated', -1);
731
- }
732
- }, {
733
- key: "addBoard",
734
- value: function addBoard(userInfo, isMySelf, canEdit) {
735
- this._insertBoard(userInfo, this.mainList, this.mainListLimitedCount, isMySelf, 'main-list', canEdit);
736
- this._syncHasScreenSharing(true, true, userInfo.userId, this.mainList, this.mainListLimitedCount, 'main-list');
737
- this._syncHasScreenSharing(true, true, userInfo.userId, this.foldList, this.foldListLimitedCount, 'fold-list');
738
- }
739
- }, {
740
- key: "updateBoard",
741
- value: function updateBoard(canEdit) {
742
- var windowData = this.mainList.find(function (item) {
743
- return item.type === _type.FcrUIWindowType.BOARD;
744
- });
745
- windowData === null || windowData === void 0 || windowData.setBoardCanEdit(canEdit);
746
- var insertIndex = this._insertByPriority(windowData, this.mainList, this.mainListLimitedCount);
747
- this._observer.notifyObservers('onMainListUpdated', insertIndex);
748
- }
749
- }, {
750
- key: "removeBoard",
751
- value: function removeBoard() {
752
- var boardIndex = this.mainList.findIndex(function (i) {
753
- return i.type === _type.FcrUIWindowType.BOARD;
754
- });
755
- if (boardIndex !== -1) {
756
- var board = this.mainList[boardIndex];
757
- this.mainList.splice(boardIndex, 1);
758
- this._syncHasScreenSharing(false, false, board.userId, this.mainList, this.mainListLimitedCount, 'main-list');
759
- this._syncHasScreenSharing(false, false, board.userId, this.foldList, this.foldListLimitedCount, 'fold-list');
760
- }
761
- }
762
- }, {
763
- key: "_mergePstnStreamOrInsertNewData",
764
- value: function _mergePstnStreamOrInsertNewData(stream, list, limitCount, isMySelf, placement) {
765
- var existedUserPstnStream = list.find(function (item) {
766
- return item.userId === stream.owner.userId && item.audioStreamConnectorType === _fcrCore.FcrRoomConnectorType.PSTN;
767
- });
768
- if (existedUserPstnStream) {
769
- existedUserPstnStream.setVideoStream(stream);
770
- } else {
771
- this._insertNewData(stream, list, limitCount, isMySelf, placement);
772
- }
773
- }
774
- }, {
775
- key: "add",
776
- value: function add(stream, isMySelf) {
777
- var _this4 = this;
778
- var streamCopy = this.copyStreamInfo(stream);
779
- if (streamCopy.connectorType === _fcrCore.FcrRoomConnectorType.PSTN) {
780
- var handlePSTNStreamAdded = function handlePSTNStreamAdded(stream, list, limitCount, isMySelf, placement) {
781
- var existedUserStream = list.find(function (item) {
782
- return item.userId === stream.owner.userId && item.videoSourceType === _fcrCore.FcrVideoSourceType.CAMERA;
783
- });
784
- if (existedUserStream) {
785
- existedUserStream.setAudioStream(stream);
786
- } else {
787
- _this4._insertNewData(stream, list, limitCount, isMySelf, placement);
788
- }
789
- };
790
- handlePSTNStreamAdded(streamCopy, this.mainList, this.mainListLimitedCount, isMySelf, 'main-list');
791
- handlePSTNStreamAdded(streamCopy, this.foldList, this.foldListLimitedCount, isMySelf, 'fold-list');
792
- } else {
793
- this._mergePstnStreamOrInsertNewData(streamCopy, this.mainList, this.mainListLimitedCount, isMySelf, 'main-list');
794
- this._mergePstnStreamOrInsertNewData(streamCopy, this.foldList, this.foldListLimitedCount, isMySelf, 'fold-list');
795
- }
796
- var hasScreenSharing = streamCopy.videoSourceType === _fcrCore.FcrVideoSourceType.SCREEN || this.mainList.some(function (item) {
797
- return item.hasScreenSharing && item.userId === streamCopy.owner.userId;
798
- });
799
- this._syncHasScreenSharing(hasScreenSharing, false, streamCopy.owner.userId, this.mainList, this.mainListLimitedCount, 'main-list');
800
- this._syncHasScreenSharing(hasScreenSharing, false, streamCopy.owner.userId, this.foldList, this.foldListLimitedCount, 'fold-list');
801
- }
802
- }, {
803
- key: "update",
804
- value: function update(param) {
805
- var _this5 = this;
806
- var handleStreamInfoUpdated = function handleStreamInfoUpdated(stream, list, limitCount, placement) {
807
- var existedUserStream = list[_this5._findItemIndexWithWindowId(stream.streamId, list)];
808
- if (existedUserStream) {
809
- var oldSortingPriority = existedUserStream.sortingPriority;
810
- if (param.connectorType === _fcrCore.FcrRoomConnectorType.PSTN) {
811
- existedUserStream.setAudioStream(stream);
812
- } else {
813
- existedUserStream.setVideoStream(stream);
814
- }
815
- var newSortingPriority = existedUserStream.sortingPriority;
816
- if (oldSortingPriority !== newSortingPriority) {
817
- var index = _this5._insertByPriority(existedUserStream, list, limitCount);
818
- _this5._observer.notifyObservers(placement === 'main-list' ? 'onMainListUpdated' : 'onFoldListUpdated', index);
819
- }
820
- }
821
- };
822
- var handleUserInfoUpdated = function handleUserInfoUpdated(user, list, limitCount, placement) {
823
- var modifiedItems = [];
824
- list.forEach(function (item) {
825
- if (item.userId === user.userId) {
826
- var oldSortingPriority = item.sortingPriority;
827
- item.setVideoStreamOwnerInfo(user);
828
- item.setAudioStreamOwnerInfo(user);
829
- item.setBoardUserInfo(user);
830
- var newSortingPriority = item.sortingPriority;
831
- if (oldSortingPriority !== newSortingPriority) {
832
- modifiedItems.push(item);
833
- }
834
- }
835
- });
836
- modifiedItems.forEach(function (item) {
837
- var index = _this5._insertByPriority(item, list, limitCount);
838
- _this5._observer.notifyObservers(placement === 'main-list' ? 'onMainListUpdated' : 'onFoldListUpdated', index);
839
- });
840
- };
841
- if ('streamId' in param) {
842
- var streamCopy = this.copyStreamInfo(param);
843
- handleStreamInfoUpdated(streamCopy, this.mainList, this.mainListLimitedCount, 'main-list');
844
- handleStreamInfoUpdated(streamCopy, this.foldList, this.foldListLimitedCount, 'fold-list');
845
- } else {
846
- handleUserInfoUpdated(param, this.mainList, this.mainListLimitedCount, 'main-list');
847
- handleUserInfoUpdated(param, this.foldList, this.foldListLimitedCount, 'fold-list');
848
- }
849
- }
850
- }, {
851
- key: "delete",
852
- value: function _delete(stream) {
853
- var _this6 = this;
854
- var streamCopy = this.copyStreamInfo(stream);
855
- var handlePSTNStreamDeleted = function handlePSTNStreamDeleted(stream, list, placement) {
856
- var index = _this6._findItemIndexWithAudioStreamId(stream.streamId, list);
857
- var existedUserStream = list[index];
858
- if (existedUserStream) {
859
- if (existedUserStream.videoStreamId) {
860
- existedUserStream.setAudioStream(undefined);
861
- _this6._observer.notifyObservers(placement === 'main-list' ? 'onMainListUpdated' : 'onFoldListUpdated', index);
862
- } else {
863
- list.splice(index, 1);
864
- _this6._observer.notifyObservers(placement === 'main-list' ? 'onMainListRemoved' : 'onFoldListRemoved', index);
865
- }
866
- }
867
- };
868
- if (stream.connectorType === _fcrCore.FcrRoomConnectorType.PSTN) {
869
- handlePSTNStreamDeleted(streamCopy, this.mainList, 'main-list');
870
- handlePSTNStreamDeleted(streamCopy, this.foldList, 'fold-list');
871
- } else {
872
- var handleVideoStreamDeleted = function handleVideoStreamDeleted(streamId, list, placement) {
873
- var existStreamIndex = list.findIndex(function (item) {
874
- return item.videoStreamId === streamId;
875
- });
876
- if (existStreamIndex === -1) {
877
- return;
878
- }
879
- list.splice(existStreamIndex, 1);
880
- _this6._observer.notifyObservers(placement === 'main-list' ? 'onMainListRemoved' : 'onFoldListRemoved', existStreamIndex);
881
- };
882
- handleVideoStreamDeleted(streamCopy.streamId, this.mainList, 'main-list');
883
- handleVideoStreamDeleted(streamCopy.streamId, this.foldList, 'fold-list');
884
- }
885
- // if it is the last screen share stream of the user, remove the screen sharing flag
886
-
887
- if (stream.videoSourceType === _fcrCore.FcrVideoSourceType.SCREEN) {
888
- this._syncHasScreenSharing(false, false, streamCopy.owner.userId, this.mainList, this.mainListLimitedCount, 'main-list');
889
- this._syncHasScreenSharing(false, false, streamCopy.owner.userId, this.foldList, this.foldListLimitedCount, 'fold-list');
890
- }
891
- }
892
- }, {
893
- key: "addPin",
894
- value: function addPin(streamId) {
895
- var _this7 = this;
896
- var handlePin = function handlePin(streamId, list, limitCount, placement) {
897
- var existedUserStreamIndex = _this7._findItemIndexWithWindowId(streamId, list);
898
- var existedUserStream = list[existedUserStreamIndex];
899
- if (!existedUserStream || existedUserStream !== null && existedUserStream !== void 0 && existedUserStream.isPin) {
900
- return false;
901
- }
902
- var currentPinStreams = list.filter(function (item) {
903
- return item.isPin;
904
- });
905
- if (currentPinStreams.length >= _this7.pinLimitedCount) {
906
- var lastPinStream = currentPinStreams[currentPinStreams.length - 1];
907
- var _streamId = lastPinStream.videoStreamId || lastPinStream.audioStreamId;
908
- if (_streamId) {
909
- _this7.removePin(_streamId);
910
- }
911
- }
912
- existedUserStream.setPin(true);
913
- _this7._insertBeginningByPriority(existedUserStream, list, limitCount);
914
- _this7._observer.notifyObservers(placement === 'main-list' ? 'onMainListUpdated' : 'onFoldListUpdated', existedUserStreamIndex);
915
- return true;
916
- };
917
- var success = handlePin(streamId, this.mainList, this.mainListLimitedCount, 'main-list');
918
- handlePin(streamId, this.foldList, this.foldListLimitedCount, 'fold-list');
919
- return success;
920
- }
921
- }, {
922
- key: "_updateSpeakerSpotlightPosition",
923
- value: function _updateSpeakerSpotlightPosition(index, list, limitCount, placement) {
924
- var existedUserStream = list[index];
925
- if (!existedUserStream) {
926
- return;
927
- }
928
- this._insertByPriority(existedUserStream, list, limitCount);
929
- this._observer.notifyObservers(placement === 'main-list' ? 'onMainListUpdated' : 'onFoldListUpdated', index);
930
- }
931
- }, {
932
- key: "removePin",
933
- value: function removePin(streamId) {
934
- var _this8 = this;
935
- var handleRemovePin = function handleRemovePin(streamId, list, limitCount, placement) {
936
- var existedUserStreamIndex = _this8._findItemIndexWithWindowId(streamId, list);
937
- var existedUserStream = list[existedUserStreamIndex];
938
- if (!(existedUserStream !== null && existedUserStream !== void 0 && existedUserStream.isPin)) {
939
- return;
940
- }
941
- existedUserStream.setPin(false);
942
- _this8._insertByPriority(existedUserStream, list, limitCount);
943
- _this8._observer.notifyObservers(placement === 'main-list' ? 'onMainListUpdated' : 'onFoldListUpdated', existedUserStreamIndex);
944
- return true;
945
- };
946
- var removePinMainRes = handleRemovePin(streamId, this.mainList, this.mainListLimitedCount, 'main-list');
947
- var removePinFoldRes = handleRemovePin(streamId, this.foldList, this.foldListLimitedCount, 'fold-list');
948
- return removePinMainRes && removePinFoldRes;
949
- }
950
- }, {
951
- key: "setSpeakerSpotlight",
952
- value: function setSpeakerSpotlight(streamId) {
953
- var _this9 = this;
954
- var checkStreamExist = function checkStreamExist(streamId) {
955
- return _this9._findItemIndexWithWindowId(streamId, _this9.mainList) !== -1 && _this9._findItemIndexWithWindowId(streamId, _this9.foldList) !== -1;
956
- };
957
- if (!checkStreamExist(streamId)) return;
958
- var isRefreshSpotlight = this._spotlightPool.streams.has(streamId);
959
- var success = this._spotlightPool.add(streamId);
960
- if (!success || isRefreshSpotlight) {
961
- return;
962
- }
963
- var setSpeakerSpotlight = function setSpeakerSpotlight(streamId, list, limitCount, placement) {
964
- var existedUserStreamIndex = _this9._findItemIndexWithWindowId(streamId, list);
965
- var existedUserStream = list[existedUserStreamIndex];
966
- if (existedUserStream) {
967
- existedUserStream.setSpeakerSpotlight(true);
968
- }
969
- var isSpeakerSpotlightSortingPriority = existedUserStream.sortingPriority === (placement === 'main-list' ? _type.FcrUIVideoWindowMainSortingPriority.SPEAKER_SPOTLIGHT : _type.FcrUIVideoWindowFoldSortingPriority.FOCUS);
970
- if (isSpeakerSpotlightSortingPriority) {
971
- _this9._insertBeginningByPriority(existedUserStream, list, limitCount);
972
- }
973
- list.forEach(function (item) {
974
- if (item.needToSort) {
975
- _this9._insertByPriority(item, list, limitCount);
976
- }
977
- });
978
- _this9._observer.notifyObservers(placement === 'main-list' ? 'onMainListUpdated' : 'onFoldListUpdated', existedUserStreamIndex);
979
- };
980
- setSpeakerSpotlight(streamId, this.mainList, this.mainListLimitedCount, 'main-list');
981
- setSpeakerSpotlight(streamId, this.foldList, this.foldListLimitedCount, 'fold-list');
982
- this._observer.notifyObservers('onSpotlightAdded', streamId);
983
- this.spotlightStreamId = streamId;
984
- }
985
- }, {
986
- key: "toggleMainStream",
987
- value: function toggleMainStream(windowId) {
988
- var streamIndex = this._findItemIndexWithWindowId(windowId, this.mainList);
989
- if (streamIndex === -1) {
990
- return false;
991
- }
992
- var streamData = this.mainList[streamIndex];
993
- // bring the stream to the start of the list
994
- this.mainList.splice(streamIndex, 1);
995
- this.mainList.unshift(streamData);
996
- this._observer.notifyObservers('onMainListUpdated', streamIndex);
997
- return true;
998
- }
999
- }, {
1000
- key: "clearSpeakerSpotlight",
1001
- value: function clearSpeakerSpotlight() {
1002
- this._spotlightPool.clear();
1003
- }
1004
- }, {
1005
- key: "addObserver",
1006
- value: function addObserver(observer) {
1007
- this._observer.addObserver(observer);
1008
- }
1009
- }, {
1010
- key: "removeObserver",
1011
- value: function removeObserver(observer) {
1012
- this._observer.removeObserver(observer);
1013
- }
1014
- }, {
1015
- key: "release",
1016
- value: function release() {
1017
- this._spotlightPool.clear();
1018
- }
1019
- }, {
1020
- key: "copyStreamInfo",
1021
- value: function copyStreamInfo(stream) {
1022
- var streamCopy = Object.assign({}, stream);
1023
- return streamCopy;
1024
- }
1025
- }, {
1026
- key: "_syncHasScreenSharing",
1027
- value: function _syncHasScreenSharing(enable, hasBoardSharing, userId, list, limitCount, placement) {
1028
- var _this0 = this;
1029
- if (enable) {
1030
- list.forEach(function (item, index) {
1031
- if (item.userId === userId) {
1032
- var itemIndex = index;
1033
- var originalPriority = item.sortingPriority;
1034
- item.setHasScreenSharing(enable);
1035
- item.setHasBoardSharing(hasBoardSharing);
1036
- if (item.sortingPriority !== originalPriority) {
1037
- itemIndex = _this0._insertByPriority(item, list, limitCount);
1038
- }
1039
- _this0._observer.notifyObservers(placement === 'main-list' ? 'onMainListUpdated' : 'onFoldListUpdated', itemIndex);
1040
- var hasLoopbackAudioStream = _this0 === null || _this0 === void 0 ? void 0 : _this0.mainList.some(function (item) {
1041
- return item.userId === userId && item.hasScreenSharing && item.hasLoopbackAudioStream;
1042
- });
1043
- item.setHasLoopbackSharing(hasLoopbackAudioStream);
1044
- }
1045
- });
1046
- } else {
1047
- var remainingShare = list.some(function (item) {
1048
- return item.userId === userId && (item.type === _type.FcrUIWindowType.BOARD || item.videoSourceType === _fcrCore.FcrVideoSourceType.SCREEN);
1049
- });
1050
- if (!remainingShare) {
1051
- list.forEach(function (item) {
1052
- if (item.userId === userId) {
1053
- item.setHasScreenSharing(enable);
1054
- item.setHasBoardSharing(hasBoardSharing);
1055
- var index = _this0._insertByPriority(item, list, limitCount);
1056
- _this0._observer.notifyObservers(placement === 'main-list' ? 'onMainListUpdated' : 'onFoldListUpdated', index);
1057
- }
1058
- });
1059
- }
1060
- }
1061
- }
1062
- }, {
1063
- key: "_insertByPriority",
1064
- value: function _insertByPriority(data, list, limitCount) {
1065
- var insertIndex = -1;
1066
- if (data.sortingPriority >= _type.FcrUIVideoWindowMainSortingPriority.FOCUS) {
1067
- insertIndex = this._insertBeginningByPriority(data, list, limitCount);
1068
- } else {
1069
- insertIndex = this._insertEndByPriority(data, list, limitCount);
1070
- }
1071
- if (data.hasVideoStream) {
1072
- data.setIsFirstCameraOpen(true);
1073
- }
1074
- return insertIndex;
1075
- }
1076
- }, {
1077
- key: "_insertBeginningByPriority",
1078
- value: function _insertBeginningByPriority(data, list, limitedCount) {
1079
- var currentIndex = this._findItemIndexWithWindowId(data.windowId, list);
1080
- if (currentIndex !== -1) {
1081
- list.splice(currentIndex, 1);
1082
- }
1083
- var index = this._findInsertBeginningIndex(data.sortingPriority, list);
1084
- list.splice(index, 0, data);
1085
- if (list.length > limitedCount) {
1086
- list.splice(limitedCount);
1087
- }
1088
- data.needToSort = false;
1089
- return index;
1090
- }
1091
- }, {
1092
- key: "_insertEndByPriority",
1093
- value: function _insertEndByPriority(data, list, limitedCount) {
1094
- var currentIndex = this._findItemIndexWithWindowId(data.windowId, list);
1095
- if (currentIndex !== -1) {
1096
- list.splice(currentIndex, 1);
1097
- }
1098
- var index = this._findInsertEndIndex(data.sortingPriority, list);
1099
- list.splice(index, 0, data);
1100
- if (list.length > limitedCount) {
1101
- list.splice(limitedCount);
1102
- }
1103
- data.needToSort = false;
1104
- return index;
1105
- }
1106
- }, {
1107
- key: "_findInsertBeginningIndex",
1108
- value: function _findInsertBeginningIndex(priority, list) {
1109
- // list is sorted by priority
1110
- var index = list.findIndex(function (item) {
1111
- return item.sortingPriority <= priority;
1112
- });
1113
- if (index === -1) {
1114
- return list.length;
1115
- } else {
1116
- return index;
1117
- }
1118
- }
1119
- }, {
1120
- key: "_findInsertEndIndex",
1121
- value: function _findInsertEndIndex(priority, list) {
1122
- // list is sorted by priority
1123
- var index = list.findLastIndex(function (item) {
1124
- return item.sortingPriority >= priority;
1125
- });
1126
- if (index === -1) {
1127
- return 0;
1128
- } else {
1129
- return index + 1;
1130
- }
1131
- }
1132
- }, {
1133
- key: "_findCurrentSpeakerSpotlight",
1134
- value: function _findCurrentSpeakerSpotlight(list) {
1135
- return list.findIndex(function (item) {
1136
- return item.isSpeakerSpotlight;
1137
- });
1138
- }
1139
- }, {
1140
- key: "_findItemIndexWithWindowId",
1141
- value: function _findItemIndexWithWindowId(windowId, list) {
1142
- return list.findIndex(function (item) {
1143
- return item.windowId === windowId;
1144
- });
1145
- }
1146
- }, {
1147
- key: "_findItemIndexWithAudioStreamId",
1148
- value: function _findItemIndexWithAudioStreamId(audioStreamId, list) {
1149
- return list.findIndex(function (item) {
1150
- return item.audioStreamId === audioStreamId;
1151
- });
1152
- }
1153
- }, {
1154
- key: "_insertBoard",
1155
- value: function _insertBoard(userInfo, list, limitCount, isMySelf, placement) {
1156
- var canEdit = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : false;
1157
- var windowData = new FcrUIVideoWindowDataImpl(_type.FcrUIWindowType.BOARD, {
1158
- boardUserInfo: userInfo
1159
- }, placement, isMySelf, this.layoutType, this.spotlightEnabled, canEdit);
1160
- var insertIndex = this._insertByPriority(windowData, list, limitCount);
1161
- this._observer.notifyObservers(placement === 'main-list' ? 'onMainListAdded' : 'onFoldListAdded', insertIndex);
1162
- }
1163
- }, {
1164
- key: "_insertNewData",
1165
- value: function _insertNewData(stream, list, limitCount, isMySelf, placement) {
1166
- var videoWindowData = new FcrUIVideoWindowDataImpl(_type.FcrUIWindowType.VIDEO, stream.connectorType === _fcrCore.FcrRoomConnectorType.PSTN ? {
1167
- audioStream: stream
1168
- } : {
1169
- videoStream: stream
1170
- }, placement, isMySelf, this.layoutType, this.spotlightEnabled);
1171
- var insertIndex = this._insertByPriority(videoWindowData, list, limitCount);
1172
- this._observer.notifyObservers(placement === 'main-list' ? 'onMainListAdded' : 'onFoldListAdded', insertIndex);
1173
- }
1174
- }]);
1175
- }();
1176
- _FcrUIVideoWindowDataSourceImpl = FcrUIVideoWindowDataSourceImpl;
1177
- var _applyDecs$e2 = (0, _slicedToArray2["default"])(_applyDecs(_FcrUIVideoWindowDataSourceImpl, [[_mobx.observable, 1, "spotlightEnabled"], [_mobx.observable, 1, "layoutType"], [_mobx.observable, 1, "manualLayout"], [_mobx.observable, 1, "pinLimitedCount"], [_mobx.observable, 1, "mainListLimitedCount"], [_mobx.observable, 1, "foldListLimitedCount"], [_mobx.observable, 1, "mainList"], [_mobx.observable, 1, "foldList"], [_mobx.observable, 1, "spotlightStreamId"], [_mobx.computed, 3, "shouldHideNonVideoParticipants"], [_setSpotlightEnabledDecs2, 18, "setSpotlightEnabled"], [_setLayoutDecs, 18, "setLayout"], [_onSpotlightRemovedDecs, 18, "onSpotlightRemoved"], [_resetListDecs, 18, "resetList"], [_addBoardDecs, 18, "addBoard"], [_updateBoardDecs, 18, "updateBoard"], [_removeBoardDecs, 18, "removeBoard"], [_mergePstnStreamOrInsertNewDataDecs, 18, "_mergePstnStreamOrInsertNewData"], [_addDecs, 18, "add"], [_updateDecs, 18, "update"], [_deleteDecs, 18, "delete"], [_addPinDecs, 18, "addPin"], [_updateSpeakerSpotlightPositionDecs, 18, "_updateSpeakerSpotlightPosition"], [_removePinDecs, 18, "removePin"], [_setSpeakerSpotlightDecs2, 18, "setSpeakerSpotlight"], [_toggleMainStreamDecs, 18, "toggleMainStream"], [_insertBeginningByPriorityDecs, 18, "_insertBeginningByPriority"], [_insertEndByPriorityDecs, 18, "_insertEndByPriority"], [_findInsertBeginningIndexDecs, 18, "_findInsertBeginningIndex"], [_findInsertEndIndexDecs, 18, "_findInsertEndIndex"], [_insertBoardDecs, 18, "_insertBoard"], [_insertNewDataDecs, 18, "_insertNewData"]], []).e, 10);
1178
- _init_spotlightEnabled = _applyDecs$e2[0];
1179
- _init_layoutType = _applyDecs$e2[1];
1180
- _init_manualLayout = _applyDecs$e2[2];
1181
- _init_pinLimitedCount = _applyDecs$e2[3];
1182
- _init_mainListLimitedCount = _applyDecs$e2[4];
1183
- _init_foldListLimitedCount = _applyDecs$e2[5];
1184
- _init_mainList = _applyDecs$e2[6];
1185
- _init_foldList = _applyDecs$e2[7];
1186
- _init_spotlightStreamId = _applyDecs$e2[8];
1187
- _initProto2 = _applyDecs$e2[9];
1188
- var FcrUISpeakerSpotlightPool = exports.FcrUISpeakerSpotlightPool = /*#__PURE__*/function () {
1189
- function FcrUISpeakerSpotlightPool() {
1190
- (0, _classCallCheck2["default"])(this, FcrUISpeakerSpotlightPool);
1191
- (0, _defineProperty2["default"])(this, "streams", new Map());
1192
- (0, _defineProperty2["default"])(this, "limitCount", 1);
1193
- (0, _defineProperty2["default"])(this, "duration", 2);
1194
- (0, _defineProperty2["default"])(this, "_timer", null);
1195
- (0, _defineProperty2["default"])(this, "_observer", new _observable.AgoraObservable());
1196
- this._scan = this._scan.bind(this);
1197
- }
1198
- return (0, _createClass2["default"])(FcrUISpeakerSpotlightPool, [{
1199
- key: "add",
1200
- value: function add(streamId) {
1201
- if (this.streams.size >= this.limitCount && !this.streams.has(streamId)) {
1202
- return false;
1203
- }
1204
- this.streams.set(streamId, Date.now());
1205
- this._scan();
1206
- return true;
1207
- }
1208
- }, {
1209
- key: "_scan",
1210
- value: function _scan() {
1211
- var _this1 = this;
1212
- if (this._timer) {
1213
- window.clearInterval(this._timer);
1214
- this._timer = null;
1215
- }
1216
- this._timer = window.setInterval(function () {
1217
- var now = Date.now();
1218
- var _iterator = _createForOfIteratorHelper(_this1.streams),
1219
- _step;
1220
- try {
1221
- for (_iterator.s(); !(_step = _iterator.n()).done;) {
1222
- var _step$value = (0, _slicedToArray2["default"])(_step.value, 2),
1223
- _streamId2 = _step$value[0],
1224
- time = _step$value[1];
1225
- if (now - time - _this1.duration * 1000 >= 0) {
1226
- _this1.streams["delete"](_streamId2);
1227
- _this1._observer.notifyObservers('onRemoved', _streamId2);
1228
- }
1229
- }
1230
- } catch (err) {
1231
- _iterator.e(err);
1232
- } finally {
1233
- _iterator.f();
1234
- }
1235
- if (_this1.streams.size === 0) {
1236
- _this1._timer && window.clearInterval(_this1._timer);
1237
- _this1._timer = null;
1238
- }
1239
- }, 1000);
1240
- }
1241
- }, {
1242
- key: "clear",
1243
- value: function clear() {
1244
- var _this10 = this;
1245
- this.streams.forEach(function (_, streamId) {
1246
- _this10._observer.notifyObservers('onRemoved', streamId);
1247
- });
1248
- this.streams.clear();
1249
- if (this._timer) {
1250
- window.clearInterval(this._timer);
1251
- this._timer = null;
1252
- }
1253
- }
1254
- }, {
1255
- key: "addObserver",
1256
- value: function addObserver(observer) {
1257
- this._observer.addObserver(observer);
1258
- }
1259
- }, {
1260
- key: "removeObserver",
1261
- value: function removeObserver(observer) {
1262
- this._observer.removeObserver(observer);
1263
- }
1264
- }]);
1265
- }();
1266
- (0, _base.registerDependency)('sharedVideoWindowDataSource');