@webex/plugin-meetings 1.149.0 → 1.150.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -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)]))
@@ -162,6 +164,41 @@ skipInNode(describe)('plugin-meetings', () => {
162
164
  }));
163
165
  });
164
166
 
167
+ // Enabled when config.enableUnifiedMeetings = true
168
+ xdescribe('Conversation URL', () => {
169
+ describe('Successful 1:1 meeting', () => {
170
+ it('Fetch meeting information with a conversation URL for a 1:1 space', async () => {
171
+ assert.equal(Object.keys(bob.webex.meetings.getAllMeetings()), 0);
172
+ assert.equal(Object.keys(chris.webex.meetings.getAllMeetings()), 0);
173
+
174
+ const conversation = await chris.webex.internal.conversation.create({participants: [bob]});
175
+
176
+ await chris.webex.internal.conversation.post(conversation, {displayName: 'hello world how are you '});
177
+
178
+ await Promise.all([
179
+ testUtils.delayedPromise(chris.webex.meetings.create(conversation.url, 'CONVERSATION_URL')),
180
+ testUtils.waitForEvents([{scope: chris.webex.meetings, event: 'meeting:added', user: chris}])
181
+ ])
182
+ .then(function chrisJoinsMeeting() {
183
+ return Promise.all([
184
+ testUtils.delayedPromise(chris.meeting.join()),
185
+ testUtils.waitForEvents([{scope: bob.webex.meetings, event: 'meeting:added', user: bob},
186
+ {scope: chris.meeting, event: 'meeting:stateChange', user: chris}])
187
+ .then((response) => {
188
+ assert.equal(response[0].result.payload.currentState, 'ACTIVE');
189
+ })
190
+ ]);
191
+ });
192
+ });
193
+
194
+ it('Fetch meeting information with invalid conversation URL and throws error', () => {
195
+ chris.webex.meetings.meetingInfo.fetchMeetingInfo('http://some-invalid.com', 'CONVERSATION_URL').then((response) => {
196
+ assert(response.result === '404');
197
+ });
198
+ });
199
+ });
200
+ });
201
+
165
202
  describe('Successful 1:1 meeting (including Guest)', function () {
166
203
  before(() => {
167
204
  // Workaround since getDisplayMedia requires a user gesture to be activated, and this is a integration tests
@@ -482,10 +519,7 @@ skipInNode(describe)('plugin-meetings', () => {
482
519
  .then((response) => {
483
520
  assert.equal(response[0].result.memberId, alice.meeting.selfId);
484
521
  }),
485
- testUtils.waitForEvents([{scope: bob.meeting.members, event: 'members:update'}])
486
- .then((response) => {
487
- console.log('SCREEN SHARE RESPONSE ', JSON.stringify(response));
488
- }),
522
+ testUtils.waitForEvents([{scope: bob.meeting.members, event: 'members:update'}]),
489
523
  testUtils.waitForEvents([{scope: alice.meeting, event: 'media:ready'}])
490
524
  .then((response) => {
491
525
  console.log('MEDIA:READY event ', response[0].result);
@@ -553,6 +587,143 @@ skipInNode(describe)('plugin-meetings', () => {
553
587
  assert.equal(alice.meeting.shareStatus, 'no_share');
554
588
  }));
555
589
 
590
+ it('alice shares whiteboard A', () => Promise.all([
591
+ testUtils.delayedPromise(alice.meeting.startWhiteboardShare(channelUrlA)),
592
+ testUtils.waitForEvents([
593
+ {scope: alice.meeting, event: 'meeting:startedSharingWhiteboard'}
594
+ ]),
595
+ testUtils.waitForEvents([{scope: bob.meeting, event: 'meeting:startedSharingWhiteboard'}])
596
+ .then((response) => {
597
+ const {memberId, resourceUrl} = response[0].result;
598
+
599
+ assert.equal(memberId, alice.meeting.selfId);
600
+ assert.equal(resourceUrl, channelUrlA);
601
+ }),
602
+ testUtils.waitForEvents([{scope: bob.meeting.members, event: 'members:update'}])
603
+ .then((response) => {
604
+ console.log('WHITEBOARD SHARE RESPONSE ', JSON.stringify(response));
605
+ })
606
+ ])
607
+ .then(() => {
608
+ assert.equal(alice.meeting.isSharing, false);
609
+ assert.equal(alice.meeting.shareStatus, 'whiteboard_share_active');
610
+ assert.equal(bob.meeting.shareStatus, 'whiteboard_share_active');
611
+ }));
612
+
613
+ it('bob steals share from alice with whiteboard B', () => Promise.all([
614
+ testUtils.delayedPromise(bob.meeting.startWhiteboardShare(channelUrlB)),
615
+ testUtils.waitForEvents([
616
+ {scope: bob.meeting, event: 'meeting:startedSharingWhiteboard'}
617
+ ]),
618
+ testUtils.waitForEvents([{scope: alice.meeting, event: 'meeting:startedSharingWhiteboard'}])
619
+ .then((response) => {
620
+ const {memberId, resourceUrl} = response[0].result;
621
+
622
+ assert.equal(memberId, bob.meeting.selfId);
623
+ assert.equal(resourceUrl, channelUrlB);
624
+ }),
625
+ testUtils.waitForEvents([{scope: alice.meeting.members, event: 'members:update'}])
626
+ .then((response) => {
627
+ console.log('WHITEBOARD SHARE RESPONSE ', JSON.stringify(response));
628
+ })
629
+ ])
630
+ .then(() => {
631
+ assert.equal(bob.meeting.isSharing, false);
632
+ assert.equal(alice.meeting.shareStatus, 'whiteboard_share_active');
633
+ assert.equal(bob.meeting.shareStatus, 'whiteboard_share_active');
634
+ }));
635
+
636
+ it('bob stops sharing ', () => Promise.all([
637
+ // Wait for peerConnection to stabalize
638
+ testUtils.waitUntil(20000),
639
+ testUtils.delayedPromise(bob.meeting.stopWhiteboardShare(channelUrlB)),
640
+ testUtils.waitForEvents([{scope: bob.meeting, event: 'meeting:stoppedSharingWhiteboard'}]),
641
+ testUtils.waitForEvents([{scope: alice.meeting, event: 'meeting:stoppedSharingWhiteboard'}])
642
+ ])
643
+ .then(() => {
644
+ assert.equal(bob.meeting.isSharing, false);
645
+ assert.equal(bob.meeting.shareStatus, 'no_share');
646
+ assert.equal(alice.meeting.shareStatus, 'no_share');
647
+ }));
648
+
649
+ it('alice shares whiteboard B', () => Promise.all([
650
+ testUtils.delayedPromise(alice.meeting.startWhiteboardShare(channelUrlB)),
651
+ testUtils.waitForEvents([
652
+ {scope: alice.meeting, event: 'meeting:startedSharingWhiteboard'}
653
+ ]),
654
+ testUtils.waitForEvents([{scope: bob.meeting, event: 'meeting:startedSharingWhiteboard'}])
655
+ .then((response) => {
656
+ const {memberId, resourceUrl} = response[0].result;
657
+
658
+ assert.equal(memberId, alice.meeting.selfId);
659
+ assert.equal(resourceUrl, channelUrlB);
660
+ }),
661
+ testUtils.waitForEvents([{scope: bob.meeting.members, event: 'members:update'}])
662
+ .then((response) => {
663
+ console.log('WHITEBOARD SHARE RESPONSE ', JSON.stringify(response));
664
+ })
665
+ ])
666
+ .then(() => {
667
+ assert.equal(alice.meeting.isSharing, false);
668
+ assert.equal(alice.meeting.shareStatus, 'whiteboard_share_active');
669
+ assert.equal(bob.meeting.shareStatus, 'whiteboard_share_active');
670
+ }));
671
+
672
+ it('bob steals the share from alice with desktop share', () => Promise.all([
673
+ testUtils.delayedPromise(bob.meeting.shareScreen()),
674
+ testUtils.waitForEvents([{scope: alice.meeting, event: 'meeting:stoppedSharingWhiteboard'}]),
675
+ testUtils.waitForEvents([{scope: bob.meeting, event: 'meeting:startedSharingLocal'}]),
676
+ testUtils.waitForEvents([{scope: alice.meeting, event: 'meeting:startedSharingRemote'}])
677
+ .then((response) => {
678
+ assert.equal(response[0].result.memberId, bob.meeting.selfId);
679
+ }),
680
+ testUtils.waitForEvents([{scope: alice.meeting.members, event: 'members:update'}])
681
+ .then((response) => {
682
+ console.log('SCREEN SHARE RESPONSE ', JSON.stringify(response));
683
+ }),
684
+ testUtils.waitForEvents([{scope: bob.meeting, event: 'media:ready'}])
685
+ .then((response) => {
686
+ console.log('MEDIA:READY event ', response[0].result);
687
+ assert.equal(response[0].result.type === 'localShare', true);
688
+ })
689
+ ])
690
+ .then(() => {
691
+ const heightResolution = DEFAULT_RESOLUTIONS.meetings.screenResolution.idealHeight;
692
+
693
+ // TODO: Re-eanable Safari when screensharing issues have been resolved
694
+ if (!isBrowser('safari')) {
695
+ assert.equal(bob.meeting.mediaProperties.shareTrack.getConstraints().height, heightResolution);
696
+ }
697
+ assert.equal(bob.meeting.isSharing, true);
698
+ assert.equal(bob.meeting.shareStatus, 'local_share_active');
699
+ assert.equal(alice.meeting.shareStatus, 'remote_share_active');
700
+
701
+ return testUtils.waitUntil(10000);
702
+ }));
703
+
704
+ it('bob shares whiteboard B', () => Promise.all([
705
+ testUtils.delayedPromise(bob.meeting.startWhiteboardShare(channelUrlB)),
706
+ testUtils.waitForEvents([
707
+ {scope: bob.meeting, event: 'meeting:startedSharingWhiteboard'}
708
+ ]),
709
+ testUtils.waitForEvents([{scope: alice.meeting, event: 'meeting:startedSharingWhiteboard'}])
710
+ .then((response) => {
711
+ const {memberId, resourceUrl} = response[0].result;
712
+
713
+ assert.equal(memberId, bob.meeting.selfId);
714
+ assert.equal(resourceUrl, channelUrlB);
715
+ }),
716
+ testUtils.waitForEvents([{scope: alice.meeting.members, event: 'members:update'}])
717
+ .then((response) => {
718
+ console.log('WHITEBOARD SHARE RESPONSE ', JSON.stringify(response));
719
+ })
720
+ ])
721
+ .then(() => {
722
+ assert.equal(bob.meeting.isSharing, false);
723
+ assert.equal(alice.meeting.shareStatus, 'whiteboard_share_active');
724
+ assert.equal(bob.meeting.shareStatus, 'whiteboard_share_active');
725
+ }));
726
+
556
727
  it('alice adds chris as guest to 1:1 meeting', () => Promise.all([
557
728
  testUtils.delayedPromise(alice.meeting.invite({emailAddress: chris.emailAddress})),
558
729
  testUtils.waitForEvents([{scope: chris.webex.meetings, event: 'meeting:added', user: chris}]),
@@ -1,6 +1,8 @@
1
1
 
2
2
  import {assert} from '@webex/test-helper-chai';
3
3
  import {skipInNode, jenkinsOnly} from '@webex/test-helper-mocha';
4
+ import {patterns} from '@webex/common';
5
+ import MeetingInfoUtil from '@webex/plugin-meetings/src/meeting-info/utilv2';
4
6
 
5
7
  import CMR from '../../utils/cmr';
6
8
  import testUtils from '../../utils/testUtils';
@@ -44,6 +46,15 @@ skipInNode(describe)('plugin-meetings', () => {
44
46
  console.log('CONVERSATION', conversation);
45
47
  space = conversation;
46
48
  })
49
+ .then(async () => {
50
+ const destinationWithType = await alice.webex.meetings.meetingInfo.fetchMeetingInfo(space.url, 'CONVERSATION_URL');
51
+ const destinationNoType = await alice.webex.meetings.meetingInfo.fetchMeetingInfo(space.url);
52
+
53
+ assert.exists(destinationNoType);
54
+ assert.exists(destinationWithType);
55
+ assert.exists(destinationNoType.body.meetingNumber);
56
+ assert.exists(destinationWithType.body.meetingNumber);
57
+ })
47
58
  .then(function aliceStartsMeeting() {
48
59
  return Promise.all([
49
60
  testUtils.delayedPromise(alice.webex.meetings.create(space.url)),
@@ -57,17 +68,34 @@ skipInNode(describe)('plugin-meetings', () => {
57
68
  {scope: chris.webex.meetings, event: 'meeting:added', user: chris}])
58
69
  ])));
59
70
 
71
+ xit('Should fetch user info using user hydra id with the new api', () => alice.webex.rooms.create({title: 'sample'})
72
+ .then((room) => MeetingInfoUtil.getDestinationType({
73
+ destination: room.creatorId,
74
+ webex: alice.webex
75
+ }))
76
+ .then((destinationType) => MeetingInfoUtil.getRequestBody(destinationType))
77
+ .then((res) => {
78
+ assert.exists(res.sipUrl, 'sipURL didnt exist');
79
+ assert.match(res.sipUrl, patterns.email); // assert sipURL is email
80
+ }));
81
+
60
82
  // Enable this test when we are going to enable the unified space meeeting .
61
83
  // We cannot change the config on load as the meetingInfo function loads dynamically
62
- xit('Should fetch meeting Info using the new api', async () => {
63
- alice.webex.meetings.config.experimental.enableUnifiedMeetings = true;
84
+ xit('Should fetch meeting info using space url with the new api', async () => {
64
85
  const res = await alice.webex.meetings.meetingInfo.fetchMeetingInfo(space.url, 'CONVERSATION_URL');
65
86
 
66
- assert.exists(res.meetingNumber);
87
+ assert.exists(res.body.meetingNumber);
88
+ });
89
+
90
+ xit('Bob fetches meeting info with SIP URI before joining', async () => {
91
+ const {sipUri} = alice.meeting;
92
+ const res = await bob.webex.meetings.meetingInfo.fetchMeetingInfo(sipUri, 'SIP_URI');
93
+ const {meetingNumber} = res.body;
67
94
 
68
- alice.webex.meetings.config.experimental.enableUnifiedMeetings = false;
95
+ assert(meetingNumber === alice.meeting.meetingNumber, 'meetingNumber matches alice meeting number');
69
96
  });
70
97
 
98
+
71
99
  it('Bob and chris joins space meeting', () => testUtils.waitForStateChange(alice.meeting, 'JOINED')
72
100
  .then(() => testUtils.waitForStateChange(bob.meeting, 'IDLE'))
73
101
  .then(() => testUtils.waitForStateChange(chris.meeting, 'IDLE'))
@@ -97,7 +125,7 @@ skipInNode(describe)('plugin-meetings', () => {
97
125
 
98
126
 
99
127
  it('alice adds x user as guest to space meeting', () => Promise.all([
100
- testUtils.delayedPromise(guest.webex.meetings.create(alice.meeting.meetingInfo.uri)),
128
+ testUtils.delayedPromise(guest.webex.meetings.create(alice.meeting.sipUri)),
101
129
  testUtils.waitForEvents([{scope: guest.webex.meetings, event: 'meeting:added', user: guest}])
102
130
  ]).then(() =>
103
131
  Promise.all([