@webex/plugin-meetings 1.149.2 → 1.150.0

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.
@@ -523,13 +523,19 @@ export default class MeetingRequest extends StatelessWebexPlugin {
523
523
  };
524
524
  }
525
525
 
526
+ const body = {
527
+ floor: floorReq,
528
+ resourceUrl: options.resourceUrl
529
+ };
530
+
531
+ if (options?.resourceToken) {
532
+ body.resourceToken = options?.resourceToken;
533
+ }
534
+
526
535
  return this.request({
527
536
  uri: options.uri,
528
537
  method: HTTP_VERBS.PUT,
529
- body: {
530
- floor: floorReq,
531
- resourceUrl: options.resourceUrl
532
- }
538
+ body
533
539
  });
534
540
  }
535
541
 
@@ -4,7 +4,7 @@
4
4
  import {isEmpty} from 'lodash';
5
5
  import {StatelessWebexPlugin} from '@webex/webex-core';
6
6
 
7
- import {MEETINGS, EVENT_TRIGGERS, FLOOR_ACTION, CONTENT} from '../constants';
7
+ import {MEETINGS, EVENT_TRIGGERS, FLOOR_ACTION, CONTENT, WHITEBOARD} from '../constants';
8
8
  import Trigger from '../common/events/trigger-proxy';
9
9
  import Member from '../member';
10
10
  import LoggerProxy from '../common/logs/logger-proxy';
@@ -132,6 +132,14 @@ export default class Members extends StatelessWebexPlugin {
132
132
  * @memberof Members
133
133
  */
134
134
  this.mediaShareContentId = null;
135
+ /**
136
+ * The current mediaShareWhiteboardId for the meeting
137
+ * @instance
138
+ * @type {String}
139
+ * @private
140
+ * @memberof Members
141
+ */
142
+ this.mediaShareWhiteboardId = null;
135
143
  /**
136
144
  * The current recordingId for the meeting, if it exists
137
145
  * @instance
@@ -281,20 +289,49 @@ export default class Members extends StatelessWebexPlugin {
281
289
  * @memberof Members
282
290
  */
283
291
  locusMediaSharesUpdate(payload) {
284
- const currentContent = payload.current;
285
- const previousContent = payload.previous;
292
+ const currentContent = payload.current?.content;
293
+ const previousContent = payload.previous?.content;
294
+ const currentWhiteboard = payload.current?.whiteboard;
295
+ const previousWhiteboard = payload.previous?.whiteboard;
286
296
  let whoSharing = null;
287
297
  let whoStopped = null;
288
298
 
289
- if (currentContent && currentContent.contentId) {
299
+ if (currentContent?.beneficiaryId) {
290
300
  if (currentContent.disposition === FLOOR_ACTION.GRANTED) {
291
- whoSharing = currentContent.contentId;
292
- whoStopped = previousContent && previousContent.contentId;
301
+ whoSharing = currentContent.beneficiaryId;
302
+ this.mediaShareWhiteboardId = null;
303
+ this.mediaShareContentId = whoSharing;
304
+ }
305
+
306
+ if (previousContent?.disposition === FLOOR_ACTION.GRANTED) {
307
+ if (currentContent.disposition === FLOOR_ACTION.RELEASED) {
308
+ whoStopped = currentContent.beneficiaryId;
309
+ this.mediaShareContentId = null;
310
+ }
311
+ else if (currentContent.disposition === FLOOR_ACTION.GRANTED && currentContent.beneficiaryId !== previousContent.beneficiaryId) {
312
+ whoStopped = previousContent.beneficiaryId;
313
+ }
293
314
  }
294
- else if (currentContent.disposition === FLOOR_ACTION.RELEASED) {
295
- whoStopped = currentContent.contentId;
315
+ }
316
+
317
+ if (currentWhiteboard?.beneficiaryId) {
318
+ if (currentWhiteboard.disposition === FLOOR_ACTION.GRANTED) {
319
+ whoSharing = currentWhiteboard.beneficiaryId;
320
+ this.mediaShareContentId = null;
321
+ this.mediaShareWhiteboardId = whoSharing;
322
+ }
323
+
324
+ if (previousWhiteboard?.disposition === FLOOR_ACTION.GRANTED) {
325
+ if (currentWhiteboard.disposition === FLOOR_ACTION.RELEASED) {
326
+ whoStopped = currentWhiteboard.beneficiaryId;
327
+ this.mediaShareWhiteboardId = null;
328
+ }
329
+ else if (currentWhiteboard.disposition === FLOOR_ACTION.GRANTED && currentWhiteboard.beneficiaryId !== previousWhiteboard.beneficiaryId) {
330
+ whoStopped = previousWhiteboard.beneficiaryId;
331
+ }
296
332
  }
297
333
  }
334
+
298
335
  if (whoSharing) {
299
336
  const shareMember = this.membersCollection.get(whoSharing);
300
337
 
@@ -309,7 +346,7 @@ export default class Members extends StatelessWebexPlugin {
309
346
  stopMember.setIsContentSharing(false);
310
347
  }
311
348
  }
312
- this.mediaShareContentId = whoSharing;
349
+
313
350
  Trigger.trigger(
314
351
  this,
315
352
  {
@@ -318,8 +355,8 @@ export default class Members extends StatelessWebexPlugin {
318
355
  },
319
356
  EVENT_TRIGGERS.MEMBERS_CONTENT_UPDATE,
320
357
  {
321
- activeContentSharingId: whoSharing,
322
- endedContentSharingId: whoStopped
358
+ activeSharingId: whoSharing,
359
+ endedSharingId: whoStopped
323
360
  }
324
361
  );
325
362
  }
@@ -524,6 +561,36 @@ export default class Members extends StatelessWebexPlugin {
524
561
  }
525
562
  }
526
563
 
564
+ /**
565
+ * Update the media share whiteboard id
566
+ * @param {Object} locus
567
+ * @param {String} [whiteboardId] optional, takes precedence
568
+ * @throws {Error}
569
+ * @returns {undefined}
570
+ * @memberof Members
571
+ */
572
+ setMediaShareWhiteboardId(locus, whiteboardId) {
573
+ if (whiteboardId) {
574
+ this.mediaShareWhiteboardId = whiteboardId;
575
+ }
576
+ else if (locus) {
577
+ const whiteboardMediaShare =
578
+ locus.mediaShares &&
579
+ locus.mediaShares.length &&
580
+ locus.mediaShares.find((mediaShare) => mediaShare.name === WHITEBOARD);
581
+
582
+ this.mediaShareWhiteboardId =
583
+ (whiteboardMediaShare &&
584
+ whiteboardMediaShare.floor &&
585
+ whiteboardMediaShare.floor.beneficiary &&
586
+ whiteboardMediaShare.floor.beneficiary.id) ||
587
+ null;
588
+ }
589
+ else {
590
+ throw new ParameterError('Setting hostid for the Members module should be done with a locus object or hostId');
591
+ }
592
+ }
593
+
527
594
  /**
528
595
  * Find all the updates, and added members
529
596
  * Removed/left members will end up in updates
@@ -552,6 +619,7 @@ export default class Members extends StatelessWebexPlugin {
552
619
  selfId: this.selfId,
553
620
  hostId: this.hostId,
554
621
  contentSharingId: this.mediaShareContentId,
622
+ whiteboardSharingId: this.mediaShareWhiteboardId,
555
623
  type: this.type
556
624
  })
557
625
  );
@@ -563,6 +631,7 @@ export default class Members extends StatelessWebexPlugin {
563
631
  selfId: this.selfId,
564
632
  hostId: this.hostId,
565
633
  contentSharingId: this.mediaShareContentId,
634
+ whiteboardSharingId: this.mediaShareWhiteboardId,
566
635
  type: this.type
567
636
  })
568
637
  );
@@ -126,6 +126,12 @@ export const eventType = {
126
126
  // Fired when the client changes its local UI/layout to a content sharing view,
127
127
  // because it is expecting to display share media.
128
128
  SHARE_LAYOUT_DISPLAYED: 'client.share.layout.displayed',
129
+ // Fired when the user of the client starts a whiteboard share (e.g. click 'Share Live' button).
130
+ WHITEBOARD_SHARE_INITIATED: 'client.whiteboard.share.initiated',
131
+ // Fired when the meeting floor is released for whiteboard share
132
+ WHITEBOARD_SHARE_STOPPED: 'client.whiteboard.share.stopped',
133
+ // When the client receives a successful response from locus indicating that it has the floor for whiteboard sharing.
134
+ WHITEBOARD_SHARE_FLOOR_GRANTED: 'client.whiteboard.share.floor-granted',
129
135
  MUTED: 'client.muted',
130
136
  UNMUTED: 'client.unmuted',
131
137
  LEAVE: 'client.call.leave',
@@ -13,7 +13,7 @@ const webexTestUsers = require('../../utils/webex-test-users');
13
13
 
14
14
  const {isBrowser} = BrowserDetection();
15
15
 
16
- let userSet, alice, bob, chris, enumerateSpy;
16
+ let userSet, alice, bob, chris, enumerateSpy, channelUrlA, channelUrlB;
17
17
 
18
18
  skipInNode(describe)('plugin-meetings', () => {
19
19
  describe('journey', () => {
@@ -32,6 +32,8 @@ skipInNode(describe)('plugin-meetings', () => {
32
32
  alice.webex.meetings.name = 'alice';
33
33
  bob.webex.meetings.name = 'bob';
34
34
  chris.webex.meetings.name = 'chris';
35
+ channelUrlA = 'https://board-a.wbx2.com/board/api/v1/channels/49cfb550-5517-11eb-a2af-1b9e4bc3da13';
36
+ channelUrlB = 'https://board-a.wbx2.com/board/api/v1/channels/977a7330-54f4-11eb-b1ef-91f5eefc7bf3';
35
37
  })
36
38
  .then(() => Promise.all([testUtils.syncAndEndMeeting(alice),
37
39
  testUtils.syncAndEndMeeting(bob)]))
@@ -550,6 +552,143 @@ skipInNode(describe)('plugin-meetings', () => {
550
552
  assert.equal(alice.meeting.shareStatus, 'no_share');
551
553
  }));
552
554
 
555
+ it('alice shares whiteboard A', () => Promise.all([
556
+ testUtils.delayedPromise(alice.meeting.startWhiteboardShare(channelUrlA)),
557
+ testUtils.waitForEvents([
558
+ {scope: alice.meeting, event: 'meeting:startedSharingWhiteboard'}
559
+ ]),
560
+ testUtils.waitForEvents([{scope: bob.meeting, event: 'meeting:startedSharingWhiteboard'}])
561
+ .then((response) => {
562
+ const {memberId, resourceUrl} = response[0].result;
563
+
564
+ assert.equal(memberId, alice.meeting.selfId);
565
+ assert.equal(resourceUrl, channelUrlA);
566
+ }),
567
+ testUtils.waitForEvents([{scope: bob.meeting.members, event: 'members:update'}])
568
+ .then((response) => {
569
+ console.log('WHITEBOARD SHARE RESPONSE ', JSON.stringify(response));
570
+ })
571
+ ])
572
+ .then(() => {
573
+ assert.equal(alice.meeting.isSharing, false);
574
+ assert.equal(alice.meeting.shareStatus, 'whiteboard_share_active');
575
+ assert.equal(bob.meeting.shareStatus, 'whiteboard_share_active');
576
+ }));
577
+
578
+ it('bob steals share from alice with whiteboard B', () => Promise.all([
579
+ testUtils.delayedPromise(bob.meeting.startWhiteboardShare(channelUrlB)),
580
+ testUtils.waitForEvents([
581
+ {scope: bob.meeting, event: 'meeting:startedSharingWhiteboard'}
582
+ ]),
583
+ testUtils.waitForEvents([{scope: alice.meeting, event: 'meeting:startedSharingWhiteboard'}])
584
+ .then((response) => {
585
+ const {memberId, resourceUrl} = response[0].result;
586
+
587
+ assert.equal(memberId, bob.meeting.selfId);
588
+ assert.equal(resourceUrl, channelUrlB);
589
+ }),
590
+ testUtils.waitForEvents([{scope: alice.meeting.members, event: 'members:update'}])
591
+ .then((response) => {
592
+ console.log('WHITEBOARD SHARE RESPONSE ', JSON.stringify(response));
593
+ })
594
+ ])
595
+ .then(() => {
596
+ assert.equal(bob.meeting.isSharing, false);
597
+ assert.equal(alice.meeting.shareStatus, 'whiteboard_share_active');
598
+ assert.equal(bob.meeting.shareStatus, 'whiteboard_share_active');
599
+ }));
600
+
601
+ it('bob stops sharing ', () => Promise.all([
602
+ // Wait for peerConnection to stabalize
603
+ testUtils.waitUntil(20000),
604
+ testUtils.delayedPromise(bob.meeting.stopWhiteboardShare(channelUrlB)),
605
+ testUtils.waitForEvents([{scope: bob.meeting, event: 'meeting:stoppedSharingWhiteboard'}]),
606
+ testUtils.waitForEvents([{scope: alice.meeting, event: 'meeting:stoppedSharingWhiteboard'}])
607
+ ])
608
+ .then(() => {
609
+ assert.equal(bob.meeting.isSharing, false);
610
+ assert.equal(bob.meeting.shareStatus, 'no_share');
611
+ assert.equal(alice.meeting.shareStatus, 'no_share');
612
+ }));
613
+
614
+ it('alice shares whiteboard B', () => Promise.all([
615
+ testUtils.delayedPromise(alice.meeting.startWhiteboardShare(channelUrlB)),
616
+ testUtils.waitForEvents([
617
+ {scope: alice.meeting, event: 'meeting:startedSharingWhiteboard'}
618
+ ]),
619
+ testUtils.waitForEvents([{scope: bob.meeting, event: 'meeting:startedSharingWhiteboard'}])
620
+ .then((response) => {
621
+ const {memberId, resourceUrl} = response[0].result;
622
+
623
+ assert.equal(memberId, alice.meeting.selfId);
624
+ assert.equal(resourceUrl, channelUrlB);
625
+ }),
626
+ testUtils.waitForEvents([{scope: bob.meeting.members, event: 'members:update'}])
627
+ .then((response) => {
628
+ console.log('WHITEBOARD SHARE RESPONSE ', JSON.stringify(response));
629
+ })
630
+ ])
631
+ .then(() => {
632
+ assert.equal(alice.meeting.isSharing, false);
633
+ assert.equal(alice.meeting.shareStatus, 'whiteboard_share_active');
634
+ assert.equal(bob.meeting.shareStatus, 'whiteboard_share_active');
635
+ }));
636
+
637
+ it('bob steals the share from alice with desktop share', () => Promise.all([
638
+ testUtils.delayedPromise(bob.meeting.shareScreen()),
639
+ testUtils.waitForEvents([{scope: alice.meeting, event: 'meeting:stoppedSharingWhiteboard'}]),
640
+ testUtils.waitForEvents([{scope: bob.meeting, event: 'meeting:startedSharingLocal'}]),
641
+ testUtils.waitForEvents([{scope: alice.meeting, event: 'meeting:startedSharingRemote'}])
642
+ .then((response) => {
643
+ assert.equal(response[0].result.memberId, bob.meeting.selfId);
644
+ }),
645
+ testUtils.waitForEvents([{scope: alice.meeting.members, event: 'members:update'}])
646
+ .then((response) => {
647
+ console.log('SCREEN SHARE RESPONSE ', JSON.stringify(response));
648
+ }),
649
+ testUtils.waitForEvents([{scope: bob.meeting, event: 'media:ready'}])
650
+ .then((response) => {
651
+ console.log('MEDIA:READY event ', response[0].result);
652
+ assert.equal(response[0].result.type === 'localShare', true);
653
+ })
654
+ ])
655
+ .then(() => {
656
+ const heightResolution = DEFAULT_RESOLUTIONS.meetings.screenResolution.idealHeight;
657
+
658
+ // TODO: Re-eanable Safari when screensharing issues have been resolved
659
+ if (!isBrowser('safari')) {
660
+ assert.equal(bob.meeting.mediaProperties.shareTrack.getConstraints().height, heightResolution);
661
+ }
662
+ assert.equal(bob.meeting.isSharing, true);
663
+ assert.equal(bob.meeting.shareStatus, 'local_share_active');
664
+ assert.equal(alice.meeting.shareStatus, 'remote_share_active');
665
+
666
+ return testUtils.waitUntil(10000);
667
+ }));
668
+
669
+ it('bob shares whiteboard B', () => Promise.all([
670
+ testUtils.delayedPromise(bob.meeting.startWhiteboardShare(channelUrlB)),
671
+ testUtils.waitForEvents([
672
+ {scope: bob.meeting, event: 'meeting:startedSharingWhiteboard'}
673
+ ]),
674
+ testUtils.waitForEvents([{scope: alice.meeting, event: 'meeting:startedSharingWhiteboard'}])
675
+ .then((response) => {
676
+ const {memberId, resourceUrl} = response[0].result;
677
+
678
+ assert.equal(memberId, bob.meeting.selfId);
679
+ assert.equal(resourceUrl, channelUrlB);
680
+ }),
681
+ testUtils.waitForEvents([{scope: alice.meeting.members, event: 'members:update'}])
682
+ .then((response) => {
683
+ console.log('WHITEBOARD SHARE RESPONSE ', JSON.stringify(response));
684
+ })
685
+ ])
686
+ .then(() => {
687
+ assert.equal(bob.meeting.isSharing, false);
688
+ assert.equal(alice.meeting.shareStatus, 'whiteboard_share_active');
689
+ assert.equal(bob.meeting.shareStatus, 'whiteboard_share_active');
690
+ }));
691
+
553
692
  it('alice adds chris as guest to 1:1 meeting', () => Promise.all([
554
693
  testUtils.delayedPromise(alice.meeting.invite({emailAddress: chris.emailAddress})),
555
694
  testUtils.waitForEvents([{scope: chris.webex.meetings, event: 'meeting:added', user: chris}]),