@webex/plugin-meetings 3.8.1-web-workers-keepalive.1 → 3.9.0-next.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.
Files changed (87) hide show
  1. package/dist/breakouts/breakout.js +1 -1
  2. package/dist/breakouts/index.js +1 -1
  3. package/dist/constants.js +24 -2
  4. package/dist/constants.js.map +1 -1
  5. package/dist/interpretation/index.js +1 -1
  6. package/dist/interpretation/siLanguage.js +1 -1
  7. package/dist/locus-info/index.js +39 -85
  8. package/dist/locus-info/index.js.map +1 -1
  9. package/dist/meeting/brbState.js +14 -12
  10. package/dist/meeting/brbState.js.map +1 -1
  11. package/dist/meeting/in-meeting-actions.js +6 -0
  12. package/dist/meeting/in-meeting-actions.js.map +1 -1
  13. package/dist/meeting/index.js +274 -140
  14. package/dist/meeting/index.js.map +1 -1
  15. package/dist/meeting/request.js +19 -0
  16. package/dist/meeting/request.js.map +1 -1
  17. package/dist/meeting/request.type.js.map +1 -1
  18. package/dist/meeting/type.js +7 -0
  19. package/dist/meeting/type.js.map +1 -0
  20. package/dist/meeting/util.js +68 -2
  21. package/dist/meeting/util.js.map +1 -1
  22. package/dist/meetings/index.js +35 -33
  23. package/dist/meetings/index.js.map +1 -1
  24. package/dist/member/index.js.map +1 -1
  25. package/dist/members/index.js +11 -9
  26. package/dist/members/index.js.map +1 -1
  27. package/dist/members/request.js +3 -3
  28. package/dist/members/request.js.map +1 -1
  29. package/dist/members/util.js +18 -6
  30. package/dist/members/util.js.map +1 -1
  31. package/dist/multistream/mediaRequestManager.js +1 -1
  32. package/dist/multistream/mediaRequestManager.js.map +1 -1
  33. package/dist/multistream/remoteMedia.js +34 -5
  34. package/dist/multistream/remoteMedia.js.map +1 -1
  35. package/dist/multistream/remoteMediaGroup.js +42 -2
  36. package/dist/multistream/remoteMediaGroup.js.map +1 -1
  37. package/dist/multistream/sendSlotManager.js +32 -2
  38. package/dist/multistream/sendSlotManager.js.map +1 -1
  39. package/dist/types/constants.d.ts +22 -0
  40. package/dist/types/locus-info/index.d.ts +0 -9
  41. package/dist/types/meeting/brbState.d.ts +0 -1
  42. package/dist/types/meeting/in-meeting-actions.d.ts +6 -0
  43. package/dist/types/meeting/index.d.ts +40 -19
  44. package/dist/types/meeting/request.d.ts +9 -1
  45. package/dist/types/meeting/request.type.d.ts +74 -0
  46. package/dist/types/meeting/type.d.ts +9 -0
  47. package/dist/types/meeting/util.d.ts +3 -0
  48. package/dist/types/members/index.d.ts +10 -7
  49. package/dist/types/members/request.d.ts +1 -1
  50. package/dist/types/members/util.d.ts +7 -3
  51. package/dist/types/multistream/remoteMedia.d.ts +20 -1
  52. package/dist/types/multistream/remoteMediaGroup.d.ts +11 -0
  53. package/dist/types/multistream/sendSlotManager.d.ts +16 -0
  54. package/dist/webinar/index.js +1 -1
  55. package/package.json +22 -23
  56. package/src/constants.ts +23 -2
  57. package/src/locus-info/index.ts +48 -86
  58. package/src/meeting/brbState.ts +9 -7
  59. package/src/meeting/in-meeting-actions.ts +13 -0
  60. package/src/meeting/index.ts +165 -38
  61. package/src/meeting/request.ts +16 -0
  62. package/src/meeting/request.type.ts +64 -0
  63. package/src/meeting/type.ts +9 -0
  64. package/src/meeting/util.ts +73 -2
  65. package/src/meetings/index.ts +3 -2
  66. package/src/member/index.ts +1 -0
  67. package/src/members/index.ts +13 -10
  68. package/src/members/request.ts +2 -2
  69. package/src/members/util.ts +16 -4
  70. package/src/multistream/mediaRequestManager.ts +7 -7
  71. package/src/multistream/remoteMedia.ts +34 -4
  72. package/src/multistream/remoteMediaGroup.ts +37 -2
  73. package/src/multistream/sendSlotManager.ts +34 -2
  74. package/test/unit/spec/locus-info/index.js +199 -83
  75. package/test/unit/spec/meeting/brbState.ts +9 -9
  76. package/test/unit/spec/meeting/in-meeting-actions.ts +6 -0
  77. package/test/unit/spec/meeting/index.js +729 -80
  78. package/test/unit/spec/meeting/request.js +71 -0
  79. package/test/unit/spec/meeting/utils.js +122 -1
  80. package/test/unit/spec/meetings/index.js +2 -0
  81. package/test/unit/spec/members/index.js +68 -9
  82. package/test/unit/spec/members/request.js +2 -2
  83. package/test/unit/spec/members/utils.js +27 -7
  84. package/test/unit/spec/multistream/mediaRequestManager.ts +19 -6
  85. package/test/unit/spec/multistream/remoteMedia.ts +66 -2
  86. package/test/unit/spec/multistream/sendSlotManager.ts +59 -0
  87. package/test/unit/spec/reachability/index.ts +3 -1
@@ -30,6 +30,7 @@ import MembersUtil from './util';
30
30
  import {ReceiveSlotManager} from '../multistream/receiveSlotManager';
31
31
  import {MediaRequestManager} from '../multistream/mediaRequestManager';
32
32
  import {ServerRoleShape} from './types';
33
+ import {Invitee} from '../meeting/type';
33
34
 
34
35
  /**
35
36
  * Members Update Event
@@ -800,18 +801,18 @@ export default class Members extends StatelessWebexPlugin {
800
801
 
801
802
  /**
802
803
  * Adds a guest Member to the associated meeting
803
- * @param {String} invitee
804
+ * @param {Invitee} invitee
804
805
  * @param {Boolean} [alertIfActive]
805
806
  * @returns {Promise}
806
807
  * @memberof Members
807
808
  */
808
- addMember(invitee: any, alertIfActive?: boolean) {
809
+ addMember(invitee: Invitee, alertIfActive?: boolean) {
809
810
  if (!this.locusUrl) {
810
811
  return Promise.reject(
811
812
  new ParameterError('The associated locus url for this meeting object must be defined.')
812
813
  );
813
814
  }
814
- if (MembersUtil.isInvalidInvitee(invitee)) {
815
+ if (invitee?.skipEmailValidation !== true && MembersUtil.isInvalidInvitee(invitee)) {
815
816
  return Promise.reject(
816
817
  new ParameterError(
817
818
  'The invitee must be defined with either a valid email, emailAddress or phoneNumber property.'
@@ -825,11 +826,11 @@ export default class Members extends StatelessWebexPlugin {
825
826
 
826
827
  /**
827
828
  * Cancels an outgoing PSTN call to the associated meeting
828
- * @param {String} invitee
829
+ * @param {Invitee} invitee
829
830
  * @returns {Promise}
830
831
  * @memberof Members
831
832
  */
832
- cancelPhoneInvite(invitee: any) {
833
+ cancelPhoneInvite(invitee: Invitee) {
833
834
  if (!this.locusUrl) {
834
835
  return Promise.reject(
835
836
  new ParameterError('The associated locus url for this meeting object must be defined.')
@@ -846,12 +847,14 @@ export default class Members extends StatelessWebexPlugin {
846
847
  }
847
848
 
848
849
  /**
849
- * Cancels an SIP call to the associated meeting
850
- * @param {String} invitee
850
+ * Cancels an SIP/phone call to the associated meeting
851
+ * @param {Invitee} invitee
852
+ * @param {String} invitee.memberId - The memberId of the invitee
853
+ * @param {Boolean} [invitee.isInternalNumber] - When cancel phone invitation, if the number is internal
851
854
  * @returns {Promise}
852
855
  * @memberof Members
853
856
  */
854
- cancelSIPInvite(invitee: any) {
857
+ cancelInviteByMemberId(invitee: Invitee) {
855
858
  if (!this.locusUrl) {
856
859
  return Promise.reject(
857
860
  new ParameterError('The associated locus url for this meeting object must be defined.')
@@ -862,9 +865,9 @@ export default class Members extends StatelessWebexPlugin {
862
865
  new ParameterError('The invitee must be defined with a memberId property.')
863
866
  );
864
867
  }
865
- const options = MembersUtil.cancelSIPInviteOptions(invitee, this.locusUrl);
868
+ const options = MembersUtil.cancelInviteByMemberIdOptions(invitee, this.locusUrl);
866
869
 
867
- return this.membersRequest.cancelSIPInvite(options);
870
+ return this.membersRequest.cancelInviteByMemberId(options);
868
871
  }
869
872
 
870
873
  /**
@@ -285,14 +285,14 @@ export default class MembersRequest extends StatelessWebexPlugin {
285
285
  * @throws {Error} if the options are not valid and complete, must have invitee with memberId AND locusUrl
286
286
  * @memberof MembersRequest
287
287
  */
288
- cancelSIPInvite(options: any) {
288
+ cancelInviteByMemberId(options: any) {
289
289
  if (!options?.invitee?.memberId || !options?.locusUrl) {
290
290
  throw new ParameterError(
291
291
  'invitee must be passed and the associated locus url for this meeting object must be defined.'
292
292
  );
293
293
  }
294
294
 
295
- const requestParams = MembersUtil.generateCancelSIPInviteRequestParams(options);
295
+ const requestParams = MembersUtil.generateCancelInviteByMemberIdRequestParams(options);
296
296
 
297
297
  return this.locusDeltaRequest(requestParams);
298
298
  }
@@ -1,4 +1,5 @@
1
1
  import uuid from 'uuid';
2
+ import {has} from 'lodash';
2
3
  import {
3
4
  HTTP_VERBS,
4
5
  CONTROLS,
@@ -13,6 +14,7 @@ import {
13
14
  } from '../constants';
14
15
 
15
16
  import {RoleAssignmentOptions, RoleAssignmentRequest, ServerRoleShape} from './types';
17
+ import {Invitee} from '../meeting/type';
16
18
 
17
19
  const MembersUtil = {
18
20
  /**
@@ -47,6 +49,9 @@ const MembersUtil = {
47
49
  address:
48
50
  options.invitee.emailAddress || options.invitee.email || options.invitee.phoneNumber,
49
51
  ...(options.invitee.roles ? {roles: options.invitee.roles} : {}),
52
+ ...(has(options.invitee, 'isInternalNumber')
53
+ ? {isInternalNumber: options.invitee.isInternalNumber}
54
+ : {}),
50
55
  },
51
56
  ],
52
57
  alertIfActive: options.alertIfActive,
@@ -101,12 +106,16 @@ const MembersUtil = {
101
106
  return requestParams;
102
107
  },
103
108
 
104
- isInvalidInvitee: (invitee) => {
109
+ isInvalidInvitee: (invitee: Invitee) => {
105
110
  if (!(invitee && (invitee.email || invitee.emailAddress || invitee.phoneNumber))) {
106
111
  return true;
107
112
  }
108
113
 
109
114
  if (invitee.phoneNumber) {
115
+ if (invitee.isInternalNumber) {
116
+ return !DIALER_REGEX.INTERNAL_NUMBER.test(invitee.phoneNumber);
117
+ }
118
+
110
119
  return !DIALER_REGEX.E164_FORMAT.test(invitee.phoneNumber);
111
120
  }
112
121
 
@@ -371,17 +380,20 @@ const MembersUtil = {
371
380
  return requestParams;
372
381
  },
373
382
 
374
- cancelSIPInviteOptions: (invitee, locusUrl) => ({
383
+ cancelInviteByMemberIdOptions: (invitee, locusUrl) => ({
375
384
  invitee,
376
385
  locusUrl,
377
386
  }),
378
387
 
379
- generateCancelSIPInviteRequestParams: (options) => {
388
+ generateCancelInviteByMemberIdRequestParams: (options) => {
389
+ const {memberId, isInternalNumber} = options.invitee;
390
+ const hasIsInternalNumberProp = has(options.invitee, 'isInternalNumber');
380
391
  const body = {
381
392
  actionType: _REMOVE_,
382
393
  invitees: [
383
394
  {
384
- address: options.invitee.memberId,
395
+ address: memberId,
396
+ ...(hasIsInternalNumberProp ? {isInternalNumber} : {}),
385
397
  },
386
398
  ],
387
399
  };
@@ -15,7 +15,7 @@ import {cloneDeepWith, debounce, isEmpty} from 'lodash';
15
15
  import LoggerProxy from '../common/logs/logger-proxy';
16
16
 
17
17
  import {ReceiveSlot, ReceiveSlotEvents} from './receiveSlot';
18
- import {getMaxFs} from './remoteMedia';
18
+ import {MAX_FS_VALUES} from './remoteMedia';
19
19
 
20
20
  export interface ActiveSpeakerPolicyInfo {
21
21
  policy: 'active-speaker';
@@ -123,12 +123,12 @@ export class MediaRequestManager {
123
123
 
124
124
  private getDegradedClientRequests(clientRequests: ClientRequestsMap) {
125
125
  const maxFsLimits = [
126
- getMaxFs('best'),
127
- getMaxFs('large'),
128
- getMaxFs('medium'),
129
- getMaxFs('small'),
130
- getMaxFs('very small'),
131
- getMaxFs('thumbnail'),
126
+ MAX_FS_VALUES['1080p'],
127
+ MAX_FS_VALUES['720p'],
128
+ MAX_FS_VALUES['540p'],
129
+ MAX_FS_VALUES['360p'],
130
+ MAX_FS_VALUES['180p'],
131
+ MAX_FS_VALUES['90p'],
132
132
  ];
133
133
 
134
134
  // reduce max-fs until total macroblocks is below limit
@@ -19,17 +19,18 @@ export type RemoteVideoResolution =
19
19
  | 'large' // 1080p or less
20
20
  | 'best'; // highest possible resolution
21
21
 
22
- const MAX_FS_VALUES = {
22
+ export const MAX_FS_VALUES = {
23
23
  '90p': 60,
24
24
  '180p': 240,
25
25
  '360p': 920,
26
+ '540p': 2040,
26
27
  '720p': 3600,
27
28
  '1080p': 8192,
28
29
  };
29
30
 
30
31
  /**
31
32
  * Converts pane size into h264 maxFs
32
- * @param {PaneSize} paneSize
33
+ * @param {RemoteVideoResolution} paneSize
33
34
  * @returns {number}
34
35
  */
35
36
  export function getMaxFs(paneSize: RemoteVideoResolution): number {
@@ -89,6 +90,13 @@ export class RemoteMedia extends EventsScope {
89
90
 
90
91
  public readonly id: RemoteMediaId;
91
92
 
93
+ /**
94
+ * The max frame size of the media request, used for logging and media requests.
95
+ * Set by setSizeHint() based on video element dimensions.
96
+ * When > 0, this value takes precedence over options.resolution in sendMediaRequest().
97
+ */
98
+ private maxFrameSize = 0;
99
+
92
100
  /**
93
101
  * Constructs RemoteMedia instance
94
102
  *
@@ -136,15 +144,34 @@ export class RemoteMedia extends EventsScope {
136
144
  fs = MAX_FS_VALUES['180p'];
137
145
  } else if (height < getThresholdHeight(360)) {
138
146
  fs = MAX_FS_VALUES['360p'];
147
+ } else if (height < getThresholdHeight(540)) {
148
+ fs = MAX_FS_VALUES['540p'];
139
149
  } else if (height <= 720) {
140
150
  fs = MAX_FS_VALUES['720p'];
141
151
  } else {
142
152
  fs = MAX_FS_VALUES['1080p'];
143
153
  }
144
154
 
155
+ this.maxFrameSize = fs;
145
156
  this.receiveSlot?.setMaxFs(fs);
146
157
  }
147
158
 
159
+ /**
160
+ * Get the current effective maxFs value that would be used in media requests
161
+ * @returns {number | undefined} The maxFs value, or undefined if no constraints
162
+ */
163
+ public getEffectiveMaxFs(): number | undefined {
164
+ if (this.maxFrameSize > 0) {
165
+ return this.maxFrameSize;
166
+ }
167
+
168
+ if (this.options.resolution) {
169
+ return getMaxFs(this.options.resolution);
170
+ }
171
+
172
+ return undefined;
173
+ }
174
+
148
175
  /**
149
176
  * Invalidates the remote media by clearing the reference to a receive slot and
150
177
  * cancelling the media request.
@@ -185,6 +212,9 @@ export class RemoteMedia extends EventsScope {
185
212
  throw new Error('sendMediaRequest() called on an invalidated RemoteMedia instance');
186
213
  }
187
214
 
215
+ // Use maxFrameSize from setSizeHint if available, otherwise fallback to options.resolution
216
+ const maxFs = this.getEffectiveMaxFs();
217
+
188
218
  this.mediaRequestId = this.mediaRequestManager.addRequest(
189
219
  {
190
220
  policyInfo: {
@@ -192,9 +222,9 @@ export class RemoteMedia extends EventsScope {
192
222
  csi,
193
223
  },
194
224
  receiveSlots: [this.receiveSlot],
195
- codecInfo: this.options.resolution && {
225
+ codecInfo: maxFs && {
196
226
  codec: 'h264',
197
- maxFs: getMaxFs(this.options.resolution),
227
+ maxFs,
198
228
  },
199
229
  },
200
230
  commit
@@ -215,6 +215,9 @@ export class RemoteMediaGroup {
215
215
  private sendActiveSpeakerMediaRequest(commit: boolean) {
216
216
  this.cancelActiveSpeakerMediaRequest(false);
217
217
 
218
+ // Calculate the effective maxFs based on all unpinned RemoteMedia instances
219
+ const effectiveMaxFs = this.getEffectiveMaxFsForActiveSpeaker();
220
+
218
221
  this.mediaRequestId = this.mediaRequestManager.addRequest(
219
222
  {
220
223
  policyInfo: {
@@ -230,9 +233,9 @@ export class RemoteMediaGroup {
230
233
  receiveSlots: this.unpinnedRemoteMedia.map((remoteMedia) =>
231
234
  remoteMedia.getUnderlyingReceiveSlot()
232
235
  ) as ReceiveSlot[],
233
- codecInfo: this.options.resolution && {
236
+ codecInfo: effectiveMaxFs && {
234
237
  codec: 'h264',
235
- maxFs: getMaxFs(this.options.resolution),
238
+ maxFs: effectiveMaxFs,
236
239
  },
237
240
  },
238
241
  commit
@@ -300,4 +303,36 @@ export class RemoteMediaGroup {
300
303
  this.unpinnedRemoteMedia.includes(remoteMedia) || this.pinnedRemoteMedia.includes(remoteMedia)
301
304
  );
302
305
  }
306
+
307
+ /**
308
+ * Calculate the effective maxFs for the active speaker media request based on unpinned RemoteMedia instances
309
+ * @returns {number | undefined} The calculated maxFs value, or undefined if no constraints
310
+ * @private
311
+ */
312
+ private getEffectiveMaxFsForActiveSpeaker(): number | undefined {
313
+ // Get all effective maxFs values from unpinned RemoteMedia instances
314
+ const maxFsValues = this.unpinnedRemoteMedia
315
+ .map((remoteMedia) => remoteMedia.getEffectiveMaxFs())
316
+ .filter((maxFs) => maxFs !== undefined);
317
+
318
+ // Use the highest maxFs value to ensure we don't under-request resolution for any instance
319
+ if (maxFsValues.length > 0) {
320
+ return Math.max(...maxFsValues);
321
+ }
322
+
323
+ // Fall back to group's resolution option
324
+ if (this.options.resolution) {
325
+ return getMaxFs(this.options.resolution);
326
+ }
327
+
328
+ return undefined;
329
+ }
330
+
331
+ /**
332
+ * Get the current effective maxFs that would be used for the active speaker media request
333
+ * @returns {number | undefined} The effective maxFs value
334
+ */
335
+ public getEffectiveMaxFs(): number | undefined {
336
+ return this.getEffectiveMaxFsForActiveSpeaker();
337
+ }
303
338
  }
@@ -7,10 +7,20 @@ import {
7
7
  StreamState,
8
8
  } from '@webex/internal-media-core';
9
9
 
10
+ /**
11
+ * This class is used to manage the sendSlots for the given media types.
12
+ */
10
13
  export default class SendSlotManager {
11
14
  private readonly slots: Map<MediaType, SendSlot> = new Map();
12
15
  private readonly LoggerProxy: any;
16
+ private readonly sourceStateOverrides: Map<MediaType, StreamState> = new Map();
13
17
 
18
+ /**
19
+ * Constructor for SendSlotManager
20
+ *
21
+ * @param {any} LoggerProxy is used to log the messages
22
+ * @constructor
23
+ */
14
24
  constructor(LoggerProxy: any) {
15
25
  this.LoggerProxy = LoggerProxy;
16
26
  }
@@ -93,7 +103,7 @@ export default class SendSlotManager {
93
103
  public setSourceStateOverride(mediaType: MediaType, state: StreamState | null) {
94
104
  if (mediaType !== MediaType.VideoMain) {
95
105
  throw new Error(
96
- `sendSlotManager cannot set source state override which media type is ${mediaType}`
106
+ `Invalid media type '${mediaType}'. Source state overrides are only applicable to ${MediaType.VideoMain}.`
97
107
  );
98
108
  }
99
109
 
@@ -103,17 +113,39 @@ export default class SendSlotManager {
103
113
  throw new Error(`Slot for ${mediaType} does not exist`);
104
114
  }
105
115
 
116
+ const currentStateOverride = this.getSourceStateOverride(mediaType);
117
+ if (currentStateOverride === state) {
118
+ return;
119
+ }
120
+
106
121
  if (state) {
107
122
  slot.setSourceStateOverride(state);
123
+ this.sourceStateOverrides.set(mediaType, state);
108
124
  } else {
109
125
  slot.clearSourceStateOverride();
126
+ this.sourceStateOverrides.delete(mediaType);
110
127
  }
111
128
 
112
129
  this.LoggerProxy.logger.info(
113
- `SendSlotsManager->setSourceStateOverride#set source state override for ${mediaType} to ${state}`
130
+ `SendSlotManager->setSourceStateOverride#set source state override for ${mediaType} to ${state}`
114
131
  );
115
132
  }
116
133
 
134
+ /**
135
+ * Gets the source state override for the given media type.
136
+ * @param {MediaType} mediaType - The type of media to get the source state override for.
137
+ * @returns {StreamState | null} - The current source state override or null if not set.
138
+ */
139
+ private getSourceStateOverride(mediaType: MediaType): StreamState | null {
140
+ if (mediaType !== MediaType.VideoMain) {
141
+ throw new Error(
142
+ `Invalid media type '${mediaType}'. Source state overrides are only applicable to ${MediaType.VideoMain}.`
143
+ );
144
+ }
145
+
146
+ return this.sourceStateOverrides.get(mediaType) || null;
147
+ }
148
+
117
149
  /**
118
150
  * This method publishes the given stream to the sendSlot for the given mediaType
119
151
  * @param {MediaType} mediaType MediaType of the sendSlot to which a stream needs to be published (AUDIO_MAIN/VIDEO_MAIN/AUDIO_SLIDES/VIDEO_SLIDES)