@whereby.com/browser-sdk 3.0.0 → 3.0.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.
@@ -177,6 +177,6 @@ interface GridProps {
177
177
  videoGridGap?: number;
178
178
  stageParticipantLimit?: number;
179
179
  }
180
- declare function Grid({ renderParticipant, stageParticipantLimit }: GridProps): React.JSX.Element;
180
+ declare function Grid({ renderParticipant, stageParticipantLimit, videoGridGap }: GridProps): React.JSX.Element;
181
181
 
182
182
  export { type ChatMessageState as ChatMessage, type LocalParticipantState as LocalParticipant, type RemoteParticipantState as RemoteParticipant, type RoomConnectionState as RoomConnection, type ScreenshareState as Screenshare, type UseLocalMediaResult, Grid as VideoGrid, VideoView, type WaitingParticipantState as WaitingParticipant, Provider as WherebyProvider, useLocalMedia, useRoomConnection };
@@ -145,7 +145,7 @@ const selectRoomConnectionState = createSelector(selectChatMessages, selectCloud
145
145
  return state;
146
146
  });
147
147
 
148
- const browserSdkVersion = "3.0.0";
148
+ const browserSdkVersion = "3.0.1";
149
149
 
150
150
  const defaultRoomConnectionOptions = {
151
151
  localMediaOptions: {
@@ -1513,8 +1513,8 @@ function useGridParticipants({ activeVideosSubgridTrigger = ACTIVE_VIDEO_SUBGRID
1513
1513
  return allClientViews.filter((client) => !clientViewsInSubgrid.includes(client));
1514
1514
  }, [allClientViews, clientViewsInSubgrid]);
1515
1515
  const clientViewsInPresentationGrid = React.useMemo(() => {
1516
- return allClientViews.filter((client) => client.isPresentation).concat(spotlightedParticipants);
1517
- }, [allClientViews, spotlightedParticipants]);
1516
+ return spotlightedParticipants;
1517
+ }, [spotlightedParticipants]);
1518
1518
  const clientViewsInGrid = React.useMemo(() => {
1519
1519
  return clientViewsOnStage.filter((client) => !clientViewsInPresentationGrid.includes(client));
1520
1520
  }, [clientViewsOnStage, clientViewsInPresentationGrid]);
@@ -1525,7 +1525,7 @@ function useGridParticipants({ activeVideosSubgridTrigger = ACTIVE_VIDEO_SUBGRID
1525
1525
  };
1526
1526
  }
1527
1527
 
1528
- function useGrid({ activeVideosSubgridTrigger, forceSubgrid, stageParticipantLimit = STAGE_PARTICIPANT_LIMIT, } = {}) {
1528
+ function useGrid({ activeVideosSubgridTrigger, forceSubgrid, stageParticipantLimit = STAGE_PARTICIPANT_LIMIT, videoGridGap = 8, } = {}) {
1529
1529
  const [containerBounds, setContainerBounds] = React.useState({ width: 0, height: 0 });
1530
1530
  const [clientAspectRatios, setClientAspectRatios] = React.useState({});
1531
1531
  const { clientViewsInGrid, clientViewsInPresentationGrid, clientViewsInSubgrid } = useGridParticipants({
@@ -1574,7 +1574,7 @@ function useGrid({ activeVideosSubgridTrigger, forceSubgrid, stageParticipantLim
1574
1574
  isConstrained: false,
1575
1575
  roomBounds: containerFrame.bounds,
1576
1576
  videos: cellViewsVideoGrid,
1577
- videoGridGap: 0,
1577
+ videoGridGap,
1578
1578
  presentationVideos: cellViewsInPresentationGrid,
1579
1579
  subgridVideos: cellViewsInSubgrid,
1580
1580
  });
@@ -1653,21 +1653,19 @@ function renderCellView({ cellView, onSetClientAspectRatio }) {
1653
1653
  return (React.createElement(GridVideoCellView, { aspectRatio: cellView.aspectRatio, participant: cellView.client, isPlaceholder: cellView.isPlaceholder, isSubgrid: cellView.isSubgrid, key: cellView.clientId, onSetClientAspectRatio: onSetClientAspectRatio }));
1654
1654
  }
1655
1655
  }
1656
- function GridVideoCellView({ aspectRatio, participant, render, onSetClientAspectRatio }) {
1656
+ function GridVideoCellView({ aspectRatio, participant, render }) {
1657
1657
  const videoEl = React.useRef(null);
1658
1658
  const handleResize = React.useCallback(() => {
1659
1659
  const ar = videoEl.current && videoEl.current.captureAspectRatio();
1660
- if (ar && ar !== aspectRatio && (participant === null || participant === void 0 ? void 0 : participant.id)) {
1661
- onSetClientAspectRatio({ aspectRatio: ar, clientId: participant.id });
1662
- }
1660
+ if (ar && ar !== aspectRatio && (participant === null || participant === void 0 ? void 0 : participant.id)) ;
1663
1661
  }, []);
1664
1662
  return (React.createElement("div", null, render ? (render()) : (participant === null || participant === void 0 ? void 0 : participant.stream) && participant.isVideoEnabled ? (React.createElement(VideoView, { ref: videoEl, stream: participant.stream, onVideoResize: handleResize, style: {
1665
1663
  borderRadius: "8px",
1666
1664
  } })) : (React.createElement(VideoMutedIndicator, { isSmallCell: false, displayName: (participant === null || participant === void 0 ? void 0 : participant.displayName) || "Guest", withRoundedCorners: true }))));
1667
1665
  }
1668
- function Grid({ renderParticipant, stageParticipantLimit }) {
1666
+ function Grid({ renderParticipant, stageParticipantLimit, videoGridGap }) {
1669
1667
  const gridRef = React.useRef(null);
1670
- const { cellViewsVideoGrid, cellViewsInPresentationGrid, cellViewsInSubgrid, videoStage, setContainerBounds, setClientAspectRatios, } = useGrid({ activeVideosSubgridTrigger: 12, stageParticipantLimit });
1668
+ const { cellViewsVideoGrid, cellViewsInPresentationGrid, cellViewsInSubgrid, videoStage, setContainerBounds, setClientAspectRatios, } = useGrid({ activeVideosSubgridTrigger: 12, stageParticipantLimit, videoGridGap });
1671
1669
  const presentationGridContent = React.useMemo(() => cellViewsInPresentationGrid.map((cellView) => renderCellView({
1672
1670
  cellView,
1673
1671
  onSetClientAspectRatio: ({ aspectRatio, clientId }) => setClientAspectRatios((prev) => (Object.assign(Object.assign({}, prev), { [clientId]: aspectRatio }))),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@whereby.com/browser-sdk",
3
- "version": "3.0.0",
3
+ "version": "3.0.1",
4
4
  "description": "Modules for integration Whereby video in web apps",
5
5
  "author": "Whereby AS",
6
6
  "license": "MIT",