@webex/plugin-meetings 3.0.0-beta.15 → 3.0.0-beta.17

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 (190) hide show
  1. package/dist/common/browser-detection.js +1 -21
  2. package/dist/common/browser-detection.js.map +1 -1
  3. package/dist/common/collection.js +5 -20
  4. package/dist/common/collection.js.map +1 -1
  5. package/dist/common/config.js +0 -7
  6. package/dist/common/config.js.map +1 -1
  7. package/dist/common/errors/captcha-error.js +0 -21
  8. package/dist/common/errors/captcha-error.js.map +1 -1
  9. package/dist/common/errors/intent-to-join.js +0 -21
  10. package/dist/common/errors/intent-to-join.js.map +1 -1
  11. package/dist/common/errors/join-meeting.js +0 -21
  12. package/dist/common/errors/join-meeting.js.map +1 -1
  13. package/dist/common/errors/media.js +0 -21
  14. package/dist/common/errors/media.js.map +1 -1
  15. package/dist/common/errors/parameter.js +0 -28
  16. package/dist/common/errors/parameter.js.map +1 -1
  17. package/dist/common/errors/password-error.js +0 -21
  18. package/dist/common/errors/password-error.js.map +1 -1
  19. package/dist/common/errors/permission.js +0 -21
  20. package/dist/common/errors/permission.js.map +1 -1
  21. package/dist/common/errors/reconnection-in-progress.js +0 -17
  22. package/dist/common/errors/reconnection-in-progress.js.map +1 -1
  23. package/dist/common/errors/reconnection.js +0 -21
  24. package/dist/common/errors/reconnection.js.map +1 -1
  25. package/dist/common/errors/stats.js +0 -21
  26. package/dist/common/errors/stats.js.map +1 -1
  27. package/dist/common/errors/webex-errors.js +6 -41
  28. package/dist/common/errors/webex-errors.js.map +1 -1
  29. package/dist/common/errors/webex-meetings-error.js +1 -24
  30. package/dist/common/errors/webex-meetings-error.js.map +1 -1
  31. package/dist/common/events/events-scope.js +0 -22
  32. package/dist/common/events/events-scope.js.map +1 -1
  33. package/dist/common/events/events.js +0 -23
  34. package/dist/common/events/events.js.map +1 -1
  35. package/dist/common/events/trigger-proxy.js +0 -12
  36. package/dist/common/events/trigger-proxy.js.map +1 -1
  37. package/dist/common/events/util.js +0 -15
  38. package/dist/common/events/util.js.map +1 -1
  39. package/dist/common/logs/logger-config.js +0 -4
  40. package/dist/common/logs/logger-config.js.map +1 -1
  41. package/dist/common/logs/logger-proxy.js +1 -8
  42. package/dist/common/logs/logger-proxy.js.map +1 -1
  43. package/dist/common/logs/request.js +35 -61
  44. package/dist/common/logs/request.js.map +1 -1
  45. package/dist/common/queue.js +4 -14
  46. package/dist/common/queue.js.map +1 -1
  47. package/dist/config.js +1 -5
  48. package/dist/config.js.map +1 -1
  49. package/dist/constants.js +50 -41
  50. package/dist/constants.js.map +1 -1
  51. package/dist/index.js +1 -17
  52. package/dist/index.js.map +1 -1
  53. package/dist/locus-info/controlsUtils.js +10 -28
  54. package/dist/locus-info/controlsUtils.js.map +1 -1
  55. package/dist/locus-info/embeddedAppsUtils.js +3 -26
  56. package/dist/locus-info/embeddedAppsUtils.js.map +1 -1
  57. package/dist/locus-info/fullState.js +0 -15
  58. package/dist/locus-info/fullState.js.map +1 -1
  59. package/dist/locus-info/hostUtils.js +4 -12
  60. package/dist/locus-info/hostUtils.js.map +1 -1
  61. package/dist/locus-info/index.js +90 -185
  62. package/dist/locus-info/index.js.map +1 -1
  63. package/dist/locus-info/infoUtils.js +0 -38
  64. package/dist/locus-info/infoUtils.js.map +1 -1
  65. package/dist/locus-info/mediaSharesUtils.js +12 -38
  66. package/dist/locus-info/mediaSharesUtils.js.map +1 -1
  67. package/dist/locus-info/parser.js +88 -125
  68. package/dist/locus-info/parser.js.map +1 -1
  69. package/dist/locus-info/selfUtils.js +15 -81
  70. package/dist/locus-info/selfUtils.js.map +1 -1
  71. package/dist/media/index.js +43 -97
  72. package/dist/media/index.js.map +1 -1
  73. package/dist/media/internal-media-core-wrapper.js +0 -4
  74. package/dist/media/internal-media-core-wrapper.js.map +1 -1
  75. package/dist/media/properties.js +64 -110
  76. package/dist/media/properties.js.map +1 -1
  77. package/dist/media/util.js +1 -8
  78. package/dist/media/util.js.map +1 -1
  79. package/dist/mediaQualityMetrics/config.js +10 -12
  80. package/dist/mediaQualityMetrics/config.js.map +1 -1
  81. package/dist/meeting/effectsState.js +119 -191
  82. package/dist/meeting/effectsState.js.map +1 -1
  83. package/dist/meeting/in-meeting-actions.js +5 -14
  84. package/dist/meeting/in-meeting-actions.js.map +1 -1
  85. package/dist/meeting/index.js +732 -1505
  86. package/dist/meeting/index.js.map +1 -1
  87. package/dist/meeting/muteState.js +30 -77
  88. package/dist/meeting/muteState.js.map +1 -1
  89. package/dist/meeting/request.js +160 -230
  90. package/dist/meeting/request.js.map +1 -1
  91. package/dist/meeting/request.type.js +0 -1
  92. package/dist/meeting/state.js +16 -26
  93. package/dist/meeting/state.js.map +1 -1
  94. package/dist/meeting/util.js +37 -158
  95. package/dist/meeting/util.js.map +1 -1
  96. package/dist/meeting-info/collection.js +3 -25
  97. package/dist/meeting-info/collection.js.map +1 -1
  98. package/dist/meeting-info/index.js +8 -31
  99. package/dist/meeting-info/index.js.map +1 -1
  100. package/dist/meeting-info/meeting-info-v2.js +131 -220
  101. package/dist/meeting-info/meeting-info-v2.js.map +1 -1
  102. package/dist/meeting-info/request.js +1 -16
  103. package/dist/meeting-info/request.js.map +1 -1
  104. package/dist/meeting-info/util.js +98 -183
  105. package/dist/meeting-info/util.js.map +1 -1
  106. package/dist/meeting-info/utilv2.js +137 -228
  107. package/dist/meeting-info/utilv2.js.map +1 -1
  108. package/dist/meetings/collection.js +3 -21
  109. package/dist/meetings/collection.js.map +1 -1
  110. package/dist/meetings/index.js +202 -335
  111. package/dist/meetings/index.js.map +1 -1
  112. package/dist/meetings/request.js +5 -28
  113. package/dist/meetings/request.js.map +1 -1
  114. package/dist/meetings/util.js +85 -141
  115. package/dist/meetings/util.js.map +1 -1
  116. package/dist/member/index.js +18 -58
  117. package/dist/member/index.js.map +1 -1
  118. package/dist/member/util.js +17 -68
  119. package/dist/member/util.js.map +1 -1
  120. package/dist/members/collection.js +2 -12
  121. package/dist/members/collection.js.map +1 -1
  122. package/dist/members/index.js +29 -151
  123. package/dist/members/index.js.map +1 -1
  124. package/dist/members/request.js +21 -56
  125. package/dist/members/request.js.map +1 -1
  126. package/dist/members/util.js +9 -38
  127. package/dist/members/util.js.map +1 -1
  128. package/dist/metrics/config.js +0 -2
  129. package/dist/metrics/config.js.map +1 -1
  130. package/dist/metrics/constants.js +1 -2
  131. package/dist/metrics/constants.js.map +1 -1
  132. package/dist/metrics/index.js +30 -121
  133. package/dist/metrics/index.js.map +1 -1
  134. package/dist/multistream/mediaRequestManager.js +12 -28
  135. package/dist/multistream/mediaRequestManager.js.map +1 -1
  136. package/dist/multistream/multistreamMedia.js +11 -22
  137. package/dist/multistream/multistreamMedia.js.map +1 -1
  138. package/dist/multistream/receiveSlot.js +7 -47
  139. package/dist/multistream/receiveSlot.js.map +1 -1
  140. package/dist/multistream/receiveSlotManager.js +37 -78
  141. package/dist/multistream/receiveSlotManager.js.map +1 -1
  142. package/dist/multistream/remoteMedia.js +11 -56
  143. package/dist/multistream/remoteMedia.js.map +1 -1
  144. package/dist/multistream/remoteMediaGroup.js +6 -40
  145. package/dist/multistream/remoteMediaGroup.js.map +1 -1
  146. package/dist/multistream/remoteMediaManager.js +221 -380
  147. package/dist/multistream/remoteMediaManager.js.map +1 -1
  148. package/dist/networkQualityMonitor/index.js +20 -49
  149. package/dist/networkQualityMonitor/index.js.map +1 -1
  150. package/dist/personal-meeting-room/index.js +3 -38
  151. package/dist/personal-meeting-room/index.js.map +1 -1
  152. package/dist/personal-meeting-room/request.js +2 -33
  153. package/dist/personal-meeting-room/request.js.map +1 -1
  154. package/dist/personal-meeting-room/util.js +0 -13
  155. package/dist/personal-meeting-room/util.js.map +1 -1
  156. package/dist/reachability/index.js +100 -166
  157. package/dist/reachability/index.js.map +1 -1
  158. package/dist/reachability/request.js +2 -18
  159. package/dist/reachability/request.js.map +1 -1
  160. package/dist/reactions/reactions.js +0 -2
  161. package/dist/reactions/reactions.js.map +1 -1
  162. package/dist/reactions/reactions.type.js +0 -6
  163. package/dist/reactions/reactions.type.js.map +1 -1
  164. package/dist/reconnection-manager/index.js +290 -455
  165. package/dist/reconnection-manager/index.js.map +1 -1
  166. package/dist/roap/index.js +13 -48
  167. package/dist/roap/index.js.map +1 -1
  168. package/dist/roap/request.js +13 -55
  169. package/dist/roap/request.js.map +1 -1
  170. package/dist/roap/turnDiscovery.js +10 -52
  171. package/dist/roap/turnDiscovery.js.map +1 -1
  172. package/dist/statsAnalyzer/global.js +0 -2
  173. package/dist/statsAnalyzer/global.js.map +1 -1
  174. package/dist/statsAnalyzer/index.js +66 -174
  175. package/dist/statsAnalyzer/index.js.map +1 -1
  176. package/dist/statsAnalyzer/mqaUtil.js +54 -53
  177. package/dist/statsAnalyzer/mqaUtil.js.map +1 -1
  178. package/dist/transcription/index.js +9 -44
  179. package/dist/transcription/index.js.map +1 -1
  180. package/package.json +18 -18
  181. package/src/constants.ts +4 -0
  182. package/src/meeting/in-meeting-actions.ts +8 -0
  183. package/src/meeting/index.ts +8 -0
  184. package/src/meeting/util.ts +22 -0
  185. package/test/integration/spec/journey.js +1 -1
  186. package/test/integration/spec/space-meeting.js +1 -1
  187. package/test/integration/spec/transcription.js +1 -1
  188. package/test/unit/spec/meeting/in-meeting-actions.ts +5 -1
  189. package/test/unit/spec/meeting/index.js +6 -0
  190. package/test/unit/spec/meeting/utils.js +15 -0
@@ -1,66 +1,38 @@
1
1
  "use strict";
2
2
 
3
3
  var _Reflect$construct = require("@babel/runtime-corejs2/core-js/reflect/construct");
4
-
5
4
  var _Object$defineProperty = require("@babel/runtime-corejs2/core-js/object/define-property");
6
-
7
5
  var _interopRequireDefault = require("@babel/runtime-corejs2/helpers/interopRequireDefault");
8
-
9
6
  _Object$defineProperty(exports, "__esModule", {
10
7
  value: true
11
8
  });
12
-
13
9
  exports.RemoteMediaManager = exports.Event = exports.DefaultConfiguration = void 0;
14
-
15
10
  var _regenerator = _interopRequireDefault(require("@babel/runtime-corejs2/regenerator"));
16
-
17
11
  var _stringify = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/json/stringify"));
18
-
19
12
  var _values = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/object/values"));
20
-
21
13
  var _entries = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/object/entries"));
22
-
23
14
  var _promise = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/promise"));
24
-
25
15
  var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/slicedToArray"));
26
-
27
16
  var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/toConsumableArray"));
28
-
29
17
  var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/asyncToGenerator"));
30
-
31
18
  var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/classCallCheck"));
32
-
33
19
  var _createClass2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/createClass"));
34
-
35
20
  var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/assertThisInitialized"));
36
-
37
21
  var _inherits2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/inherits"));
38
-
39
22
  var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/possibleConstructorReturn"));
40
-
41
23
  var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/getPrototypeOf"));
42
-
43
24
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/defineProperty"));
44
-
45
25
  var _remove2 = _interopRequireDefault(require("lodash/remove"));
46
-
47
26
  var _cloneDeep2 = _interopRequireDefault(require("lodash/cloneDeep"));
48
-
49
27
  var _internalMediaCore = require("@webex/internal-media-core");
50
-
51
28
  var _loggerProxy = _interopRequireDefault(require("../common/logs/logger-proxy"));
52
-
53
29
  var _eventsScope = _interopRequireDefault(require("../common/events/events-scope"));
54
-
55
30
  var _remoteMedia = require("./remoteMedia");
56
-
57
31
  var _remoteMediaGroup = require("./remoteMediaGroup");
58
-
59
32
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = _Reflect$construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
60
-
61
33
  function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !_Reflect$construct) return false; if (_Reflect$construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(_Reflect$construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
62
-
63
34
  /* Predefined layouts: */
35
+
64
36
  // An "all equal" grid, with size up to 3 x 3 = 9:
65
37
  var AllEqualLayout = {
66
38
  screenShareVideo: {
@@ -72,8 +44,9 @@ var AllEqualLayout = {
72
44
  size: 'best',
73
45
  priority: 255
74
46
  }]
75
- }; // A layout with just a single remote active speaker video pane:
47
+ };
76
48
 
49
+ // A layout with just a single remote active speaker video pane:
77
50
  var SingleLayout = {
78
51
  screenShareVideo: {
79
52
  size: null
@@ -84,8 +57,9 @@ var SingleLayout = {
84
57
  size: 'best',
85
58
  priority: 255
86
59
  }]
87
- }; // A layout with 1 big pane for the highest priority active speaker and 5 small panes for other active speakers:
60
+ };
88
61
 
62
+ // A layout with 1 big pane for the highest priority active speaker and 5 small panes for other active speakers:
89
63
  var OnePlusFiveLayout = {
90
64
  screenShareVideo: {
91
65
  size: null
@@ -101,8 +75,9 @@ var OnePlusFiveLayout = {
101
75
  size: 'very small',
102
76
  priority: 254
103
77
  }]
104
- }; // A layout with 2 big panes for 2 main active speakers and a strip of 6 small panes for other active speakers:
78
+ };
105
79
 
80
+ // A layout with 2 big panes for 2 main active speakers and a strip of 6 small panes for other active speakers:
106
81
  var TwoMainPlusSixSmallLayout = {
107
82
  screenShareVideo: {
108
83
  size: null
@@ -118,8 +93,9 @@ var TwoMainPlusSixSmallLayout = {
118
93
  size: 'small',
119
94
  priority: 254
120
95
  }]
121
- }; // A strip of 8 small video panes (thumbnails) displayed at the top of a remote screenshare:
96
+ };
122
97
 
98
+ // A strip of 8 small video panes (thumbnails) displayed at the top of a remote screenshare:
123
99
  var RemoteScreenShareWithSmallThumbnailsLayout = {
124
100
  screenShareVideo: {
125
101
  size: 'best'
@@ -130,8 +106,9 @@ var RemoteScreenShareWithSmallThumbnailsLayout = {
130
106
  size: 'thumbnail',
131
107
  priority: 255
132
108
  }]
133
- }; // A staged layout with 4 pre-selected meeting participants in the main 2x2 grid and 6 small panes for other active speakers at the top:
109
+ };
134
110
 
111
+ // A staged layout with 4 pre-selected meeting participants in the main 2x2 grid and 6 small panes for other active speakers at the top:
135
112
  var Stage2x2With6ThumbnailsLayout = {
136
113
  screenShareVideo: {
137
114
  size: null
@@ -160,13 +137,13 @@ var Stage2x2With6ThumbnailsLayout = {
160
137
  csi: undefined
161
138
  }]
162
139
  };
140
+
163
141
  /**
164
142
  * Default configuration:
165
143
  * - uses 3 audio streams
166
144
  * - prefers active speakers with live video (e.g. are not audio only or video muted) over active speakers without live video
167
145
  * - has a few layouts defined, including 1 that contains remote screen share (ScreenShareView)
168
146
  */
169
-
170
147
  var DefaultConfiguration = {
171
148
  audio: {
172
149
  numOfActiveSpeakerStreams: 3
@@ -190,13 +167,11 @@ var DefaultConfiguration = {
190
167
  exports.DefaultConfiguration = DefaultConfiguration;
191
168
  var Event;
192
169
  exports.Event = Event;
193
-
194
170
  (function (Event) {
195
171
  Event["AudioCreated"] = "AudioCreated";
196
172
  Event["ScreenShareAudioCreated"] = "ScreenShareCreated";
197
173
  Event["VideoLayoutChanged"] = "VideoLayoutChanged";
198
174
  })(Event || (exports.Event = Event = {}));
199
-
200
175
  /**
201
176
  * A helper class that manages all remote audio/video streams in order to achieve a predefined set of layouts.
202
177
  * It also creates a fixed number of audio streams and these don't change during the meeting.
@@ -207,9 +182,7 @@ exports.Event = Event;
207
182
  */
208
183
  var RemoteMediaManager = /*#__PURE__*/function (_EventsScope) {
209
184
  (0, _inherits2.default)(RemoteMediaManager, _EventsScope);
210
-
211
185
  var _super = _createSuper(RemoteMediaManager);
212
-
213
186
  /**
214
187
  * Constructor
215
188
  *
@@ -219,7 +192,6 @@ var RemoteMediaManager = /*#__PURE__*/function (_EventsScope) {
219
192
  */
220
193
  function RemoteMediaManager(receiveSlotManager, mediaRequestManagers) {
221
194
  var _this;
222
-
223
195
  var config = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : DefaultConfiguration;
224
196
  (0, _classCallCheck2.default)(this, RemoteMediaManager);
225
197
  _this = _super.call(this);
@@ -243,9 +215,7 @@ var RemoteMediaManager = /*#__PURE__*/function (_EventsScope) {
243
215
  memberPanes: {}
244
216
  }
245
217
  };
246
-
247
218
  _this.checkConfigValidity();
248
-
249
219
  _this.slots = {
250
220
  audio: [],
251
221
  screenShareAudio: undefined,
@@ -260,27 +230,23 @@ var RemoteMediaManager = /*#__PURE__*/function (_EventsScope) {
260
230
  activeSpeaker: {},
261
231
  receiverSelected: {}
262
232
  };
263
-
264
233
  _loggerProxy.default.logger.log("RemoteMediaManager#constructor --> RemoteMediaManager created with config: ".concat((0, _stringify.default)(_this.config)));
265
-
266
234
  return _this;
267
235
  }
236
+
268
237
  /**
269
238
  * Checks if configuration is valid, throws an error if it's not
270
239
  */
271
-
272
-
273
240
  (0, _createClass2.default)(RemoteMediaManager, [{
274
241
  key: "checkConfigValidity",
275
242
  value: function checkConfigValidity() {
276
243
  if (!(this.config.video.initialLayoutId in this.config.video.layouts)) {
277
244
  throw new Error("invalid config: initialLayoutId \"".concat(this.config.video.initialLayoutId, "\" doesn't match any of the layouts"));
278
- } // check if each layout is valid
279
-
245
+ }
280
246
 
247
+ // check if each layout is valid
281
248
  (0, _values.default)(this.config.video.layouts).forEach(function (layout) {
282
249
  var _layout$activeSpeaker, _layout$memberVideoPa;
283
-
284
250
  var groupIds = {};
285
251
  var paneIds = {};
286
252
  var groupPriorites = {};
@@ -288,186 +254,157 @@ var RemoteMediaManager = /*#__PURE__*/function (_EventsScope) {
288
254
  if (groupIds[group.id]) {
289
255
  throw new Error("invalid config: duplicate active speaker video pane group id: ".concat(group.id));
290
256
  }
291
-
292
257
  groupIds[group.id] = true;
293
-
294
258
  if (groupPriorites[group.priority]) {
295
259
  throw new Error("invalid config: multiple active speaker video pane groups have same priority: ".concat(group.priority));
296
260
  }
297
-
298
261
  groupPriorites[group.priority] = true;
299
262
  });
300
263
  (_layout$memberVideoPa = layout.memberVideoPanes) === null || _layout$memberVideoPa === void 0 ? void 0 : _layout$memberVideoPa.forEach(function (pane) {
301
264
  if (paneIds[pane.id]) {
302
265
  throw new Error("invalid config: duplicate member video pane id: ".concat(pane.id));
303
266
  }
304
-
305
267
  paneIds[pane.id] = true;
306
268
  });
307
269
  });
308
270
  }
271
+
309
272
  /**
310
273
  * Starts the RemoteMediaManager.
311
274
  *
312
275
  * @returns {Promise}
313
276
  */
314
-
315
277
  }, {
316
278
  key: "start",
317
279
  value: function () {
318
280
  var _start = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
319
281
  return _regenerator.default.wrap(function _callee$(_context) {
320
- while (1) {
321
- switch (_context.prev = _context.next) {
322
- case 0:
323
- if (!this.started) {
324
- _context.next = 2;
325
- break;
326
- }
327
-
328
- throw new Error('start() failure: already started');
329
-
330
- case 2:
331
- this.started = true;
332
- _context.next = 5;
333
- return this.createAudioMedia();
334
-
335
- case 5:
336
- _context.next = 7;
337
- return this.preallocateVideoReceiveSlots();
338
-
339
- case 7:
340
- _context.next = 9;
341
- return this.setLayout(this.config.video.initialLayoutId);
342
-
343
- case 9:
344
- case "end":
345
- return _context.stop();
346
- }
282
+ while (1) switch (_context.prev = _context.next) {
283
+ case 0:
284
+ if (!this.started) {
285
+ _context.next = 2;
286
+ break;
287
+ }
288
+ throw new Error('start() failure: already started');
289
+ case 2:
290
+ this.started = true;
291
+ _context.next = 5;
292
+ return this.createAudioMedia();
293
+ case 5:
294
+ _context.next = 7;
295
+ return this.preallocateVideoReceiveSlots();
296
+ case 7:
297
+ _context.next = 9;
298
+ return this.setLayout(this.config.video.initialLayoutId);
299
+ case 9:
300
+ case "end":
301
+ return _context.stop();
347
302
  }
348
303
  }, _callee, this);
349
304
  }));
350
-
351
305
  function start() {
352
306
  return _start.apply(this, arguments);
353
307
  }
354
-
355
308
  return start;
356
309
  }()
357
310
  /**
358
311
  * Releases all the used resources (like allocated receive slots). This function needs
359
312
  * to be called when we leave the meeting, etc.
360
313
  */
361
-
362
314
  }, {
363
315
  key: "stop",
364
316
  value: function stop() {
365
317
  var _this2 = this,
366
- _this$slots$video$unu,
367
- _this$slots$video$unu2;
368
-
318
+ _this$slots$video$unu,
319
+ _this$slots$video$unu2;
369
320
  // invalidate all remoteMedia objects
370
321
  this.invalidateCurrentRemoteMedia({
371
322
  audio: true,
372
323
  video: true,
373
324
  commit: true
374
- }); // release all audio receive slots
325
+ });
375
326
 
327
+ // release all audio receive slots
376
328
  this.slots.audio.forEach(function (slot) {
377
329
  return _this2.receiveSlotManager.releaseSlot(slot);
378
330
  });
379
- this.slots.audio.length = 0; // todo: screenshare slots... (SPARK-377812)
331
+ this.slots.audio.length = 0;
332
+
333
+ // todo: screenshare slots... (SPARK-377812)
380
334
 
381
335
  this.receiveSlotAllocations = {
382
336
  activeSpeaker: {},
383
337
  receiverSelected: {}
384
338
  };
385
-
386
339
  (_this$slots$video$unu = this.slots.video.unused).push.apply(_this$slots$video$unu, (0, _toConsumableArray2.default)(this.slots.video.activeSpeaker));
387
-
388
340
  this.slots.video.activeSpeaker.length = 0;
389
-
390
341
  (_this$slots$video$unu2 = this.slots.video.unused).push.apply(_this$slots$video$unu2, (0, _toConsumableArray2.default)(this.slots.video.receiverSelected));
391
-
392
342
  this.slots.video.receiverSelected.length = 0;
393
343
  this.releaseUnusedVideoSlots();
394
344
  this.currentLayout = undefined;
395
345
  this.currentLayoutId = undefined;
396
346
  this.started = false;
397
347
  }
348
+
398
349
  /**
399
350
  * Returns the total number of main video panes required for a given layout
400
351
  *
401
352
  * @param {VideoLayout} layout
402
353
  * @returns {number}
403
354
  */
404
-
405
355
  }, {
406
356
  key: "getRequiredNumVideoSlotsForLayout",
407
357
  value: function getRequiredNumVideoSlotsForLayout(layout) {
408
358
  var _layout$activeSpeaker2, _layout$memberVideoPa2;
409
-
410
359
  if (!layout) {
411
360
  return 0;
412
361
  }
413
-
414
362
  var activeSpeakerCount = ((_layout$activeSpeaker2 = layout.activeSpeakerVideoPaneGroups) === null || _layout$activeSpeaker2 === void 0 ? void 0 : _layout$activeSpeaker2.reduce(function (sum, paneGroup) {
415
363
  return sum + paneGroup.numPanes;
416
364
  }, 0)) || 0;
417
365
  var receiverSelectedCount = ((_layout$memberVideoPa2 = layout.memberVideoPanes) === null || _layout$memberVideoPa2 === void 0 ? void 0 : _layout$memberVideoPa2.length) || 0;
418
366
  return activeSpeakerCount + receiverSelectedCount;
419
367
  }
368
+
420
369
  /**
421
370
  * Allocates the maximum number of panes that any of the configured layouts will require.
422
371
  * We do this at the beginning, because it's more efficient (much faster) then allocating receive slots
423
372
  * later, after the SDP exchange was done.
424
373
  */
425
-
426
374
  }, {
427
375
  key: "preallocateVideoReceiveSlots",
428
376
  value: function () {
429
377
  var _preallocateVideoReceiveSlots = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2() {
430
378
  var _this3 = this;
431
-
432
379
  var maxNumVideoPanesRequired;
433
380
  return _regenerator.default.wrap(function _callee2$(_context2) {
434
- while (1) {
435
- switch (_context2.prev = _context2.next) {
436
- case 0:
437
- maxNumVideoPanesRequired = (0, _values.default)(this.config.video.layouts).reduce(function (maxValue, layout) {
438
- return Math.max(maxValue, _this3.getRequiredNumVideoSlotsForLayout(layout));
439
- }, 0);
440
-
441
- case 1:
442
- if (!(this.slots.video.unused.length < maxNumVideoPanesRequired)) {
443
- _context2.next = 9;
444
- break;
445
- }
446
-
447
- _context2.t0 = this.slots.video.unused;
448
- _context2.next = 5;
449
- return this.receiveSlotManager.allocateSlot(_internalMediaCore.MediaConnection.MediaType.VideoMain);
450
-
451
- case 5:
452
- _context2.t1 = _context2.sent;
453
-
454
- _context2.t0.push.call(_context2.t0, _context2.t1);
455
-
456
- _context2.next = 1;
381
+ while (1) switch (_context2.prev = _context2.next) {
382
+ case 0:
383
+ maxNumVideoPanesRequired = (0, _values.default)(this.config.video.layouts).reduce(function (maxValue, layout) {
384
+ return Math.max(maxValue, _this3.getRequiredNumVideoSlotsForLayout(layout));
385
+ }, 0);
386
+ case 1:
387
+ if (!(this.slots.video.unused.length < maxNumVideoPanesRequired)) {
388
+ _context2.next = 9;
457
389
  break;
458
-
459
- case 9:
460
- case "end":
461
- return _context2.stop();
462
- }
390
+ }
391
+ _context2.t0 = this.slots.video.unused;
392
+ _context2.next = 5;
393
+ return this.receiveSlotManager.allocateSlot(_internalMediaCore.MediaConnection.MediaType.VideoMain);
394
+ case 5:
395
+ _context2.t1 = _context2.sent;
396
+ _context2.t0.push.call(_context2.t0, _context2.t1);
397
+ _context2.next = 1;
398
+ break;
399
+ case 9:
400
+ case "end":
401
+ return _context2.stop();
463
402
  }
464
403
  }, _callee2, this);
465
404
  }));
466
-
467
405
  function preallocateVideoReceiveSlots() {
468
406
  return _preallocateVideoReceiveSlots.apply(this, arguments);
469
407
  }
470
-
471
408
  return preallocateVideoReceiveSlots;
472
409
  }()
473
410
  /**
@@ -476,52 +413,41 @@ var RemoteMediaManager = /*#__PURE__*/function (_EventsScope) {
476
413
  * @param {LayoutId} layoutId new layout id
477
414
  * @returns {Promise}
478
415
  */
479
-
480
416
  }, {
481
417
  key: "setLayout",
482
418
  value: function () {
483
419
  var _setLayout = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3(layoutId) {
484
420
  return _regenerator.default.wrap(function _callee3$(_context3) {
485
- while (1) {
486
- switch (_context3.prev = _context3.next) {
487
- case 0:
488
- if (layoutId in this.config.video.layouts) {
489
- _context3.next = 2;
490
- break;
491
- }
492
-
493
- throw new Error("invalid layoutId: \"".concat(layoutId, "\" doesn't match any of the configured layouts"));
494
-
495
- case 2:
496
- if (this.started) {
497
- _context3.next = 4;
498
- break;
499
- }
500
-
501
- throw new Error('setLayout() called before start()');
502
-
503
- case 4:
504
- this.currentLayoutId = layoutId;
505
- this.currentLayout = (0, _cloneDeep2.default)(this.config.video.layouts[this.currentLayoutId]);
506
- _context3.next = 8;
507
- return this.updateVideoReceiveSlots();
508
-
509
- case 8:
510
- this.updateVideoRemoteMediaObjects();
511
- this.emitVideoLayoutChangedEvent();
512
-
513
- case 10:
514
- case "end":
515
- return _context3.stop();
516
- }
421
+ while (1) switch (_context3.prev = _context3.next) {
422
+ case 0:
423
+ if (layoutId in this.config.video.layouts) {
424
+ _context3.next = 2;
425
+ break;
426
+ }
427
+ throw new Error("invalid layoutId: \"".concat(layoutId, "\" doesn't match any of the configured layouts"));
428
+ case 2:
429
+ if (this.started) {
430
+ _context3.next = 4;
431
+ break;
432
+ }
433
+ throw new Error('setLayout() called before start()');
434
+ case 4:
435
+ this.currentLayoutId = layoutId;
436
+ this.currentLayout = (0, _cloneDeep2.default)(this.config.video.layouts[this.currentLayoutId]);
437
+ _context3.next = 8;
438
+ return this.updateVideoReceiveSlots();
439
+ case 8:
440
+ this.updateVideoRemoteMediaObjects();
441
+ this.emitVideoLayoutChangedEvent();
442
+ case 10:
443
+ case "end":
444
+ return _context3.stop();
517
445
  }
518
446
  }, _callee3, this);
519
447
  }));
520
-
521
448
  function setLayout(_x) {
522
449
  return _setLayout.apply(this, arguments);
523
450
  }
524
-
525
451
  return setLayout;
526
452
  }()
527
453
  /**
@@ -529,127 +455,110 @@ var RemoteMediaManager = /*#__PURE__*/function (_EventsScope) {
529
455
  *
530
456
  * @returns {LayoutId}
531
457
  */
532
-
533
458
  }, {
534
459
  key: "getLayoutId",
535
460
  value: function getLayoutId() {
536
461
  return this.currentLayoutId;
537
462
  }
463
+
538
464
  /**
539
465
  * Creates the audio slots
540
466
  */
541
-
542
467
  }, {
543
468
  key: "createAudioMedia",
544
469
  value: function () {
545
470
  var _createAudioMedia = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4() {
546
471
  var i, slot;
547
472
  return _regenerator.default.wrap(function _callee4$(_context4) {
548
- while (1) {
549
- switch (_context4.prev = _context4.next) {
550
- case 0:
551
- i = 0;
552
-
553
- case 1:
554
- if (!(i < this.config.audio.numOfActiveSpeakerStreams)) {
555
- _context4.next = 9;
556
- break;
557
- }
558
-
559
- _context4.next = 4;
560
- return this.receiveSlotManager.allocateSlot(_internalMediaCore.MediaConnection.MediaType.AudioMain);
561
-
562
- case 4:
563
- slot = _context4.sent;
564
- this.slots.audio.push(slot);
565
-
566
- case 6:
567
- i += 1;
568
- _context4.next = 1;
473
+ while (1) switch (_context4.prev = _context4.next) {
474
+ case 0:
475
+ i = 0;
476
+ case 1:
477
+ if (!(i < this.config.audio.numOfActiveSpeakerStreams)) {
478
+ _context4.next = 9;
569
479
  break;
570
-
571
- case 9:
572
- // create a remote media group
573
- this.media.audio = new _remoteMediaGroup.RemoteMediaGroup(this.mediaRequestManagers.audio, this.slots.audio, 255, true);
574
- this.emit({
575
- file: 'multistream/remoteMediaManager',
576
- function: 'createAudioMedia'
577
- }, Event.AudioCreated, this.media.audio);
578
-
579
- case 11:
580
- case "end":
581
- return _context4.stop();
582
- }
480
+ }
481
+ _context4.next = 4;
482
+ return this.receiveSlotManager.allocateSlot(_internalMediaCore.MediaConnection.MediaType.AudioMain);
483
+ case 4:
484
+ slot = _context4.sent;
485
+ this.slots.audio.push(slot);
486
+ case 6:
487
+ i += 1;
488
+ _context4.next = 1;
489
+ break;
490
+ case 9:
491
+ // create a remote media group
492
+ this.media.audio = new _remoteMediaGroup.RemoteMediaGroup(this.mediaRequestManagers.audio, this.slots.audio, 255, true);
493
+ this.emit({
494
+ file: 'multistream/remoteMediaManager',
495
+ function: 'createAudioMedia'
496
+ }, Event.AudioCreated, this.media.audio);
497
+ case 11:
498
+ case "end":
499
+ return _context4.stop();
583
500
  }
584
501
  }, _callee4, this);
585
502
  }));
586
-
587
503
  function createAudioMedia() {
588
504
  return _createAudioMedia.apply(this, arguments);
589
505
  }
590
-
591
506
  return createAudioMedia;
592
507
  }()
593
508
  /**
594
509
  * Goes over all receiver-selected slots and keeps only the ones that are required by a given layout,
595
510
  * the rest are all moved to the "unused" list
596
511
  */
597
-
598
512
  }, {
599
513
  key: "trimReceiverSelectedSlots",
600
514
  value: function trimReceiverSelectedSlots() {
601
515
  var _this$currentLayout, _this$currentLayout$m, _this$slots$video$unu3;
516
+ var requiredCsis = {};
602
517
 
603
- var requiredCsis = {}; // fill requiredCsis with all the CSIs that the given layout requires
604
-
518
+ // fill requiredCsis with all the CSIs that the given layout requires
605
519
  (_this$currentLayout = this.currentLayout) === null || _this$currentLayout === void 0 ? void 0 : (_this$currentLayout$m = _this$currentLayout.memberVideoPanes) === null || _this$currentLayout$m === void 0 ? void 0 : _this$currentLayout$m.forEach(function (memberVideoPane) {
606
520
  if (memberVideoPane.csi !== undefined) {
607
521
  requiredCsis[memberVideoPane.csi] = true;
608
522
  }
609
523
  });
610
-
611
524
  var isCsiNeededByCurrentLayout = function isCsiNeededByCurrentLayout(csi) {
612
525
  if (csi === undefined) {
613
526
  return false;
614
527
  }
615
-
616
528
  return !!requiredCsis[csi];
617
- }; // keep receiverSelected slots that match our new requiredCsis, move the rest of receiverSelected slots to unused
618
-
529
+ };
619
530
 
531
+ // keep receiverSelected slots that match our new requiredCsis, move the rest of receiverSelected slots to unused
620
532
  var notNeededReceiverSelectedSlots = (0, _remove2.default)(this.slots.video.receiverSelected, function (slot) {
621
533
  return isCsiNeededByCurrentLayout(slot.csi) === false;
622
534
  });
623
-
624
535
  (_this$slots$video$unu3 = this.slots.video.unused).push.apply(_this$slots$video$unu3, (0, _toConsumableArray2.default)(notNeededReceiverSelectedSlots));
625
536
  }
537
+
626
538
  /**
627
539
  * Releases all the "unused" video slots.
628
540
  */
629
-
630
541
  }, {
631
542
  key: "releaseUnusedVideoSlots",
632
543
  value: function releaseUnusedVideoSlots() {
633
544
  var _this4 = this;
634
-
635
545
  this.slots.video.unused.forEach(function (slot) {
636
546
  return _this4.receiveSlotManager.releaseSlot(slot);
637
547
  });
638
548
  this.slots.video.unused.length = 0;
639
549
  }
550
+
640
551
  /**
641
552
  * Allocates receive slots to all video panes in the current selected layout
642
553
  */
643
-
644
554
  }, {
645
555
  key: "allocateSlotsToVideoPaneGroups",
646
556
  value: function allocateSlotsToVideoPaneGroups() {
647
557
  var _this$currentLayout2,
648
- _this$currentLayout2$,
649
- _this5 = this,
650
- _this$currentLayout3,
651
- _this$currentLayout3$;
652
-
558
+ _this$currentLayout2$,
559
+ _this5 = this,
560
+ _this$currentLayout3,
561
+ _this$currentLayout3$;
653
562
  this.receiveSlotAllocations = {
654
563
  activeSpeaker: {},
655
564
  receiverSelected: {}
@@ -658,14 +567,11 @@ var RemoteMediaManager = /*#__PURE__*/function (_EventsScope) {
658
567
  _this5.receiveSlotAllocations.activeSpeaker[group.id] = {
659
568
  slots: []
660
569
  };
661
-
662
570
  for (var paneIndex = 0; paneIndex < group.numPanes; paneIndex += 1) {
663
571
  // allocate a slot from the "unused" list
664
572
  var freeSlot = _this5.slots.video.unused.pop();
665
-
666
573
  if (freeSlot) {
667
574
  _this5.slots.video.activeSpeaker.push(freeSlot);
668
-
669
575
  _this5.receiveSlotAllocations.activeSpeaker[group.id].slots.push(freeSlot);
670
576
  }
671
577
  }
@@ -675,132 +581,109 @@ var RemoteMediaManager = /*#__PURE__*/function (_EventsScope) {
675
581
  var existingSlot = _this5.slots.video.receiverSelected.find(function (slot) {
676
582
  return slot.csi === memberPane.csi;
677
583
  });
678
-
679
584
  var isExistingSlotAlreadyAllocated = (0, _values.default)(_this5.receiveSlotAllocations.receiverSelected).includes(existingSlot);
680
-
681
585
  if (memberPane.csi !== undefined && existingSlot && !isExistingSlotAlreadyAllocated) {
682
586
  // found it, so use it
683
587
  _this5.receiveSlotAllocations.receiverSelected[memberPane.id] = existingSlot;
684
588
  } else {
685
589
  // allocate a slot from the "unused" list
686
590
  var freeSlot = _this5.slots.video.unused.pop();
687
-
688
591
  if (freeSlot) {
689
592
  _this5.slots.video.receiverSelected.push(freeSlot);
690
-
691
593
  _this5.receiveSlotAllocations.receiverSelected[memberPane.id] = freeSlot;
692
594
  }
693
595
  }
694
596
  });
695
597
  }
598
+
696
599
  /**
697
600
  * Makes sure we have the right number of receive slots created for the current layout
698
601
  * and allocates them to the right video panes / pane groups
699
602
  *
700
603
  * @returns {Promise}
701
604
  */
702
-
703
605
  }, {
704
606
  key: "updateVideoReceiveSlots",
705
607
  value: function () {
706
608
  var _updateVideoReceiveSlots = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee5() {
707
609
  var _this$slots$video$unu4;
708
-
709
610
  var requiredNumSlots, totalNumSlots, numSlotsToCreate;
710
611
  return _regenerator.default.wrap(function _callee5$(_context5) {
711
- while (1) {
712
- switch (_context5.prev = _context5.next) {
713
- case 0:
714
- requiredNumSlots = this.getRequiredNumVideoSlotsForLayout(this.currentLayout);
715
- totalNumSlots = this.slots.video.unused.length + this.slots.video.activeSpeaker.length + this.slots.video.receiverSelected.length; // ensure we have enough total slots for current layout
716
-
717
- if (!(totalNumSlots < requiredNumSlots)) {
718
- _context5.next = 13;
719
- break;
720
- }
721
-
722
- numSlotsToCreate = requiredNumSlots - totalNumSlots;
723
-
724
- case 4:
725
- if (!(numSlotsToCreate > 0)) {
726
- _context5.next = 13;
727
- break;
728
- }
729
-
730
- _context5.t0 = this.slots.video.unused;
731
- _context5.next = 8;
732
- return this.receiveSlotManager.allocateSlot(_internalMediaCore.MediaConnection.MediaType.VideoMain);
733
-
734
- case 8:
735
- _context5.t1 = _context5.sent;
736
-
737
- _context5.t0.push.call(_context5.t0, _context5.t1);
738
-
739
- numSlotsToCreate -= 1;
740
- _context5.next = 4;
612
+ while (1) switch (_context5.prev = _context5.next) {
613
+ case 0:
614
+ requiredNumSlots = this.getRequiredNumVideoSlotsForLayout(this.currentLayout);
615
+ totalNumSlots = this.slots.video.unused.length + this.slots.video.activeSpeaker.length + this.slots.video.receiverSelected.length; // ensure we have enough total slots for current layout
616
+ if (!(totalNumSlots < requiredNumSlots)) {
617
+ _context5.next = 13;
741
618
  break;
742
-
743
- case 13:
744
- // move all no longer needed receiver-selected slots to "unused"
745
- this.trimReceiverSelectedSlots(); // move all active speaker slots to "unused"
746
-
747
- (_this$slots$video$unu4 = this.slots.video.unused).push.apply(_this$slots$video$unu4, (0, _toConsumableArray2.default)(this.slots.video.activeSpeaker));
748
-
749
- this.slots.video.activeSpeaker.length = 0; // allocate the slots to the right panes / pane groups
750
-
751
- this.allocateSlotsToVideoPaneGroups();
752
-
753
- _loggerProxy.default.logger.log("RemoteMediaManager#updateVideoReceiveSlots --> receive slots updated: unused=".concat(this.slots.video.unused.length, ", activeSpeaker=").concat(this.slots.video.activeSpeaker.length, ", receiverSelected=").concat(this.slots.video.receiverSelected.length)); // If this is the initial layout, there may be some "unused" slots left because of the preallocation
754
- // done in this.preallocateVideoReceiveSlots(), so release them now
755
-
756
-
757
- this.releaseUnusedVideoSlots();
758
-
759
- case 19:
760
- case "end":
761
- return _context5.stop();
762
- }
619
+ }
620
+ numSlotsToCreate = requiredNumSlots - totalNumSlots;
621
+ case 4:
622
+ if (!(numSlotsToCreate > 0)) {
623
+ _context5.next = 13;
624
+ break;
625
+ }
626
+ _context5.t0 = this.slots.video.unused;
627
+ _context5.next = 8;
628
+ return this.receiveSlotManager.allocateSlot(_internalMediaCore.MediaConnection.MediaType.VideoMain);
629
+ case 8:
630
+ _context5.t1 = _context5.sent;
631
+ _context5.t0.push.call(_context5.t0, _context5.t1);
632
+ numSlotsToCreate -= 1;
633
+ _context5.next = 4;
634
+ break;
635
+ case 13:
636
+ // move all no longer needed receiver-selected slots to "unused"
637
+ this.trimReceiverSelectedSlots();
638
+
639
+ // move all active speaker slots to "unused"
640
+ (_this$slots$video$unu4 = this.slots.video.unused).push.apply(_this$slots$video$unu4, (0, _toConsumableArray2.default)(this.slots.video.activeSpeaker));
641
+ this.slots.video.activeSpeaker.length = 0;
642
+
643
+ // allocate the slots to the right panes / pane groups
644
+ this.allocateSlotsToVideoPaneGroups();
645
+ _loggerProxy.default.logger.log("RemoteMediaManager#updateVideoReceiveSlots --> receive slots updated: unused=".concat(this.slots.video.unused.length, ", activeSpeaker=").concat(this.slots.video.activeSpeaker.length, ", receiverSelected=").concat(this.slots.video.receiverSelected.length));
646
+
647
+ // If this is the initial layout, there may be some "unused" slots left because of the preallocation
648
+ // done in this.preallocateVideoReceiveSlots(), so release them now
649
+ this.releaseUnusedVideoSlots();
650
+ case 19:
651
+ case "end":
652
+ return _context5.stop();
763
653
  }
764
654
  }, _callee5, this);
765
655
  }));
766
-
767
656
  function updateVideoReceiveSlots() {
768
657
  return _updateVideoReceiveSlots.apply(this, arguments);
769
658
  }
770
-
771
659
  return updateVideoReceiveSlots;
772
660
  }()
773
661
  /**
774
662
  * Creates new RemoteMedia and RemoteMediaGroup objects for the current layout
775
663
  * and sends the media requests for all of them.
776
664
  */
777
-
778
665
  }, {
779
666
  key: "updateVideoRemoteMediaObjects",
780
667
  value: function updateVideoRemoteMediaObjects() {
781
668
  var _this6 = this;
782
-
783
669
  // invalidate all the previous remote media objects and cancel their media requests
784
670
  this.invalidateCurrentRemoteMedia({
785
671
  audio: false,
786
672
  video: true,
787
673
  commit: false
788
- }); // create new remoteMediaGroup objects
674
+ });
789
675
 
676
+ // create new remoteMediaGroup objects
790
677
  this.media.video.activeSpeakerGroups = {};
791
678
  this.media.video.memberPanes = {};
792
-
793
679
  var _loop = function _loop() {
794
680
  var _this6$currentLayout, _this6$currentLayout$;
795
-
796
681
  var _Object$entries$_i = (0, _slicedToArray2.default)(_Object$entries[_i], 2),
797
- groupId = _Object$entries$_i[0],
798
- group = _Object$entries$_i[1];
799
-
682
+ groupId = _Object$entries$_i[0],
683
+ group = _Object$entries$_i[1];
800
684
  var paneGroupInCurrentLayout = (_this6$currentLayout = _this6.currentLayout) === null || _this6$currentLayout === void 0 ? void 0 : (_this6$currentLayout$ = _this6$currentLayout.activeSpeakerVideoPaneGroups) === null || _this6$currentLayout$ === void 0 ? void 0 : _this6$currentLayout$.find(function (groupInLayout) {
801
685
  return groupInLayout.id === groupId;
802
686
  });
803
-
804
687
  if (paneGroupInCurrentLayout) {
805
688
  var mediaGroup = new _remoteMediaGroup.RemoteMediaGroup(_this6.mediaRequestManagers.video, group.slots, paneGroupInCurrentLayout.priority, false, {
806
689
  preferLiveVideo: _this6.config.video.preferLiveVideo,
@@ -812,61 +695,52 @@ var RemoteMediaManager = /*#__PURE__*/function (_EventsScope) {
812
695
  _loggerProxy.default.logger.warn("a group id ".concat(groupId, " from this.receiveSlotAllocations.activeSpeaker cannot be found in the current layout configuration"));
813
696
  }
814
697
  };
815
-
816
698
  for (var _i = 0, _Object$entries = (0, _entries.default)(this.receiveSlotAllocations.activeSpeaker); _i < _Object$entries.length; _i++) {
817
699
  _loop();
818
- } // create new remoteMedia objects
819
-
700
+ }
820
701
 
702
+ // create new remoteMedia objects
821
703
  var _loop2 = function _loop2() {
822
704
  var _this6$currentLayout2, _this6$currentLayout3;
823
-
824
705
  var _Object$entries3$_i = (0, _slicedToArray2.default)(_Object$entries3[_i2], 2),
825
- paneId = _Object$entries3$_i[0],
826
- slot = _Object$entries3$_i[1];
827
-
706
+ paneId = _Object$entries3$_i[0],
707
+ slot = _Object$entries3$_i[1];
828
708
  var paneInCurrentLayout = (_this6$currentLayout2 = _this6.currentLayout) === null || _this6$currentLayout2 === void 0 ? void 0 : (_this6$currentLayout3 = _this6$currentLayout2.memberVideoPanes) === null || _this6$currentLayout3 === void 0 ? void 0 : _this6$currentLayout3.find(function (paneInLayout) {
829
709
  return paneInLayout.id === paneId;
830
710
  });
831
-
832
711
  if (paneInCurrentLayout) {
833
712
  var remoteMedia = new _remoteMedia.RemoteMedia(slot, _this6.mediaRequestManagers.video, {
834
713
  resolution: paneInCurrentLayout.size
835
714
  });
836
-
837
715
  if (paneInCurrentLayout.csi) {
838
716
  remoteMedia.sendMediaRequest(paneInCurrentLayout.csi, false);
839
717
  }
840
-
841
718
  _this6.media.video.memberPanes[paneId] = remoteMedia;
842
719
  } else {
843
720
  // this should never happen, because this.receiveSlotAllocations are created based on current layout configuration
844
721
  _loggerProxy.default.logger.warn("a pane id ".concat(paneId, " from this.receiveSlotAllocations.receiverSelected cannot be found in the current layout configuration"));
845
722
  }
846
723
  };
847
-
848
724
  for (var _i2 = 0, _Object$entries3 = (0, _entries.default)(this.receiveSlotAllocations.receiverSelected); _i2 < _Object$entries3.length; _i2++) {
849
725
  _loop2();
850
- } // todo: screenshare (SPARK-377812)
851
-
726
+ }
727
+ // todo: screenshare (SPARK-377812)
852
728
 
853
729
  this.mediaRequestManagers.video.commit();
854
730
  }
731
+
855
732
  /**
856
733
  * Invalidates all remote media objects belonging to currently selected layout
857
734
  */
858
-
859
735
  }, {
860
736
  key: "invalidateCurrentRemoteMedia",
861
737
  value: function invalidateCurrentRemoteMedia(options) {
862
738
  var audio = options.audio,
863
- video = options.video,
864
- commit = options.commit;
865
-
739
+ video = options.video,
740
+ commit = options.commit;
866
741
  if (audio && this.media.audio) {
867
742
  this.media.audio.stop(commit);
868
743
  }
869
-
870
744
  if (video) {
871
745
  (0, _values.default)(this.media.video.activeSpeakerGroups).forEach(function (remoteMediaGroup) {
872
746
  remoteMediaGroup.stop(false);
@@ -874,14 +748,13 @@ var RemoteMediaManager = /*#__PURE__*/function (_EventsScope) {
874
748
  (0, _values.default)(this.media.video.memberPanes).forEach(function (remoteMedia) {
875
749
  remoteMedia.stop(false);
876
750
  });
877
-
878
751
  if (commit) {
879
752
  this.mediaRequestManagers.video.commit();
880
753
  }
881
754
  }
882
755
  }
883
- /** emits Event.VideoLayoutChanged */
884
756
 
757
+ /** emits Event.VideoLayoutChanged */
885
758
  }, {
886
759
  key: "emitVideoLayoutChangedEvent",
887
760
  value: function emitVideoLayoutChangedEvent() {
@@ -889,6 +762,7 @@ var RemoteMediaManager = /*#__PURE__*/function (_EventsScope) {
889
762
  // wait for our media requests to be fullfilled, but there is no API for that right now (we could wait for source updates
890
763
  // but in some cases they might never come, or would need to always make sure to use a new set of receiver slots)
891
764
  // for now it's fine to have it like this, we will re-evaluate if it needs improving after more testing
765
+
892
766
  this.emit({
893
767
  file: 'multistream/remoteMediaManager',
894
768
  function: 'emitVideoLayoutChangedEvent'
@@ -897,29 +771,28 @@ var RemoteMediaManager = /*#__PURE__*/function (_EventsScope) {
897
771
  activeSpeakerVideoPanes: this.media.video.activeSpeakerGroups,
898
772
  memberVideoPanes: this.media.video.memberPanes,
899
773
  screenShareVideo: undefined // todo: screen share (SPARK-377812)
900
-
901
774
  });
902
775
  }
776
+
903
777
  /**
904
778
  * Sets a new CSI on a given remote media object
905
779
  *
906
780
  * @param {RemoteMedia} remoteMedia remote Media object to modify
907
781
  * @param {CSI} csi new CSI value, can be null if we want to stop receiving media
908
782
  */
909
-
910
783
  }, {
911
784
  key: "setRemoteVideoCsi",
912
785
  value: function setRemoteVideoCsi(remoteMedia, csi) {
913
786
  if (!(0, _values.default)(this.media.video.memberPanes).includes(remoteMedia)) {
914
787
  throw new Error('remoteMedia not found');
915
788
  }
916
-
917
789
  if (csi) {
918
790
  remoteMedia.sendMediaRequest(csi, true);
919
791
  } else {
920
792
  remoteMedia.cancelMediaRequest(true);
921
793
  }
922
794
  }
795
+
923
796
  /**
924
797
  * Adds a new member video pane to the currently selected layout.
925
798
  *
@@ -928,68 +801,53 @@ var RemoteMediaManager = /*#__PURE__*/function (_EventsScope) {
928
801
  * @param {MemberVideoPane} newPane
929
802
  * @returns {Promise<RemoteMedia>}
930
803
  */
931
-
932
804
  }, {
933
805
  key: "addMemberVideoPane",
934
806
  value: function () {
935
807
  var _addMemberVideoPane = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee6(newPane) {
936
808
  var _this$currentLayout4;
937
-
938
809
  var receiveSlot, remoteMedia;
939
810
  return _regenerator.default.wrap(function _callee6$(_context6) {
940
- while (1) {
941
- switch (_context6.prev = _context6.next) {
942
- case 0:
943
- if (this.currentLayout) {
944
- _context6.next = 2;
945
- break;
946
- }
947
-
948
- throw new Error('There is no current layout selected, call start() first');
949
-
950
- case 2:
951
- if (!((_this$currentLayout4 = this.currentLayout) !== null && _this$currentLayout4 !== void 0 && _this$currentLayout4.memberVideoPanes)) {
952
- this.currentLayout.memberVideoPanes = [];
953
- }
954
-
955
- if (!(newPane.id in this.currentLayout.memberVideoPanes)) {
956
- _context6.next = 5;
957
- break;
958
- }
959
-
960
- throw new Error("duplicate pane id ".concat(newPane.id, " - this pane already exists in current layout's memberVideoPanes"));
961
-
962
- case 5:
963
- this.currentLayout.memberVideoPanes.push(newPane);
964
- _context6.next = 8;
965
- return this.receiveSlotManager.allocateSlot(_internalMediaCore.MediaConnection.MediaType.VideoMain);
966
-
967
- case 8:
968
- receiveSlot = _context6.sent;
969
- this.slots.video.receiverSelected.push(receiveSlot);
970
- remoteMedia = new _remoteMedia.RemoteMedia(receiveSlot, this.mediaRequestManagers.video, {
971
- resolution: newPane.size
972
- });
973
-
974
- if (newPane.csi) {
975
- remoteMedia.sendMediaRequest(newPane.csi, true);
976
- }
977
-
978
- this.media.video.memberPanes[newPane.id] = remoteMedia;
979
- return _context6.abrupt("return", remoteMedia);
980
-
981
- case 14:
982
- case "end":
983
- return _context6.stop();
984
- }
811
+ while (1) switch (_context6.prev = _context6.next) {
812
+ case 0:
813
+ if (this.currentLayout) {
814
+ _context6.next = 2;
815
+ break;
816
+ }
817
+ throw new Error('There is no current layout selected, call start() first');
818
+ case 2:
819
+ if (!((_this$currentLayout4 = this.currentLayout) !== null && _this$currentLayout4 !== void 0 && _this$currentLayout4.memberVideoPanes)) {
820
+ this.currentLayout.memberVideoPanes = [];
821
+ }
822
+ if (!(newPane.id in this.currentLayout.memberVideoPanes)) {
823
+ _context6.next = 5;
824
+ break;
825
+ }
826
+ throw new Error("duplicate pane id ".concat(newPane.id, " - this pane already exists in current layout's memberVideoPanes"));
827
+ case 5:
828
+ this.currentLayout.memberVideoPanes.push(newPane);
829
+ _context6.next = 8;
830
+ return this.receiveSlotManager.allocateSlot(_internalMediaCore.MediaConnection.MediaType.VideoMain);
831
+ case 8:
832
+ receiveSlot = _context6.sent;
833
+ this.slots.video.receiverSelected.push(receiveSlot);
834
+ remoteMedia = new _remoteMedia.RemoteMedia(receiveSlot, this.mediaRequestManagers.video, {
835
+ resolution: newPane.size
836
+ });
837
+ if (newPane.csi) {
838
+ remoteMedia.sendMediaRequest(newPane.csi, true);
839
+ }
840
+ this.media.video.memberPanes[newPane.id] = remoteMedia;
841
+ return _context6.abrupt("return", remoteMedia);
842
+ case 14:
843
+ case "end":
844
+ return _context6.stop();
985
845
  }
986
846
  }, _callee6, this);
987
847
  }));
988
-
989
848
  function addMemberVideoPane(_x2) {
990
849
  return _addMemberVideoPane.apply(this, arguments);
991
850
  }
992
-
993
851
  return addMemberVideoPane;
994
852
  }()
995
853
  /**
@@ -1000,49 +858,40 @@ var RemoteMediaManager = /*#__PURE__*/function (_EventsScope) {
1000
858
  * @param {PaneId} paneId pane id of the pane to remove
1001
859
  * @returns {Promise<void>}
1002
860
  */
1003
-
1004
861
  }, {
1005
862
  key: "removeMemberVideoPane",
1006
863
  value: function removeMemberVideoPane(paneId) {
1007
864
  var _this$currentLayout$m2, _this$currentLayout$m3;
1008
-
1009
865
  if (!this.currentLayout) {
1010
866
  return _promise.default.reject(new Error('There is no current layout selected, call start() first'));
1011
867
  }
1012
-
1013
868
  if (!((_this$currentLayout$m2 = this.currentLayout.memberVideoPanes) !== null && _this$currentLayout$m2 !== void 0 && _this$currentLayout$m2.find(function (pane) {
1014
869
  return pane.id === paneId;
1015
870
  }))) {
1016
871
  // pane id doesn't exist, so nothing to do
1017
872
  _loggerProxy.default.logger.log("RemoteMediaManager#removeMemberVideoPane --> removeMemberVideoPane() called for a non-existent paneId: ".concat(paneId, " (pane not found in currentLayout.memberVideoPanes)"));
1018
-
1019
873
  return _promise.default.resolve();
1020
874
  }
1021
-
1022
875
  if (!this.media.video.memberPanes[paneId]) {
1023
876
  // pane id doesn't exist, so nothing to do
1024
877
  _loggerProxy.default.logger.log("RemoteMediaManager#removeMemberVideoPane --> removeMemberVideoPane() called for a non-existent paneId: ".concat(paneId, " (pane not found in this.media.video.memberPanes)"));
1025
-
1026
878
  return _promise.default.resolve();
1027
879
  }
1028
-
1029
880
  var remoteMedia = this.media.video.memberPanes[paneId];
1030
881
  var receiveSlot = remoteMedia.getUnderlyingReceiveSlot();
1031
-
1032
882
  if (receiveSlot) {
1033
883
  this.receiveSlotManager.releaseSlot(receiveSlot);
1034
884
  var index = this.slots.video.receiverSelected.indexOf(receiveSlot);
1035
-
1036
885
  if (index >= 0) {
1037
886
  this.slots.video.receiverSelected.splice(index, 1);
1038
887
  }
1039
888
  }
1040
-
1041
889
  remoteMedia.stop();
1042
890
  delete this.media.video.memberPanes[paneId];
1043
891
  (_this$currentLayout$m3 = this.currentLayout.memberVideoPanes) === null || _this$currentLayout$m3 === void 0 ? true : delete _this$currentLayout$m3[paneId];
1044
892
  return _promise.default.resolve();
1045
893
  }
894
+
1046
895
  /**
1047
896
  * Pins an active speaker remote media object to the given CSI value. From that moment
1048
897
  * onwards the remote media will only play audio/video from that specific CSI until
@@ -1051,39 +900,35 @@ var RemoteMediaManager = /*#__PURE__*/function (_EventsScope) {
1051
900
  * @param {RemoteMedia} remoteMedia remote media object reference
1052
901
  * @param {CSI} csi CSI value to pin to, if undefined, then current CSI value is used
1053
902
  */
1054
-
1055
903
  }, {
1056
904
  key: "pinActiveSpeakerVideoPane",
1057
905
  value: function pinActiveSpeakerVideoPane(remoteMedia, csi) {
1058
906
  var remoteMediaGroup = (0, _values.default)(this.media.video.activeSpeakerGroups).find(function (group) {
1059
907
  return group.includes(remoteMedia, 'unpinned');
1060
908
  });
1061
-
1062
909
  if (!remoteMediaGroup) {
1063
910
  throw new Error('remoteMedia not found among the unpinned remote media from any active speaker group');
1064
911
  }
1065
-
1066
912
  remoteMediaGroup.pin(remoteMedia, csi);
1067
913
  }
914
+
1068
915
  /**
1069
916
  * Unpins a remote media object from the fixed CSI value it was pinned to.
1070
917
  *
1071
918
  * @param {RemoteMedia} remoteMedia remote media object reference
1072
919
  */
1073
-
1074
920
  }, {
1075
921
  key: "unpinActiveSpeakerVideoPane",
1076
922
  value: function unpinActiveSpeakerVideoPane(remoteMedia) {
1077
923
  var remoteMediaGroup = (0, _values.default)(this.media.video.activeSpeakerGroups).find(function (group) {
1078
924
  return group.includes(remoteMedia, 'pinned');
1079
925
  });
1080
-
1081
926
  if (!remoteMediaGroup) {
1082
927
  throw new Error('remoteMedia not found among the pinned remote media from any active speaker group');
1083
928
  }
1084
-
1085
929
  remoteMediaGroup.unpin(remoteMedia);
1086
930
  }
931
+
1087
932
  /**
1088
933
  * Returns true if a given remote media object belongs to an active speaker group and has been pinned.
1089
934
  * Throws an error if the remote media object doesn't belong to any active speaker remote media group.
@@ -1091,23 +936,19 @@ var RemoteMediaManager = /*#__PURE__*/function (_EventsScope) {
1091
936
  * @param {RemoteMedia} remoteMedia remote media object
1092
937
  * @returns {boolean}
1093
938
  */
1094
-
1095
939
  }, {
1096
940
  key: "isPinned",
1097
941
  value: function isPinned(remoteMedia) {
1098
942
  var remoteMediaGroup = (0, _values.default)(this.media.video.activeSpeakerGroups).find(function (group) {
1099
943
  return group.includes(remoteMedia);
1100
944
  });
1101
-
1102
945
  if (!remoteMediaGroup) {
1103
946
  throw new Error('remoteMedia not found among any remote media (pinned or unpinned) from any active speaker group');
1104
947
  }
1105
-
1106
948
  return remoteMediaGroup.isPinned(remoteMedia);
1107
949
  }
1108
950
  }]);
1109
951
  return RemoteMediaManager;
1110
952
  }(_eventsScope.default);
1111
-
1112
953
  exports.RemoteMediaManager = RemoteMediaManager;
1113
954
  //# sourceMappingURL=remoteMediaManager.js.map