@azure/communication-react 1.5.1-alpha-202303240013 → 1.5.1-alpha-202303250012

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 (24) hide show
  1. package/dist/dist-cjs/communication-react/index.js +82 -62
  2. package/dist/dist-cjs/communication-react/index.js.map +1 -1
  3. package/dist/dist-esm/acs-ui-common/src/telemetryVersion.js +1 -1
  4. package/dist/dist-esm/acs-ui-common/src/telemetryVersion.js.map +1 -1
  5. package/dist/dist-esm/react-components/src/components/ResponsiveHorizontalGallery.d.ts +2 -0
  6. package/dist/dist-esm/react-components/src/components/ResponsiveHorizontalGallery.js +2 -1
  7. package/dist/dist-esm/react-components/src/components/ResponsiveHorizontalGallery.js.map +1 -1
  8. package/dist/dist-esm/react-components/src/components/ResponsiveVerticalGallery.d.ts +2 -0
  9. package/dist/dist-esm/react-components/src/components/ResponsiveVerticalGallery.js +2 -1
  10. package/dist/dist-esm/react-components/src/components/ResponsiveVerticalGallery.js.map +1 -1
  11. package/dist/dist-esm/react-components/src/components/VideoGallery/DefaultLayout.js +11 -4
  12. package/dist/dist-esm/react-components/src/components/VideoGallery/DefaultLayout.js.map +1 -1
  13. package/dist/dist-esm/react-components/src/components/VideoGallery/FloatingLocalVideoLayout.js +11 -4
  14. package/dist/dist-esm/react-components/src/components/VideoGallery/FloatingLocalVideoLayout.js.map +1 -1
  15. package/dist/dist-esm/react-components/src/components/VideoGallery/Layout.js.map +1 -1
  16. package/dist/dist-esm/react-components/src/components/VideoGallery/OverflowGallery.d.ts +1 -0
  17. package/dist/dist-esm/react-components/src/components/VideoGallery/OverflowGallery.js +6 -3
  18. package/dist/dist-esm/react-components/src/components/VideoGallery/OverflowGallery.js.map +1 -1
  19. package/dist/dist-esm/react-components/src/components/VideoGallery/utils/videoGalleryLayoutUtils.d.ts +1 -1
  20. package/dist/dist-esm/react-components/src/components/VideoGallery/utils/videoGalleryLayoutUtils.js +50 -41
  21. package/dist/dist-esm/react-components/src/components/VideoGallery/utils/videoGalleryLayoutUtils.js.map +1 -1
  22. package/dist/dist-esm/react-components/src/gallery/dominantSpeaker.js +6 -14
  23. package/dist/dist-esm/react-components/src/gallery/dominantSpeaker.js.map +1 -1
  24. package/package.json +8 -8
@@ -162,7 +162,7 @@ const _toCommunicationIdentifier = (id) => {
162
162
  // Copyright (c) Microsoft Corporation.
163
163
  // Licensed under the MIT license.
164
164
  // GENERATED FILE. DO NOT EDIT MANUALLY.
165
- var telemetryVersion = '1.5.1-alpha-202303240013';
165
+ var telemetryVersion = '1.5.1-alpha-202303250012';
166
166
 
167
167
  // Copyright (c) Microsoft Corporation.
168
168
  /**
@@ -9224,10 +9224,7 @@ const smartDominantSpeakerParticipants = (args) => {
9224
9224
  }
9225
9225
  const participantsMap = participantsById(participants);
9226
9226
  // Only use the Max allowed dominant speakers that exist in participants
9227
- const dominantSpeakerIds = Array.from(new Set(dominantSpeakers).values())
9228
- .filter((id) => !!participantsMap[id])
9229
- .slice(0, maxDominantSpeakers);
9230
- const lastVisibleParticipantIds = lastVisibleParticipants.map((p) => p.userId);
9227
+ const dominantSpeakerIds = dominantSpeakers.filter((id) => !!participantsMap[id]).slice(0, maxDominantSpeakers);
9231
9228
  const newVisibleParticipantIds = lastVisibleParticipants.map((p) => p.userId).slice(0, maxDominantSpeakers);
9232
9229
  const newDominantSpeakerIds = dominantSpeakerIds.filter((id) => !newVisibleParticipantIds.includes(id));
9233
9230
  // Remove participants that are no longer dominant and replace them with new dominant speakers.
@@ -9241,17 +9238,12 @@ const smartDominantSpeakerParticipants = (args) => {
9241
9238
  newVisibleParticipantIds[index] = replacement;
9242
9239
  }
9243
9240
  }
9244
- const removedVisibleParticipantIds = lastVisibleParticipantIds.filter((p) => !newVisibleParticipantIds.includes(p));
9245
- removedVisibleParticipantIds.forEach((p) => newVisibleParticipantIds.push(p));
9246
- const newVisibleParticipantIdSet = new Set(newVisibleParticipantIds);
9247
- const leftoverParticipants = participants.filter((p) => !newVisibleParticipantIdSet.has(p.userId));
9248
- leftoverParticipants.forEach((p) => {
9249
- newVisibleParticipantIds.push(p.userId);
9250
- });
9251
- // newVisibleParticipantIds can contain identifiers for participants that are no longer in the call. So we ignore those IDs.
9252
- const newVisibleParticipants = newVisibleParticipantIds
9241
+ let newVisibleParticipants = newVisibleParticipantIds
9253
9242
  .map((participantId) => participantsMap[participantId])
9254
- .filter((p) => !!p);
9243
+ .filter((p) => p !== undefined);
9244
+ const newVisibleParticipantIdsSet = new Set(newVisibleParticipantIds);
9245
+ const remainingParticipants = participants.filter((p) => !newVisibleParticipantIdsSet.has(p.userId));
9246
+ newVisibleParticipants = newVisibleParticipants.concat(remainingParticipants);
9255
9247
  return newVisibleParticipants;
9256
9248
  };
9257
9249
  const participantsById = (participants) => {
@@ -9262,38 +9254,42 @@ const participantsById = (participants) => {
9262
9254
 
9263
9255
  // Copyright (c) Microsoft Corporation.
9264
9256
  const DEFAULT_MAX_REMOTE_VIDEOSTREAMS = 4;
9265
- const DEFAULT_MAX_AUDIO_DOMINANT_SPEAKERS = 6;
9257
+ const DEFAULT_MAX_HORIZONTAL_GALLERY_DOMINANT_SPEAKERS = 6;
9266
9258
  const _useOrganizedParticipants = (props) => {
9267
- var _a, _b;
9268
- const visibleVideoParticipants = React.useRef([]);
9269
- const visibleAudioParticipants = React.useRef([]);
9270
- const { remoteParticipants, dominantSpeakers, maxRemoteVideoStreams = DEFAULT_MAX_REMOTE_VIDEOSTREAMS, maxAudioDominantSpeakers = DEFAULT_MAX_AUDIO_DOMINANT_SPEAKERS, isScreenShareActive = false } = props;
9271
- visibleVideoParticipants.current = smartDominantSpeakerParticipants({
9272
- participants: (_a = remoteParticipants === null || remoteParticipants === void 0 ? void 0 : remoteParticipants.filter((p) => { var _a; return (_a = p.videoStream) === null || _a === void 0 ? void 0 : _a.isAvailable; })) !== null && _a !== void 0 ? _a : [],
9273
- dominantSpeakers,
9274
- lastVisibleParticipants: visibleVideoParticipants.current,
9275
- maxDominantSpeakers: maxRemoteVideoStreams
9276
- }).slice(0, maxRemoteVideoStreams);
9277
- const visibleVideoParticipantsSet = new Set(visibleVideoParticipants.current.map((p) => p.userId));
9259
+ const visibleGridParticipants = React.useRef([]);
9260
+ const visibleHorizontalGalleryParticipants = React.useRef([]);
9261
+ const { remoteParticipants = [], dominantSpeakers = [], maxRemoteVideoStreams = DEFAULT_MAX_REMOTE_VIDEOSTREAMS, maxHorizontalGalleryDominantSpeakers = DEFAULT_MAX_HORIZONTAL_GALLERY_DOMINANT_SPEAKERS, isScreenShareActive = false, pinnedParticipantUserIds = [] } = props;
9262
+ const videoParticipants = remoteParticipants.filter((p) => { var _a; return (_a = p.videoStream) === null || _a === void 0 ? void 0 : _a.isAvailable; });
9263
+ visibleGridParticipants.current =
9264
+ pinnedParticipantUserIds.length > 0 || isScreenShareActive
9265
+ ? []
9266
+ : smartDominantSpeakerParticipants({
9267
+ participants: videoParticipants,
9268
+ dominantSpeakers,
9269
+ lastVisibleParticipants: visibleGridParticipants.current,
9270
+ maxDominantSpeakers: maxRemoteVideoStreams
9271
+ }).slice(0, maxRemoteVideoStreams);
9272
+ const visibleGridParticipantsSet = new Set(visibleGridParticipants.current.map((p) => p.userId));
9273
+ const remoteParticipantsOrdered = putVideoParticipantsFirst(remoteParticipants);
9278
9274
  /* @conditional-compile-remove(PSTN-calls) */ /* @conditional-compile-remove(one-to-n-calling) */
9279
- const callingParticipants = remoteParticipants.filter((p) => p.state === ('Connecting' ));
9275
+ const callingParticipants = remoteParticipantsOrdered.filter((p) => p.state === ('Connecting' ));
9280
9276
  /* @conditional-compile-remove(PSTN-calls) */ /* @conditional-compile-remove(one-to-n-calling) */
9281
9277
  const callingParticipantsSet = new Set(callingParticipants.map((p) => p.userId));
9282
- visibleAudioParticipants.current = smartDominantSpeakerParticipants({
9283
- participants: (_b = remoteParticipants === null || remoteParticipants === void 0 ? void 0 : remoteParticipants.filter((p) => !visibleVideoParticipantsSet.has(p.userId) &&
9284
- /* @conditional-compile-remove(PSTN-calls) */ /* @conditional-compile-remove(one-to-n-calling) */ !callingParticipantsSet.has(p.userId))) !== null && _b !== void 0 ? _b : [],
9285
- dominantSpeakers,
9286
- lastVisibleParticipants: visibleAudioParticipants.current,
9287
- maxDominantSpeakers: maxAudioDominantSpeakers
9278
+ visibleHorizontalGalleryParticipants.current = smartDominantSpeakerParticipants({
9279
+ participants: remoteParticipantsOrdered.filter((p) => !visibleGridParticipantsSet.has(p.userId) &&
9280
+ /* @conditional-compile-remove(PSTN-calls) */ /* @conditional-compile-remove(one-to-n-calling) */ !callingParticipantsSet.has(p.userId)),
9281
+ dominantSpeakers: dominantSpeakers,
9282
+ lastVisibleParticipants: visibleHorizontalGalleryParticipants.current,
9283
+ maxDominantSpeakers: maxHorizontalGalleryDominantSpeakers
9288
9284
  });
9289
9285
  const getGridParticipants = React.useCallback(() => {
9290
9286
  if (isScreenShareActive) {
9291
9287
  return [];
9292
9288
  }
9293
9289
  /* @conditional-compile-remove(PSTN-calls) */ /* @conditional-compile-remove(one-to-n-calling) */
9294
- return visibleVideoParticipants.current.length > 0
9295
- ? visibleVideoParticipants.current
9296
- : visibleAudioParticipants.current.concat(callingParticipants);
9290
+ return visibleGridParticipants.current.length > 0
9291
+ ? visibleGridParticipants.current
9292
+ : visibleHorizontalGalleryParticipants.current.concat(callingParticipants);
9297
9293
  }, [
9298
9294
  /* @conditional-compile-remove(PSTN-calls) */ /* @conditional-compile-remove(one-to-n-calling) */ callingParticipants,
9299
9295
  isScreenShareActive
@@ -9303,14 +9299,14 @@ const _useOrganizedParticipants = (props) => {
9303
9299
  if (isScreenShareActive) {
9304
9300
  // If screen sharing is active, assign video and audio participants as horizontal gallery participants
9305
9301
  /* @conditional-compile-remove(PSTN-calls) */ /* @conditional-compile-remove(one-to-n-calling) */
9306
- return visibleVideoParticipants.current.concat(visibleAudioParticipants.current.concat(callingParticipants));
9302
+ return visibleGridParticipants.current.concat(visibleHorizontalGalleryParticipants.current.concat(callingParticipants));
9307
9303
  }
9308
9304
  else {
9309
9305
  // If screen sharing is not active, then assign all video tiles as grid tiles.
9310
9306
  // If there are no video tiles, then assign audio tiles as grid tiles.
9311
9307
  /* @conditional-compile-remove(PSTN-calls) */ /* @conditional-compile-remove(one-to-n-calling) */
9312
- return visibleVideoParticipants.current.length > 0
9313
- ? visibleAudioParticipants.current.concat(callingParticipants)
9308
+ return visibleGridParticipants.current.length > 0
9309
+ ? visibleHorizontalGalleryParticipants.current.concat(callingParticipants)
9314
9310
  : [];
9315
9311
  }
9316
9312
  }, [
@@ -9328,18 +9324,12 @@ const _useOrganizedParticipantsWithPinnedParticipants = (props) => {
9328
9324
  map[remoteParticipant.userId] = remoteParticipant;
9329
9325
  return map;
9330
9326
  }, {});
9331
- // count pinned participants with video
9332
- let pinnedParticipantsWithVideoOnCount = 0;
9333
9327
  // get pinned participants in the same order of pinned participant user ids using remoteParticipantMap
9334
9328
  const pinnedParticipants = [];
9335
9329
  (_a = props.pinnedParticipantUserIds) === null || _a === void 0 ? void 0 : _a.forEach((id) => {
9336
- var _a;
9337
9330
  const pinnedParticipant = remoteParticipantMap[id];
9338
9331
  if (pinnedParticipant) {
9339
9332
  pinnedParticipants.push(pinnedParticipant);
9340
- if ((_a = pinnedParticipant.videoStream) === null || _a === void 0 ? void 0 : _a.isAvailable) {
9341
- pinnedParticipantsWithVideoOnCount++;
9342
- }
9343
9333
  }
9344
9334
  });
9345
9335
  // get unpinned participants by filtering all remote participants using a set of pinned participant user ids
@@ -9347,11 +9337,7 @@ const _useOrganizedParticipantsWithPinnedParticipants = (props) => {
9347
9337
  const unpinnedParticipants = props.remoteParticipants.filter((p) => !pinnedParticipantUserIdSet.has(p.userId));
9348
9338
  const useOrganizedParticipantsProps = Object.assign(Object.assign({}, props), {
9349
9339
  // if there are pinned participants then we should only consider unpinned participants
9350
- remoteParticipants: unpinnedParticipants,
9351
- // if there is a maximum of remote video streams we need to subtract pinned participants with video
9352
- maxRemoteVideoStreams: props.maxRemoteVideoStreams
9353
- ? props.maxRemoteVideoStreams - pinnedParticipantsWithVideoOnCount
9354
- : undefined });
9340
+ remoteParticipants: unpinnedParticipants });
9355
9341
  const useOrganizedParticipantsResult = _useOrganizedParticipants(useOrganizedParticipantsProps);
9356
9342
  if (pinnedParticipants.length === 0) {
9357
9343
  return useOrganizedParticipantsResult;
@@ -9363,6 +9349,21 @@ const _useOrganizedParticipantsWithPinnedParticipants = (props) => {
9363
9349
  : useOrganizedParticipantsResult.gridParticipants.concat(useOrganizedParticipantsResult.horizontalGalleryParticipants)
9364
9350
  };
9365
9351
  };
9352
+ const putVideoParticipantsFirst = (remoteParticipants) => {
9353
+ const videoParticipants = [];
9354
+ const audioParticipants = [];
9355
+ remoteParticipants.forEach((p) => {
9356
+ var _a;
9357
+ if ((_a = p.videoStream) === null || _a === void 0 ? void 0 : _a.isAvailable) {
9358
+ videoParticipants.push(p);
9359
+ }
9360
+ else {
9361
+ audioParticipants.push(p);
9362
+ }
9363
+ });
9364
+ const remoteParticipantSortedByVideo = videoParticipants.concat(audioParticipants);
9365
+ return remoteParticipantSortedByVideo;
9366
+ };
9366
9367
  /**
9367
9368
  * Hook to determine which participants should be in grid and horizontal gallery and their order respectively
9368
9369
  * @private
@@ -9814,7 +9815,7 @@ const calculateVerticalChildrenPerPage = (args) => {
9814
9815
  * available width obtained from a ResizeObserver, width per child, gap width, and button width
9815
9816
  */
9816
9817
  const ResponsiveHorizontalGallery = (props) => {
9817
- const { gapWidthRem, buttonWidthRem = 0, onFetchTilesToRender } = props;
9818
+ const { gapWidthRem, buttonWidthRem = 0, onFetchTilesToRender, onChildrenPerPageChange } = props;
9818
9819
  const containerRef = React.useRef(null);
9819
9820
  const containerWidth = _useContainerWidth(containerRef);
9820
9821
  const leftPadding = containerRef.current ? parseFloat(getComputedStyle(containerRef.current).paddingLeft) : 0;
@@ -9825,6 +9826,7 @@ const ResponsiveHorizontalGallery = (props) => {
9825
9826
  gapWidthRem,
9826
9827
  buttonWidthRem
9827
9828
  });
9829
+ onChildrenPerPageChange === null || onChildrenPerPageChange === void 0 ? void 0 : onChildrenPerPageChange(childrenPerPage);
9828
9830
  return (React__default['default'].createElement("div", { "data-ui-id": "responsive-horizontal-gallery", ref: containerRef, className: react.mergeStyles(props.containerStyles) },
9829
9831
  React__default['default'].createElement(HorizontalGallery, { childrenPerPage: childrenPerPage, styles: props.horizontalGalleryStyles, onFetchTilesToRender: onFetchTilesToRender }, props.children)));
9830
9832
  };
@@ -10007,7 +10009,7 @@ const VerticalGalleryControlBar = (props) => {
10007
10009
  * @beta
10008
10010
  */
10009
10011
  const ResponsiveVerticalGallery = (props) => {
10010
- const { children, containerStyles, verticalGalleryStyles, gapHeightRem, controlBarHeightRem, isShort, onFetchTilesToRender } = props;
10012
+ const { children, containerStyles, verticalGalleryStyles, gapHeightRem, controlBarHeightRem, isShort, onFetchTilesToRender, onChildrenPerPageChange } = props;
10011
10013
  const containerRef = React.useRef(null);
10012
10014
  const containerHeight = _useContainerHeight(containerRef);
10013
10015
  const topPadding = containerRef.current ? parseFloat(getComputedStyle(containerRef.current).paddingTop) : 0;
@@ -10019,6 +10021,7 @@ const ResponsiveVerticalGallery = (props) => {
10019
10021
  controlBarHeight: controlBarHeightRem !== null && controlBarHeightRem !== void 0 ? controlBarHeightRem : 2,
10020
10022
  isShort: isShort !== null && isShort !== void 0 ? isShort : false
10021
10023
  });
10024
+ onChildrenPerPageChange === null || onChildrenPerPageChange === void 0 ? void 0 : onChildrenPerPageChange(childrenPerPage);
10022
10025
  return (React__default['default'].createElement("div", { "data-ui-id": "responsive-vertical-gallery", ref: containerRef, className: react.mergeStyles(containerStyles) },
10023
10026
  React__default['default'].createElement(VerticalGallery, { childrenPerPage: childrenPerPage, styles: verticalGalleryStyles, onFetchTilesToRender: onFetchTilesToRender }, children)));
10024
10027
  };
@@ -10078,7 +10081,7 @@ const OverflowGallery = (props) => {
10078
10081
  /* @conditional-compile-remove(vertical-gallery) */
10079
10082
  isShort = false, overflowGalleryElements, horizontalGalleryStyles,
10080
10083
  /* @conditional-compile-remove(vertical-gallery) */ overflowGalleryLayout = 'HorizontalBottom',
10081
- /* @conditional-compile-remove(vertical-gallery) */ veritcalGalleryStyles } = props;
10084
+ /* @conditional-compile-remove(vertical-gallery) */ veritcalGalleryStyles, onChildrenPerPageChange } = props;
10082
10085
  const containerStyles = React.useMemo(() => {
10083
10086
  /* @conditional-compile-remove(vertical-gallery) */
10084
10087
  if (overflowGalleryLayout === 'VerticalRight') {
@@ -10106,13 +10109,16 @@ const OverflowGallery = (props) => {
10106
10109
  ]);
10107
10110
  /* @conditional-compile-remove(vertical-gallery) */
10108
10111
  if (overflowGalleryLayout === 'VerticalRight') {
10109
- return (React__default['default'].createElement(ResponsiveVerticalGallery, { key: "responsive-vertical-gallery", containerStyles: containerStyles, verticalGalleryStyles: galleryStyles, controlBarHeightRem: HORIZONTAL_GALLERY_BUTTON_WIDTH, gapHeightRem: HORIZONTAL_GALLERY_GAP, isShort: isShort, onFetchTilesToRender: onFetchTilesToRender }, overflowGalleryElements));
10112
+ return (React__default['default'].createElement(ResponsiveVerticalGallery, { key: "responsive-vertical-gallery", containerStyles: containerStyles, verticalGalleryStyles: galleryStyles, controlBarHeightRem: HORIZONTAL_GALLERY_BUTTON_WIDTH, gapHeightRem: HORIZONTAL_GALLERY_GAP, isShort: isShort, onFetchTilesToRender: onFetchTilesToRender, onChildrenPerPageChange: onChildrenPerPageChange }, overflowGalleryElements));
10110
10113
  }
10111
10114
  /* @conditional-compile-remove(pinned-participants) */
10112
10115
  if (isNarrow) {
10116
+ // There are no pages for ScrollableHorizontalGallery so we will approximate the first 3 remote
10117
+ // participant tiles are visible
10118
+ onChildrenPerPageChange === null || onChildrenPerPageChange === void 0 ? void 0 : onChildrenPerPageChange(3);
10113
10119
  return (React__default['default'].createElement(ScrollableHorizontalGallery, { horizontalGalleryElements: overflowGalleryElements, onFetchTilesToRender: onFetchTilesToRender, key: "scrollable-horizontal-gallery" }));
10114
10120
  }
10115
- return (React__default['default'].createElement(ResponsiveHorizontalGallery, { key: "responsive-horizontal-gallery", containerStyles: containerStyles, onFetchTilesToRender: onFetchTilesToRender, horizontalGalleryStyles: galleryStyles, buttonWidthRem: HORIZONTAL_GALLERY_BUTTON_WIDTH, gapWidthRem: HORIZONTAL_GALLERY_GAP }, overflowGalleryElements));
10121
+ return (React__default['default'].createElement(ResponsiveHorizontalGallery, { key: "responsive-horizontal-gallery", containerStyles: containerStyles, onFetchTilesToRender: onFetchTilesToRender, horizontalGalleryStyles: galleryStyles, buttonWidthRem: HORIZONTAL_GALLERY_BUTTON_WIDTH, gapWidthRem: HORIZONTAL_GALLERY_GAP, onChildrenPerPageChange: onChildrenPerPageChange }, overflowGalleryElements));
10116
10122
  };
10117
10123
 
10118
10124
  // Copyright (c) Microsoft Corporation.
@@ -10125,17 +10131,22 @@ const OverflowGallery = (props) => {
10125
10131
  const DefaultLayout = (props) => {
10126
10132
  const { remoteParticipants = [], dominantSpeakers, localVideoComponent, screenShareComponent, onRenderRemoteParticipant, styles, maxRemoteVideoStreams, parentWidth,
10127
10133
  /* @conditional-compile-remove(vertical-gallery) */
10128
- parentHeight,
10129
- /* @conditional-compile-remove(pinned-participants) */ pinnedParticipantUserIds,
10134
+ parentHeight, pinnedParticipantUserIds = [],
10130
10135
  /* @conditional-compile-remove(vertical-gallery) */ overflowGalleryLayout = 'HorizontalBottom' } = props;
10131
10136
  const isNarrow = parentWidth ? isNarrowWidth(parentWidth) : false;
10132
10137
  /* @conditional-compile-remove(vertical-gallery) */
10133
10138
  const isShort = parentHeight ? isShortHeight(parentHeight) : false;
10139
+ // This is for tracking the number of children in the first page of horizontal gallery.
10140
+ // This number will be used for the maxHorizontalDominantSpeakers when organizing the remote participants.
10141
+ const childrenPerPage = React.useRef(4);
10134
10142
  const { gridParticipants, horizontalGalleryParticipants } = useOrganizedParticipants({
10135
10143
  remoteParticipants,
10136
10144
  dominantSpeakers,
10137
10145
  maxRemoteVideoStreams,
10138
10146
  isScreenShareActive: !!screenShareComponent,
10147
+ maxHorizontalGalleryDominantSpeakers: screenShareComponent
10148
+ ? childrenPerPage.current - (pinnedParticipantUserIds.length % childrenPerPage.current)
10149
+ : childrenPerPage.current,
10139
10150
  /* @conditional-compile-remove(pinned-participants) */ pinnedParticipantUserIds
10140
10151
  });
10141
10152
  let activeVideoStreams = 0;
@@ -10174,7 +10185,9 @@ const DefaultLayout = (props) => {
10174
10185
  /* @conditional-compile-remove(vertical-gallery) */
10175
10186
  veritcalGalleryStyles: styles === null || styles === void 0 ? void 0 : styles.verticalGallery,
10176
10187
  /* @conditional-compile-remove(pinned-participants) */
10177
- overflowGalleryLayout: overflowGalleryLayout, onFetchTilesToRender: setIndexesToRender }));
10188
+ overflowGalleryLayout: overflowGalleryLayout, onFetchTilesToRender: setIndexesToRender, onChildrenPerPageChange: (n) => {
10189
+ childrenPerPage.current = n;
10190
+ } }));
10178
10191
  }, [
10179
10192
  isNarrow,
10180
10193
  /* @conditional-compile-remove(vertical-gallery) */ isShort,
@@ -10937,18 +10950,23 @@ const layerHostStyle = {
10937
10950
  * @private
10938
10951
  */
10939
10952
  const FloatingLocalVideoLayout = (props) => {
10940
- const { remoteParticipants = [], dominantSpeakers, localVideoComponent, screenShareComponent, onRenderRemoteParticipant, styles, maxRemoteVideoStreams, showCameraSwitcherInLocalPreview, parentWidth, parentHeight,
10941
- /* @conditional-compile-remove(pinned-participants) */ pinnedParticipantUserIds,
10953
+ const { remoteParticipants = [], dominantSpeakers, localVideoComponent, screenShareComponent, onRenderRemoteParticipant, styles, maxRemoteVideoStreams, showCameraSwitcherInLocalPreview, parentWidth, parentHeight, pinnedParticipantUserIds = [],
10942
10954
  /* @conditional-compile-remove(vertical-gallery) */ overflowGalleryLayout = 'HorizontalBottom' } = props;
10943
10955
  const theme = useTheme();
10944
10956
  const isNarrow = parentWidth ? isNarrowWidth(parentWidth) : false;
10945
10957
  /* @conditional-compile-remove(vertical-gallery) */
10946
10958
  const isShort = parentHeight ? isShortHeight(parentHeight) : false;
10959
+ // This is for tracking the number of children in the first page of horizontal gallery.
10960
+ // This number will be used for the maxHorizontalDominantSpeakers when organizing the remote participants.
10961
+ const childrenPerPage = React.useRef(4);
10947
10962
  const { gridParticipants, horizontalGalleryParticipants } = useOrganizedParticipants({
10948
10963
  remoteParticipants,
10949
10964
  dominantSpeakers,
10950
10965
  maxRemoteVideoStreams,
10951
10966
  isScreenShareActive: !!screenShareComponent,
10967
+ maxHorizontalGalleryDominantSpeakers: screenShareComponent
10968
+ ? childrenPerPage.current - (pinnedParticipantUserIds.length % childrenPerPage.current)
10969
+ : childrenPerPage.current,
10952
10970
  /* @conditional-compile-remove(pinned-participants) */ pinnedParticipantUserIds
10953
10971
  });
10954
10972
  let activeVideoStreams = 0;
@@ -11017,7 +11035,9 @@ const FloatingLocalVideoLayout = (props) => {
11017
11035
  /* @conditional-compile-remove(vertical-gallery) */
11018
11036
  veritcalGalleryStyles: styles === null || styles === void 0 ? void 0 : styles.verticalGallery,
11019
11037
  /* @conditional-compile-remove(vertical-gallery) */
11020
- overflowGalleryLayout: overflowGalleryLayout }));
11038
+ overflowGalleryLayout: overflowGalleryLayout, onChildrenPerPageChange: (n) => {
11039
+ childrenPerPage.current = n;
11040
+ } }));
11021
11041
  }, [
11022
11042
  isNarrow,
11023
11043
  /* @conditional-compile-remove(vertical-gallery) */ isShort,