@webex/plugin-meetings 3.0.0-beta.143 → 3.0.0-beta.145

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.
@@ -59,6 +59,7 @@ import CaptchaError from '../common/errors/captcha-error';
59
59
  import MeetingCollection from './collection';
60
60
  import MeetingsUtil from './util';
61
61
  import PermissionError from '../common/errors/permission';
62
+ import {INoiseReductionEffect, IVirtualBackgroundEffect} from './meetings.types';
62
63
 
63
64
  let mediaLogger;
64
65
 
@@ -807,6 +808,36 @@ export default class Meetings extends WebexPlugin {
807
808
  );
808
809
  }
809
810
 
811
+ /**
812
+ * Creates a noise reduction effect
813
+ *
814
+ * @param {INoiseReductionEffect} options optional custom effect options
815
+ * @returns {Promise<effect>} noise reduction effect.
816
+ * @public
817
+ * @memberof Meetings
818
+ */
819
+ createNoiseReductionEffect = async (options?: INoiseReductionEffect) => {
820
+ // @ts-ignore
821
+ const authToken = this.webex.credentials.supertoken.access_token;
822
+
823
+ return new mediaHelpersModule.NoiseReductionEffect({authToken, ...options});
824
+ };
825
+
826
+ /**
827
+ * Creates a virtual background effect
828
+ *
829
+ * @param {IVirtualBackgroundEffect} options optional custom effect options
830
+ * @returns {Promise<effect>} virtual background effect.
831
+ * @public
832
+ * @memberof Meetings
833
+ */
834
+ createVirtualBackgroundEffect = async (options?: IVirtualBackgroundEffect) => {
835
+ // @ts-ignore
836
+ const authToken = this.webex.credentials.supertoken.access_token;
837
+
838
+ return new mediaHelpersModule.VirtualBackgroundEffect({authToken, ...options});
839
+ };
840
+
810
841
  /**
811
842
  * Uploads logs to the webex services for tracking
812
843
  * @param {Object} [options={}]
@@ -0,0 +1,9 @@
1
+ import type {
2
+ NoiseReductionEffectOptions,
3
+ VirtualBackgroundEffectOptions,
4
+ } from '@webex/media-helpers';
5
+
6
+ type INoiseReductionEffect = Omit<NoiseReductionEffectOptions, 'authToken'>;
7
+ type IVirtualBackgroundEffect = Omit<VirtualBackgroundEffectOptions, 'authToken'>;
8
+
9
+ export type {INoiseReductionEffect, IVirtualBackgroundEffect};
@@ -38,6 +38,7 @@ describe('plugin-meetings', () => {
38
38
  waitingForOthersToJoin: null,
39
39
  canSendReactions: null,
40
40
  canManageBreakout: null,
41
+ canBroadcastMessageToBreakout: null,
41
42
  canAdmitLobbyToBreakout: null,
42
43
  canUserAskForHelp: null,
43
44
  canUserRenameSelfAndObserved: null,
@@ -108,6 +109,7 @@ describe('plugin-meetings', () => {
108
109
  'waitingForOthersToJoin',
109
110
  'canSendReactions',
110
111
  'canManageBreakout',
112
+ 'canBroadcastMessageToBreakout',
111
113
  'canAdmitLobbyToBreakout',
112
114
  'canUserAskForHelp',
113
115
  'canUserRenameSelfAndObserved',
@@ -590,6 +590,13 @@ describe('plugin-meetings', () => {
590
590
  });
591
591
  });
592
592
 
593
+ describe('canBroadcastMessageToBreakout', () => {
594
+ it('works as expected', () => {
595
+ assert.deepEqual(MeetingUtil.canBroadcastMessageToBreakout(['BROADCAST_MESSAGE_TO_BREAKOUT']), true);
596
+ assert.deepEqual(MeetingUtil.canBroadcastMessageToBreakout([]), false);
597
+ });
598
+ });
599
+
593
600
  describe('isSuppressBreakoutSupport', () => {
594
601
  it('works as expected', () => {
595
602
  assert.deepEqual(
@@ -34,6 +34,7 @@ import CaptchaError from '@webex/plugin-meetings/src/common/errors/captcha-error
34
34
  import { forEach } from 'lodash';
35
35
  import PasswordError from '@webex/plugin-meetings/src/common/errors/password-error';
36
36
  import PermissionError from '@webex/plugin-meetings/src/common/errors/permission';
37
+ import {NoiseReductionEffect,VirtualBackgroundEffect} from '@webex/media-helpers';
37
38
 
38
39
  describe('plugin-meetings', () => {
39
40
  const logger = {
@@ -352,6 +353,102 @@ describe('plugin-meetings', () => {
352
353
  });
353
354
  });
354
355
 
356
+ describe('virtual background effect', () => {
357
+ beforeEach(() => {
358
+ webex.credentials = {
359
+ supertoken: {
360
+ access_token: "fake_token"
361
+ }
362
+ };
363
+ })
364
+
365
+ it('creates background effect', async () => {
366
+ const result = await webex.meetings.createVirtualBackgroundEffect();
367
+
368
+ assert.exists(result);
369
+ assert.instanceOf(result, VirtualBackgroundEffect);
370
+ assert.containsAllKeys(result, ['loadModel', 'isEnabled', 'isLoaded', 'options']);
371
+ assert.deepEqual(result.options, {
372
+ mode: 'BLUR',
373
+ blurStrength: 'STRONG',
374
+ generator: 'worker',
375
+ quality: 'LOW',
376
+ authToken: 'fake_token',
377
+ mirror: false
378
+ });
379
+ assert.exists(result.enable);
380
+ assert.exists(result.disable);
381
+ assert.exists(result.dispose);
382
+ });
383
+
384
+ it('creates background effect with custom options passed', async () => {
385
+ const effectOptions = {
386
+ generator: "local",
387
+ frameRate: 45,
388
+ mode: "IMAGE",
389
+ mirror: false,
390
+ quality: "HIGH",
391
+ blurStrength: "STRONG",
392
+ bgImageUrl: "https://test.webex.com/landscape.5a535788.jpg",
393
+ };
394
+
395
+ const result = await webex.meetings.createVirtualBackgroundEffect(effectOptions);
396
+
397
+ assert.exists(result);
398
+ assert.instanceOf(result, VirtualBackgroundEffect);
399
+ assert.containsAllKeys(result, ['loadModel', 'isEnabled', 'isLoaded', 'options']);
400
+ assert.deepEqual(result.options, {...effectOptions, authToken: "fake_token"});
401
+ assert.exists(result.enable);
402
+ assert.exists(result.disable);
403
+ assert.exists(result.dispose);
404
+ });
405
+ })
406
+
407
+ describe('noise reduction effect', () => {
408
+ beforeEach(() => {
409
+ webex.credentials = {
410
+ supertoken: {
411
+ access_token: "fake_token"
412
+ }
413
+ };
414
+ })
415
+
416
+ it('creates noise reduction effect', async () => {
417
+ const result = await webex.meetings.createNoiseReductionEffect({audioContext: {}});
418
+
419
+ assert.exists(result);
420
+ assert.instanceOf(result, NoiseReductionEffect);
421
+ assert.containsAllKeys(result, ['audioContext', 'isEnabled', 'isReady', 'options']);
422
+ assert.deepEqual(result.options, {
423
+ authToken: 'fake_token',
424
+ audioContext: {}
425
+ });
426
+ assert.exists(result.enable);
427
+ assert.exists(result.disable);
428
+ assert.exists(result.dispose);
429
+ });
430
+
431
+ it('creates noise reduction effect with custom options passed', async () => {
432
+ const effectOptions = {
433
+ audioContext: {},
434
+ workletProcessorUrl: "test.url.com",
435
+ mode: "WORKLET",
436
+ env: "prod",
437
+ avoidSimd: false
438
+ };
439
+
440
+ const result = await webex.meetings.createNoiseReductionEffect(effectOptions);
441
+
442
+ assert.exists(result);
443
+ assert.instanceOf(result, NoiseReductionEffect);
444
+ assert.containsAllKeys(result, ['audioContext', 'isEnabled', 'isReady', 'options']);
445
+ assert.deepEqual(result.options, {...effectOptions, authToken: "fake_token"});
446
+ assert.exists(result.enable);
447
+ assert.exists(result.disable);
448
+ assert.exists(result.dispose);
449
+ });
450
+ })
451
+
355
452
  describe('gets', () => {
356
453
  describe('#getReachability', () => {
357
454
  it('should have #getReachability', () => {