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

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 (152) hide show
  1. package/dist/breakouts/breakout.js +116 -0
  2. package/dist/breakouts/breakout.js.map +1 -0
  3. package/dist/breakouts/collection.js +23 -0
  4. package/dist/breakouts/collection.js.map +1 -0
  5. package/dist/breakouts/index.js +226 -0
  6. package/dist/breakouts/index.js.map +1 -0
  7. package/dist/config.js +4 -1
  8. package/dist/config.js.map +1 -1
  9. package/dist/constants.js +38 -5
  10. package/dist/constants.js.map +1 -1
  11. package/dist/locus-info/controlsUtils.js +2 -1
  12. package/dist/locus-info/controlsUtils.js.map +1 -1
  13. package/dist/locus-info/index.js +48 -0
  14. package/dist/locus-info/index.js.map +1 -1
  15. package/dist/locus-info/parser.js +1 -0
  16. package/dist/locus-info/parser.js.map +1 -1
  17. package/dist/locus-info/selfUtils.js +19 -11
  18. package/dist/locus-info/selfUtils.js.map +1 -1
  19. package/dist/media/index.js +3 -3
  20. package/dist/media/index.js.map +1 -1
  21. package/dist/media/properties.js +4 -4
  22. package/dist/media/properties.js.map +1 -1
  23. package/dist/meeting/index.js +651 -460
  24. package/dist/meeting/index.js.map +1 -1
  25. package/dist/meeting/request.js +25 -44
  26. package/dist/meeting/request.js.map +1 -1
  27. package/dist/meeting/request.type.js.map +1 -1
  28. package/dist/meeting/util.js +4 -57
  29. package/dist/meeting/util.js.map +1 -1
  30. package/dist/meeting-info/meeting-info-v2.js +2 -0
  31. package/dist/meeting-info/meeting-info-v2.js.map +1 -1
  32. package/dist/meetings/index.js +28 -18
  33. package/dist/meetings/index.js.map +1 -1
  34. package/dist/meetings/request.js +14 -12
  35. package/dist/meetings/request.js.map +1 -1
  36. package/dist/member/index.js +9 -0
  37. package/dist/member/index.js.map +1 -1
  38. package/dist/member/util.js +14 -1
  39. package/dist/member/util.js.map +1 -1
  40. package/dist/members/index.js +8 -6
  41. package/dist/members/index.js.map +1 -1
  42. package/dist/members/request.js +3 -1
  43. package/dist/members/request.js.map +1 -1
  44. package/dist/multistream/mediaRequestManager.js +46 -6
  45. package/dist/multistream/mediaRequestManager.js.map +1 -1
  46. package/dist/multistream/multistreamMedia.js +4 -0
  47. package/dist/multistream/multistreamMedia.js.map +1 -1
  48. package/dist/multistream/receiveSlot.js +3 -3
  49. package/dist/multistream/receiveSlot.js.map +1 -1
  50. package/dist/multistream/receiveSlotManager.js +8 -6
  51. package/dist/multistream/receiveSlotManager.js.map +1 -1
  52. package/dist/multistream/remoteMedia.js.map +1 -1
  53. package/dist/multistream/remoteMediaGroup.js.map +1 -1
  54. package/dist/multistream/remoteMediaManager.js +168 -63
  55. package/dist/multistream/remoteMediaManager.js.map +1 -1
  56. package/dist/reachability/index.js +63 -51
  57. package/dist/reachability/index.js.map +1 -1
  58. package/dist/reactions/constants.js +13 -0
  59. package/dist/reactions/constants.js.map +1 -0
  60. package/dist/reactions/reactions.type.js.map +1 -1
  61. package/dist/reconnection-manager/index.js +25 -12
  62. package/dist/reconnection-manager/index.js.map +1 -1
  63. package/dist/recording-controller/enums.js +17 -0
  64. package/dist/recording-controller/enums.js.map +1 -0
  65. package/dist/recording-controller/index.js +343 -0
  66. package/dist/recording-controller/index.js.map +1 -0
  67. package/dist/recording-controller/util.js +63 -0
  68. package/dist/recording-controller/util.js.map +1 -0
  69. package/dist/roap/request.js +88 -68
  70. package/dist/roap/request.js.map +1 -1
  71. package/dist/roap/turnDiscovery.js +72 -47
  72. package/dist/roap/turnDiscovery.js.map +1 -1
  73. package/dist/statsAnalyzer/index.js +3 -3
  74. package/dist/statsAnalyzer/index.js.map +1 -1
  75. package/dist/statsAnalyzer/mqaUtil.js +18 -6
  76. package/dist/statsAnalyzer/mqaUtil.js.map +1 -1
  77. package/package.json +24 -19
  78. package/src/breakouts/README.md +190 -0
  79. package/src/breakouts/breakout.ts +110 -0
  80. package/src/breakouts/collection.ts +19 -0
  81. package/src/breakouts/index.ts +225 -0
  82. package/src/config.ts +4 -1
  83. package/src/constants.ts +35 -1
  84. package/src/locus-info/controlsUtils.ts +2 -0
  85. package/src/locus-info/index.ts +59 -1
  86. package/src/locus-info/parser.ts +1 -0
  87. package/src/locus-info/selfUtils.ts +8 -0
  88. package/src/media/index.ts +1 -2
  89. package/src/media/properties.ts +6 -9
  90. package/src/meeting/index.ts +352 -111
  91. package/src/meeting/request.ts +9 -31
  92. package/src/meeting/request.type.ts +2 -0
  93. package/src/meeting/util.ts +3 -60
  94. package/src/meeting-info/meeting-info-v2.ts +2 -0
  95. package/src/meetings/index.ts +10 -5
  96. package/src/meetings/request.ts +1 -1
  97. package/src/member/index.ts +9 -0
  98. package/src/member/util.ts +14 -1
  99. package/src/members/index.ts +1 -0
  100. package/src/members/request.ts +1 -0
  101. package/src/multistream/mediaRequestManager.ts +79 -15
  102. package/src/multistream/multistreamMedia.ts +4 -0
  103. package/src/multistream/receiveSlot.ts +17 -12
  104. package/src/multistream/receiveSlotManager.ts +22 -21
  105. package/src/multistream/remoteMedia.ts +1 -1
  106. package/src/multistream/remoteMediaGroup.ts +2 -2
  107. package/src/multistream/remoteMediaManager.ts +150 -37
  108. package/src/reachability/index.ts +16 -13
  109. package/src/reactions/constants.ts +4 -0
  110. package/src/reactions/reactions.type.ts +25 -0
  111. package/src/reconnection-manager/index.ts +18 -9
  112. package/src/recording-controller/enums.ts +8 -0
  113. package/src/recording-controller/index.ts +315 -0
  114. package/src/recording-controller/util.ts +58 -0
  115. package/src/roap/request.ts +78 -73
  116. package/src/roap/turnDiscovery.ts +8 -6
  117. package/src/statsAnalyzer/index.ts +4 -4
  118. package/src/statsAnalyzer/mqaUtil.ts +6 -0
  119. package/test/unit/spec/breakouts/breakout.ts +119 -0
  120. package/test/unit/spec/breakouts/collection.ts +15 -0
  121. package/test/unit/spec/breakouts/index.ts +293 -0
  122. package/test/unit/spec/locus-info/controlsUtils.js +20 -0
  123. package/test/unit/spec/locus-info/index.js +103 -0
  124. package/test/unit/spec/locus-info/selfConstant.js +25 -0
  125. package/test/unit/spec/locus-info/selfUtils.js +84 -0
  126. package/test/unit/spec/media/index.ts +1 -1
  127. package/test/unit/spec/media/properties.ts +9 -9
  128. package/test/unit/spec/meeting/effectsState.js +5 -1
  129. package/test/unit/spec/meeting/index.js +235 -50
  130. package/test/unit/spec/meeting/request.js +17 -0
  131. package/test/unit/spec/meeting/utils.js +20 -129
  132. package/test/unit/spec/meetings/index.js +1 -0
  133. package/test/unit/spec/member/util.js +26 -1
  134. package/test/unit/spec/multistream/mediaRequestManager.ts +312 -50
  135. package/test/unit/spec/multistream/receiveSlot.ts +6 -6
  136. package/test/unit/spec/multistream/receiveSlotManager.ts +13 -13
  137. package/test/unit/spec/multistream/remoteMedia.ts +2 -2
  138. package/test/unit/spec/multistream/remoteMediaGroup.ts +5 -5
  139. package/test/unit/spec/multistream/remoteMediaManager.ts +354 -65
  140. package/test/unit/spec/reachability/index.ts +58 -24
  141. package/test/unit/spec/reconnection-manager/index.js +42 -13
  142. package/test/unit/spec/recording-controller/index.js +231 -0
  143. package/test/unit/spec/recording-controller/util.js +102 -0
  144. package/test/unit/spec/roap/index.ts +2 -1
  145. package/test/unit/spec/roap/request.ts +114 -0
  146. package/test/unit/spec/roap/turnDiscovery.ts +45 -29
  147. package/test/unit/spec/stats-analyzer/index.js +2 -2
  148. package/test/utils/webex-test-users.js +1 -0
  149. package/tsconfig.json +6 -0
  150. package/dist/media/internal-media-core-wrapper.js +0 -18
  151. package/dist/media/internal-media-core-wrapper.js.map +0 -1
  152. package/src/media/internal-media-core-wrapper.ts +0 -9
@@ -35,9 +35,6 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !_R
35
35
 
36
36
  // An "all equal" grid, with size up to 3 x 3 = 9:
37
37
  var AllEqualLayout = {
38
- screenShareVideo: {
39
- size: null
40
- },
41
38
  activeSpeakerVideoPaneGroups: [{
42
39
  id: 'main',
43
40
  numPanes: 9,
@@ -48,9 +45,6 @@ var AllEqualLayout = {
48
45
 
49
46
  // A layout with just a single remote active speaker video pane:
50
47
  var SingleLayout = {
51
- screenShareVideo: {
52
- size: null
53
- },
54
48
  activeSpeakerVideoPaneGroups: [{
55
49
  id: 'main',
56
50
  numPanes: 1,
@@ -61,9 +55,6 @@ var SingleLayout = {
61
55
 
62
56
  // A layout with 1 big pane for the highest priority active speaker and 5 small panes for other active speakers:
63
57
  var OnePlusFiveLayout = {
64
- screenShareVideo: {
65
- size: null
66
- },
67
58
  activeSpeakerVideoPaneGroups: [{
68
59
  id: 'mainBigOne',
69
60
  numPanes: 1,
@@ -79,9 +70,6 @@ var OnePlusFiveLayout = {
79
70
 
80
71
  // A layout with 2 big panes for 2 main active speakers and a strip of 6 small panes for other active speakers:
81
72
  var TwoMainPlusSixSmallLayout = {
82
- screenShareVideo: {
83
- size: null
84
- },
85
73
  activeSpeakerVideoPaneGroups: [{
86
74
  id: 'mainGroupWith2BigPanes',
87
75
  numPanes: 2,
@@ -97,9 +85,7 @@ var TwoMainPlusSixSmallLayout = {
97
85
 
98
86
  // A strip of 8 small video panes (thumbnails) displayed at the top of a remote screenshare:
99
87
  var RemoteScreenShareWithSmallThumbnailsLayout = {
100
- screenShareVideo: {
101
- size: 'best'
102
- },
88
+ // screenShareVideo: {size: 'best'}, // todo: SPARK-393485: uncomment this once backend supports screen sharing
103
89
  activeSpeakerVideoPaneGroups: [{
104
90
  id: 'thumbnails',
105
91
  numPanes: 8,
@@ -110,9 +96,6 @@ var RemoteScreenShareWithSmallThumbnailsLayout = {
110
96
 
111
97
  // 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:
112
98
  var Stage2x2With6ThumbnailsLayout = {
113
- screenShareVideo: {
114
- size: null
115
- },
116
99
  activeSpeakerVideoPaneGroups: [{
117
100
  id: 'thumbnails',
118
101
  numPanes: 6,
@@ -146,8 +129,10 @@ var Stage2x2With6ThumbnailsLayout = {
146
129
  */
147
130
  var DefaultConfiguration = {
148
131
  audio: {
149
- numOfActiveSpeakerStreams: 3
132
+ numOfActiveSpeakerStreams: 3,
133
+ numOfScreenShareStreams: 0 // todo: SPARK-393485: change to 1 once backend supports screen sharing
150
134
  },
135
+
151
136
  video: {
152
137
  preferLiveVideo: true,
153
138
  initialLayoutId: 'AllEqual',
@@ -158,10 +143,6 @@ var DefaultConfiguration = {
158
143
  Stage: Stage2x2With6ThumbnailsLayout,
159
144
  ScreenShareView: RemoteScreenShareWithSmallThumbnailsLayout
160
145
  }
161
- },
162
- screenShare: {
163
- audio: true,
164
- video: true
165
146
  }
166
147
  };
167
148
  exports.DefaultConfiguration = DefaultConfiguration;
@@ -169,7 +150,7 @@ var Event;
169
150
  exports.Event = Event;
170
151
  (function (Event) {
171
152
  Event["AudioCreated"] = "AudioCreated";
172
- Event["ScreenShareAudioCreated"] = "ScreenShareCreated";
153
+ Event["ScreenShareAudioCreated"] = "ScreenShareAudioCreated";
173
154
  Event["VideoLayoutChanged"] = "VideoLayoutChanged";
174
155
  })(Event || (exports.Event = Event = {}));
175
156
  /**
@@ -213,13 +194,19 @@ var RemoteMediaManager = /*#__PURE__*/function (_EventsScope) {
213
194
  video: {
214
195
  activeSpeakerGroups: {},
215
196
  memberPanes: {}
197
+ },
198
+ screenShare: {
199
+ audio: undefined,
200
+ video: undefined
216
201
  }
217
202
  };
218
203
  _this.checkConfigValidity();
219
204
  _this.slots = {
220
205
  audio: [],
221
- screenShareAudio: undefined,
222
- screenShareVideo: undefined,
206
+ screenShare: {
207
+ audio: [],
208
+ video: undefined
209
+ },
223
210
  video: {
224
211
  unused: [],
225
212
  activeSpeaker: [],
@@ -292,11 +279,15 @@ var RemoteMediaManager = /*#__PURE__*/function (_EventsScope) {
292
279
  return this.createAudioMedia();
293
280
  case 5:
294
281
  _context.next = 7;
295
- return this.preallocateVideoReceiveSlots();
282
+ return this.createScreenShareReceiveSlots();
296
283
  case 7:
297
- _context.next = 9;
284
+ this.createScreenShareAudioMedia();
285
+ _context.next = 10;
286
+ return this.preallocateVideoReceiveSlots();
287
+ case 10:
288
+ _context.next = 12;
298
289
  return this.setLayout(this.config.video.initialLayoutId);
299
- case 9:
290
+ case 12:
300
291
  case "end":
301
292
  return _context.stop();
302
293
  }
@@ -321,6 +312,8 @@ var RemoteMediaManager = /*#__PURE__*/function (_EventsScope) {
321
312
  this.invalidateCurrentRemoteMedia({
322
313
  audio: true,
323
314
  video: true,
315
+ screenShareAudio: true,
316
+ screenShareVideo: true,
324
317
  commit: true
325
318
  });
326
319
 
@@ -330,8 +323,17 @@ var RemoteMediaManager = /*#__PURE__*/function (_EventsScope) {
330
323
  });
331
324
  this.slots.audio.length = 0;
332
325
 
333
- // todo: screenshare slots... (SPARK-377812)
326
+ // release screen share slots
327
+ this.slots.screenShare.audio.forEach(function (slot) {
328
+ return _this2.receiveSlotManager.releaseSlot(slot);
329
+ });
330
+ this.slots.screenShare.audio.length = 0;
331
+ if (this.slots.screenShare.video) {
332
+ this.receiveSlotManager.releaseSlot(this.slots.screenShare.video);
333
+ this.slots.screenShare.video = undefined;
334
+ }
334
335
 
336
+ // release video slots
335
337
  this.receiveSlotAllocations = {
336
338
  activeSpeaker: {},
337
339
  receiverSelected: {}
@@ -390,7 +392,7 @@ var RemoteMediaManager = /*#__PURE__*/function (_EventsScope) {
390
392
  }
391
393
  _context2.t0 = this.slots.video.unused;
392
394
  _context2.next = 5;
393
- return this.receiveSlotManager.allocateSlot(_internalMediaCore.MediaConnection.MediaType.VideoMain);
395
+ return this.receiveSlotManager.allocateSlot(_internalMediaCore.MediaType.VideoMain);
394
396
  case 5:
395
397
  _context2.t1 = _context2.sent;
396
398
  _context2.t0.push.call(_context2.t0, _context2.t1);
@@ -438,8 +440,9 @@ var RemoteMediaManager = /*#__PURE__*/function (_EventsScope) {
438
440
  return this.updateVideoReceiveSlots();
439
441
  case 8:
440
442
  this.updateVideoRemoteMediaObjects();
443
+ this.updateScreenShareVideoRemoteMediaObject();
441
444
  this.emitVideoLayoutChangedEvent();
442
- case 10:
445
+ case 11:
443
446
  case "end":
444
447
  return _context3.stop();
445
448
  }
@@ -479,7 +482,7 @@ var RemoteMediaManager = /*#__PURE__*/function (_EventsScope) {
479
482
  break;
480
483
  }
481
484
  _context4.next = 4;
482
- return this.receiveSlotManager.allocateSlot(_internalMediaCore.MediaConnection.MediaType.AudioMain);
485
+ return this.receiveSlotManager.allocateSlot(_internalMediaCore.MediaType.AudioMain);
483
486
  case 4:
484
487
  slot = _context4.sent;
485
488
  this.slots.audio.push(slot);
@@ -505,6 +508,71 @@ var RemoteMediaManager = /*#__PURE__*/function (_EventsScope) {
505
508
  }
506
509
  return createAudioMedia;
507
510
  }()
511
+ /**
512
+ * Creates receive slots required for receiving screen share audio and video
513
+ */
514
+ }, {
515
+ key: "createScreenShareReceiveSlots",
516
+ value: function () {
517
+ var _createScreenShareReceiveSlots = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee5() {
518
+ var i, slot, isAnyLayoutContainingScreenShareVideo;
519
+ return _regenerator.default.wrap(function _callee5$(_context5) {
520
+ while (1) switch (_context5.prev = _context5.next) {
521
+ case 0:
522
+ i = 0;
523
+ case 1:
524
+ if (!(i < this.config.audio.numOfScreenShareStreams)) {
525
+ _context5.next = 9;
526
+ break;
527
+ }
528
+ _context5.next = 4;
529
+ return this.receiveSlotManager.allocateSlot(_internalMediaCore.MediaType.AudioSlides);
530
+ case 4:
531
+ slot = _context5.sent;
532
+ this.slots.screenShare.audio.push(slot);
533
+ case 6:
534
+ i += 1;
535
+ _context5.next = 1;
536
+ break;
537
+ case 9:
538
+ // video
539
+ isAnyLayoutContainingScreenShareVideo = (0, _values.default)(this.config.video.layouts).some(function (layout) {
540
+ return !!layout.screenShareVideo;
541
+ });
542
+ if (!isAnyLayoutContainingScreenShareVideo) {
543
+ _context5.next = 14;
544
+ break;
545
+ }
546
+ _context5.next = 13;
547
+ return this.receiveSlotManager.allocateSlot(_internalMediaCore.MediaType.VideoSlides);
548
+ case 13:
549
+ this.slots.screenShare.video = _context5.sent;
550
+ case 14:
551
+ case "end":
552
+ return _context5.stop();
553
+ }
554
+ }, _callee5, this);
555
+ }));
556
+ function createScreenShareReceiveSlots() {
557
+ return _createScreenShareReceiveSlots.apply(this, arguments);
558
+ }
559
+ return createScreenShareReceiveSlots;
560
+ }()
561
+ /**
562
+ * Creates RemoteMedia objects for screen share
563
+ */
564
+ }, {
565
+ key: "createScreenShareAudioMedia",
566
+ value: function createScreenShareAudioMedia() {
567
+ if (this.slots.screenShare.audio.length > 0) {
568
+ this.media.screenShare.audio = new _remoteMediaGroup.RemoteMediaGroup(this.mediaRequestManagers.screenShareAudio, this.slots.screenShare.audio, 255, true);
569
+ this.emit({
570
+ file: 'multistream/remoteMediaManager',
571
+ function: 'createScreenShareAudioMedia'
572
+ }, Event.ScreenShareAudioCreated, this.media.screenShare.audio);
573
+ }
574
+ }
575
+
508
576
  /**
509
577
  * Goes over all receiver-selected slots and keeps only the ones that are required by a given layout,
510
578
  * the rest are all moved to the "unused" list
@@ -605,32 +673,32 @@ var RemoteMediaManager = /*#__PURE__*/function (_EventsScope) {
605
673
  }, {
606
674
  key: "updateVideoReceiveSlots",
607
675
  value: function () {
608
- var _updateVideoReceiveSlots = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee5() {
676
+ var _updateVideoReceiveSlots = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee6() {
609
677
  var _this$slots$video$unu4;
610
678
  var requiredNumSlots, totalNumSlots, numSlotsToCreate;
611
- return _regenerator.default.wrap(function _callee5$(_context5) {
612
- while (1) switch (_context5.prev = _context5.next) {
679
+ return _regenerator.default.wrap(function _callee6$(_context6) {
680
+ while (1) switch (_context6.prev = _context6.next) {
613
681
  case 0:
614
682
  requiredNumSlots = this.getRequiredNumVideoSlotsForLayout(this.currentLayout);
615
683
  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
684
  if (!(totalNumSlots < requiredNumSlots)) {
617
- _context5.next = 13;
685
+ _context6.next = 13;
618
686
  break;
619
687
  }
620
688
  numSlotsToCreate = requiredNumSlots - totalNumSlots;
621
689
  case 4:
622
690
  if (!(numSlotsToCreate > 0)) {
623
- _context5.next = 13;
691
+ _context6.next = 13;
624
692
  break;
625
693
  }
626
- _context5.t0 = this.slots.video.unused;
627
- _context5.next = 8;
628
- return this.receiveSlotManager.allocateSlot(_internalMediaCore.MediaConnection.MediaType.VideoMain);
694
+ _context6.t0 = this.slots.video.unused;
695
+ _context6.next = 8;
696
+ return this.receiveSlotManager.allocateSlot(_internalMediaCore.MediaType.VideoMain);
629
697
  case 8:
630
- _context5.t1 = _context5.sent;
631
- _context5.t0.push.call(_context5.t0, _context5.t1);
698
+ _context6.t1 = _context6.sent;
699
+ _context6.t0.push.call(_context6.t0, _context6.t1);
632
700
  numSlotsToCreate -= 1;
633
- _context5.next = 4;
701
+ _context6.next = 4;
634
702
  break;
635
703
  case 13:
636
704
  // move all no longer needed receiver-selected slots to "unused"
@@ -649,9 +717,9 @@ var RemoteMediaManager = /*#__PURE__*/function (_EventsScope) {
649
717
  this.releaseUnusedVideoSlots();
650
718
  case 19:
651
719
  case "end":
652
- return _context5.stop();
720
+ return _context6.stop();
653
721
  }
654
- }, _callee5, this);
722
+ }, _callee6, this);
655
723
  }));
656
724
  function updateVideoReceiveSlots() {
657
725
  return _updateVideoReceiveSlots.apply(this, arguments);
@@ -670,6 +738,8 @@ var RemoteMediaManager = /*#__PURE__*/function (_EventsScope) {
670
738
  this.invalidateCurrentRemoteMedia({
671
739
  audio: false,
672
740
  video: true,
741
+ screenShareAudio: false,
742
+ screenShareVideo: false,
673
743
  commit: false
674
744
  });
675
745
 
@@ -724,11 +794,37 @@ var RemoteMediaManager = /*#__PURE__*/function (_EventsScope) {
724
794
  for (var _i2 = 0, _Object$entries3 = (0, _entries.default)(this.receiveSlotAllocations.receiverSelected); _i2 < _Object$entries3.length; _i2++) {
725
795
  _loop2();
726
796
  }
727
- // todo: screenshare (SPARK-377812)
728
-
729
797
  this.mediaRequestManagers.video.commit();
730
798
  }
731
799
 
800
+ /**
801
+ * Checks if current layout requires a screen share.
802
+ * If it does, it creates new RemoteMediaGroup object for screen share
803
+ * and sends the media requests for it.
804
+ * If it doesn't, it makes sure we clean up any RemoteMediaGroup objects
805
+ * created earlier for screen share (for previous layout).
806
+ */
807
+ }, {
808
+ key: "updateScreenShareVideoRemoteMediaObject",
809
+ value: function updateScreenShareVideoRemoteMediaObject() {
810
+ var _this$currentLayout4;
811
+ this.invalidateCurrentRemoteMedia({
812
+ audio: false,
813
+ video: false,
814
+ screenShareAudio: false,
815
+ screenShareVideo: true,
816
+ commit: false
817
+ });
818
+ this.media.screenShare.video = undefined;
819
+ if ((_this$currentLayout4 = this.currentLayout) !== null && _this$currentLayout4 !== void 0 && _this$currentLayout4.screenShareVideo) {
820
+ // we create a group of 1, because for screen share we need to use the "active speaker" policy
821
+ this.media.screenShare.video = new _remoteMediaGroup.RemoteMediaGroup(this.mediaRequestManagers.screenShareVideo, [this.slots.screenShare.video], 255, false, {
822
+ resolution: this.currentLayout.screenShareVideo.size
823
+ });
824
+ }
825
+ this.mediaRequestManagers.screenShareVideo.commit();
826
+ }
827
+
732
828
  /**
733
829
  * Invalidates all remote media objects belonging to currently selected layout
734
830
  */
@@ -737,6 +833,8 @@ var RemoteMediaManager = /*#__PURE__*/function (_EventsScope) {
737
833
  value: function invalidateCurrentRemoteMedia(options) {
738
834
  var audio = options.audio,
739
835
  video = options.video,
836
+ screenShareAudio = options.screenShareAudio,
837
+ screenShareVideo = options.screenShareVideo,
740
838
  commit = options.commit;
741
839
  if (audio && this.media.audio) {
742
840
  this.media.audio.stop(commit);
@@ -752,14 +850,21 @@ var RemoteMediaManager = /*#__PURE__*/function (_EventsScope) {
752
850
  this.mediaRequestManagers.video.commit();
753
851
  }
754
852
  }
853
+ if (screenShareAudio && this.media.screenShare.audio) {
854
+ this.media.screenShare.audio.stop(commit);
855
+ }
856
+ if (screenShareVideo && this.media.screenShare.video) {
857
+ this.media.screenShare.video.stop(commit);
858
+ }
755
859
  }
756
860
 
757
861
  /** emits Event.VideoLayoutChanged */
758
862
  }, {
759
863
  key: "emitVideoLayoutChangedEvent",
760
864
  value: function emitVideoLayoutChangedEvent() {
865
+ var _this$media$screenSha;
761
866
  // todo: at this point the receive slots might still be showing a participant from previous layout, we should
762
- // wait for our media requests to be fullfilled, but there is no API for that right now (we could wait for source updates
867
+ // wait for our media requests to be fulfilled, but there is no API for that right now (we could wait for source updates
763
868
  // but in some cases they might never come, or would need to always make sure to use a new set of receiver slots)
764
869
  // for now it's fine to have it like this, we will re-evaluate if it needs improving after more testing
765
870
 
@@ -770,7 +875,7 @@ var RemoteMediaManager = /*#__PURE__*/function (_EventsScope) {
770
875
  layoutId: this.currentLayoutId,
771
876
  activeSpeakerVideoPanes: this.media.video.activeSpeakerGroups,
772
877
  memberVideoPanes: this.media.video.memberPanes,
773
- screenShareVideo: undefined // todo: screen share (SPARK-377812)
878
+ screenShareVideo: (_this$media$screenSha = this.media.screenShare.video) === null || _this$media$screenSha === void 0 ? void 0 : _this$media$screenSha.getRemoteMedia()[0]
774
879
  });
775
880
  }
776
881
 
@@ -804,32 +909,32 @@ var RemoteMediaManager = /*#__PURE__*/function (_EventsScope) {
804
909
  }, {
805
910
  key: "addMemberVideoPane",
806
911
  value: function () {
807
- var _addMemberVideoPane = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee6(newPane) {
808
- var _this$currentLayout4;
912
+ var _addMemberVideoPane = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee7(newPane) {
913
+ var _this$currentLayout5;
809
914
  var receiveSlot, remoteMedia;
810
- return _regenerator.default.wrap(function _callee6$(_context6) {
811
- while (1) switch (_context6.prev = _context6.next) {
915
+ return _regenerator.default.wrap(function _callee7$(_context7) {
916
+ while (1) switch (_context7.prev = _context7.next) {
812
917
  case 0:
813
918
  if (this.currentLayout) {
814
- _context6.next = 2;
919
+ _context7.next = 2;
815
920
  break;
816
921
  }
817
922
  throw new Error('There is no current layout selected, call start() first');
818
923
  case 2:
819
- if (!((_this$currentLayout4 = this.currentLayout) !== null && _this$currentLayout4 !== void 0 && _this$currentLayout4.memberVideoPanes)) {
924
+ if (!((_this$currentLayout5 = this.currentLayout) !== null && _this$currentLayout5 !== void 0 && _this$currentLayout5.memberVideoPanes)) {
820
925
  this.currentLayout.memberVideoPanes = [];
821
926
  }
822
927
  if (!(newPane.id in this.currentLayout.memberVideoPanes)) {
823
- _context6.next = 5;
928
+ _context7.next = 5;
824
929
  break;
825
930
  }
826
931
  throw new Error("duplicate pane id ".concat(newPane.id, " - this pane already exists in current layout's memberVideoPanes"));
827
932
  case 5:
828
933
  this.currentLayout.memberVideoPanes.push(newPane);
829
- _context6.next = 8;
830
- return this.receiveSlotManager.allocateSlot(_internalMediaCore.MediaConnection.MediaType.VideoMain);
934
+ _context7.next = 8;
935
+ return this.receiveSlotManager.allocateSlot(_internalMediaCore.MediaType.VideoMain);
831
936
  case 8:
832
- receiveSlot = _context6.sent;
937
+ receiveSlot = _context7.sent;
833
938
  this.slots.video.receiverSelected.push(receiveSlot);
834
939
  remoteMedia = new _remoteMedia.RemoteMedia(receiveSlot, this.mediaRequestManagers.video, {
835
940
  resolution: newPane.size
@@ -838,12 +943,12 @@ var RemoteMediaManager = /*#__PURE__*/function (_EventsScope) {
838
943
  remoteMedia.sendMediaRequest(newPane.csi, true);
839
944
  }
840
945
  this.media.video.memberPanes[newPane.id] = remoteMedia;
841
- return _context6.abrupt("return", remoteMedia);
946
+ return _context7.abrupt("return", remoteMedia);
842
947
  case 14:
843
948
  case "end":
844
- return _context6.stop();
949
+ return _context7.stop();
845
950
  }
846
- }, _callee6, this);
951
+ }, _callee7, this);
847
952
  }));
848
953
  function addMemberVideoPane(_x2) {
849
954
  return _addMemberVideoPane.apply(this, arguments);