@whereby.com/browser-sdk 3.33.4 → 3.34.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.
- package/dist/cdn/v3-react.js +2 -2
- package/dist/react/index.cjs +45 -26
- package/dist/react/index.d.ts +25 -1
- package/dist/react/index.esm.js +45 -27
- package/package.json +3 -3
package/dist/react/index.cjs
CHANGED
|
@@ -172,7 +172,7 @@ const VideoView = React__namespace.forwardRef((_a, ref) => {
|
|
|
172
172
|
});
|
|
173
173
|
VideoView.displayName = "VideoView";
|
|
174
174
|
|
|
175
|
-
const browserSdkVersion = "3.
|
|
175
|
+
const browserSdkVersion = "3.34.1";
|
|
176
176
|
|
|
177
177
|
const initialState$1 = {
|
|
178
178
|
chatMessages: [],
|
|
@@ -552,18 +552,20 @@ function getGridSizeForCount({ count, width, height, aspectRatio, }) {
|
|
|
552
552
|
}
|
|
553
553
|
|
|
554
554
|
function VideoCell(_a) {
|
|
555
|
-
var { aspectRatio, children, className, height, style, width, withRoundedCorners = false, withShadow = true } = _a, rest = __rest(_a, ["aspectRatio", "children", "className", "height", "style", "width", "withRoundedCorners", "withShadow"]);
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
let
|
|
559
|
-
let
|
|
560
|
-
|
|
555
|
+
var { aspectRatio, children, className, height, paddings, style, width, withRoundedCorners = false, withShadow = true } = _a, rest = __rest(_a, ["aspectRatio", "children", "className", "height", "paddings", "style", "width", "withRoundedCorners", "withShadow"]);
|
|
556
|
+
const innerWidth = Math.max(0, width - ((paddings === null || paddings === void 0 ? void 0 : paddings.left) || 0) - ((paddings === null || paddings === void 0 ? void 0 : paddings.right) || 0));
|
|
557
|
+
const innerHeight = Math.max(0, height - ((paddings === null || paddings === void 0 ? void 0 : paddings.top) || 0) - ((paddings === null || paddings === void 0 ? void 0 : paddings.bottom) || 0));
|
|
558
|
+
let contentWidth = innerWidth;
|
|
559
|
+
let contentHeight = innerHeight;
|
|
560
|
+
let leftOffset = (paddings === null || paddings === void 0 ? void 0 : paddings.left) || 0;
|
|
561
|
+
let topOffset = (paddings === null || paddings === void 0 ? void 0 : paddings.top) || 0;
|
|
562
|
+
if (aspectRatio && innerWidth && innerHeight) {
|
|
561
563
|
({ width: contentWidth, height: contentHeight } = fitToBounds(aspectRatio, {
|
|
562
|
-
width,
|
|
563
|
-
height,
|
|
564
|
+
width: innerWidth,
|
|
565
|
+
height: innerHeight,
|
|
564
566
|
}));
|
|
565
|
-
leftOffset
|
|
566
|
-
topOffset
|
|
567
|
+
leftOffset += (innerWidth - contentWidth) / 2;
|
|
568
|
+
topOffset += (innerHeight - contentHeight) / 2;
|
|
567
569
|
}
|
|
568
570
|
const contentStyle = Object.assign({ width: `${Math.round(contentWidth)}px`, height: `${Math.round(contentHeight)}px` }, (leftOffset || topOffset
|
|
569
571
|
? { transform: `translate3d(${Math.round(leftOffset)}px, ${Math.round(topOffset)}px, 0)` }
|
|
@@ -585,7 +587,7 @@ function generateStylesFromFrame({ origin, bounds }) {
|
|
|
585
587
|
}
|
|
586
588
|
function renderVideoCell({ cell, child, clientId, style = {}, withRoundedCorners = false, withShadow = false, }) {
|
|
587
589
|
const isHidden = !hasBounds(cell.bounds);
|
|
588
|
-
return (React__namespace.createElement(VideoCell, { width: cell.bounds.width, height: cell.bounds.height, aspectRatio: cell.aspectRatio, style: isHidden ? { width: 0, height: 0 } : style, withRoundedCorners: withRoundedCorners, withShadow: withShadow, key: clientId }, child));
|
|
590
|
+
return (React__namespace.createElement(VideoCell, { width: cell.bounds.width, height: cell.bounds.height, aspectRatio: cell.aspectRatio, paddings: cell.paddings, style: isHidden ? { width: 0, height: 0 } : style, withRoundedCorners: withRoundedCorners, withShadow: withShadow, key: clientId }, child));
|
|
589
591
|
}
|
|
590
592
|
function renderSubgridVideoCells({ content, stageLayout, withRoundedCorners, withShadow, }) {
|
|
591
593
|
const cells = stageLayout.subgrid.cells;
|
|
@@ -1592,8 +1594,8 @@ function calculateStageLayout({ cellPaddings, cellSizeOptions, containerBounds,
|
|
|
1592
1594
|
isPortrait,
|
|
1593
1595
|
videosContainer: makeFrame(Object.assign(Object.assign({}, videosContainerBounds), videosContainerOrigin)),
|
|
1594
1596
|
subgrid: Object.assign(Object.assign({}, makeFrame(Object.assign(Object.assign({}, subgridBounds), subgridOrigin))), { cells: subgridLayout.videoCells.map((cell, index) => {
|
|
1595
|
-
var _a
|
|
1596
|
-
return (Object.assign({ aspectRatio:
|
|
1597
|
+
var _a;
|
|
1598
|
+
return (Object.assign({ aspectRatio: 1, type: "video", clientId: (_a = subgridVideos[index]) === null || _a === void 0 ? void 0 : _a.clientId }, cell));
|
|
1597
1599
|
}), contentBounds: subgridLayout.contentBounds }),
|
|
1598
1600
|
hasOverflow: hasOverflow || shouldOverflowSubgrid || hasConstrainedOverflow,
|
|
1599
1601
|
overflowNeedBounds: shouldOverflowSubgrid ? makeBounds() : overflowNeedBounds,
|
|
@@ -2100,11 +2102,16 @@ function calculateSubgridViews({ clientViews, activeVideosSubgridTrigger, should
|
|
|
2100
2102
|
return [];
|
|
2101
2103
|
}
|
|
2102
2104
|
const hasSpotlights = spotlightedParticipants.length > 0;
|
|
2103
|
-
const
|
|
2105
|
+
const hasMaximized = !!maximizedCellId && clientViews.some((client) => client.id === maximizedCellId);
|
|
2106
|
+
const hasPresentationStage = hasSpotlights || hasStagedIntegration || hasMaximized;
|
|
2104
2107
|
const notMaximized = maximizedCellId ? clientViews.filter((client) => client.id !== maximizedCellId) : clientViews;
|
|
2105
2108
|
const notSpotlighted = notMaximized.filter((client) => !client.isPresentation && !spotlightedParticipants.includes(client));
|
|
2106
2109
|
const noVideoViews = notSpotlighted.filter((client) => !client.isVideoEnabled);
|
|
2107
2110
|
const videoLimitReached = notSpotlighted.filter((client) => client.isVideoEnabled).length > activeVideosSubgridTrigger;
|
|
2111
|
+
if (isPhoneResolution && hasPresentationStage) {
|
|
2112
|
+
const offStage = hasSpotlights && !hasStagedIntegration && !hasMaximized ? notSpotlighted : notMaximized;
|
|
2113
|
+
return [...offStage.filter((client) => !noVideoViews.includes(client)), ...noVideoViews];
|
|
2114
|
+
}
|
|
2108
2115
|
const unmutedVideos = notSpotlighted.filter((client) => !noVideoViews.includes(client) && client.isAudioEnabled);
|
|
2109
2116
|
const mutedVideos = notSpotlighted.filter((client) => !noVideoViews.includes(client) && !client.isAudioEnabled);
|
|
2110
2117
|
if (noVideoViews.length && hasPresentationStage) {
|
|
@@ -2262,6 +2269,16 @@ function useGrid({ activeVideosSubgridTrigger, forceSubgrid, stageParticipantLim
|
|
|
2262
2269
|
isConstrained: !!enableConstrainedGrid && !!isConstrained,
|
|
2263
2270
|
includeIntegrations,
|
|
2264
2271
|
});
|
|
2272
|
+
React__namespace.useEffect(() => {
|
|
2273
|
+
if (maximizedCellId && !maximizedClientView) {
|
|
2274
|
+
setMaximizedCellId(null);
|
|
2275
|
+
}
|
|
2276
|
+
}, [maximizedCellId, maximizedClientView]);
|
|
2277
|
+
React__namespace.useEffect(() => {
|
|
2278
|
+
if (floatingCellId && !floatingClientView) {
|
|
2279
|
+
setFloatingCellId(null);
|
|
2280
|
+
}
|
|
2281
|
+
}, [floatingCellId, floatingClientView]);
|
|
2265
2282
|
const cellViewsFloating = React__namespace.useMemo(() => {
|
|
2266
2283
|
return floatingClientView
|
|
2267
2284
|
? [
|
|
@@ -2401,8 +2418,9 @@ function Avatar(_a) {
|
|
|
2401
2418
|
} }))));
|
|
2402
2419
|
}
|
|
2403
2420
|
|
|
2404
|
-
function VideoMutedIndicator({ avatarUrl, displayName, isSmallCell, withRoundedCorners, stream, muted }) {
|
|
2421
|
+
function VideoMutedIndicator({ avatarSize, avatarUrl, displayName, isSmallCell, withRoundedCorners, stream, muted, }) {
|
|
2405
2422
|
const audioElRef = useAudioElement({ stream, muted });
|
|
2423
|
+
const size = avatarSize !== null && avatarSize !== void 0 ? avatarSize : (isSmallCell ? 60 : 80);
|
|
2406
2424
|
return (React__namespace.createElement(React__namespace.Fragment, null,
|
|
2407
2425
|
React__namespace.createElement("div", { style: {
|
|
2408
2426
|
display: "flex",
|
|
@@ -2417,12 +2435,12 @@ function VideoMutedIndicator({ avatarUrl, displayName, isSmallCell, withRoundedC
|
|
|
2417
2435
|
borderRadius: withRoundedCorners ? "8px" : "0",
|
|
2418
2436
|
} },
|
|
2419
2437
|
React__namespace.createElement("div", { style: {
|
|
2420
|
-
height:
|
|
2421
|
-
width:
|
|
2438
|
+
height: size,
|
|
2439
|
+
width: size,
|
|
2422
2440
|
pointerEvents: "none",
|
|
2423
2441
|
position: "relative",
|
|
2424
2442
|
} },
|
|
2425
|
-
React__namespace.createElement(Avatar, { variant: "square", avatarUrl: avatarUrl, name: displayName, size:
|
|
2443
|
+
React__namespace.createElement(Avatar, { variant: "square", avatarUrl: avatarUrl, name: displayName, size: size }))),
|
|
2426
2444
|
React__namespace.createElement("audio", { ref: audioElRef, autoPlay: true, playsInline: true })));
|
|
2427
2445
|
}
|
|
2428
2446
|
|
|
@@ -2436,7 +2454,7 @@ const PopoverContent = React__namespace.forwardRef((_a, ref) => {
|
|
|
2436
2454
|
PopoverContent.displayName = PopoverPrimitive__namespace.Content.displayName;
|
|
2437
2455
|
|
|
2438
2456
|
const GridContext = React__namespace.createContext({});
|
|
2439
|
-
const GridCellContext = React__namespace.createContext(
|
|
2457
|
+
const GridCellContext = React__namespace.createContext(null);
|
|
2440
2458
|
const useGridCell = () => {
|
|
2441
2459
|
const gridContext = React__namespace.useContext(GridContext);
|
|
2442
2460
|
const gridCellContext = React__namespace.useContext(GridCellContext);
|
|
@@ -2583,7 +2601,7 @@ function DefaultParticipantMenu({ participant }) {
|
|
|
2583
2601
|
isSpotlighted ? "Remove spotlight" : "Spotlight"))));
|
|
2584
2602
|
}
|
|
2585
2603
|
|
|
2586
|
-
const GridCell = React__namespace.forwardRef(({ className, participant, children }, ref) => {
|
|
2604
|
+
const GridCell = React__namespace.forwardRef(({ className, participant, cellId, avatarSize, children }, ref) => {
|
|
2587
2605
|
const [isHovered, setIsHovered] = React__namespace.useState(false);
|
|
2588
2606
|
const handleMouseEnter = React__namespace.useCallback(() => {
|
|
2589
2607
|
setIsHovered(true);
|
|
@@ -2591,14 +2609,14 @@ const GridCell = React__namespace.forwardRef(({ className, participant, children
|
|
|
2591
2609
|
const handleMouseLeave = React__namespace.useCallback(() => {
|
|
2592
2610
|
setIsHovered(false);
|
|
2593
2611
|
}, []);
|
|
2594
|
-
return (React__namespace.createElement(GridCellContext.Provider, { value: { participant, isHovered } },
|
|
2595
|
-
React__namespace.createElement("div", { ref: ref, className: className, onMouseEnter: handleMouseEnter, onMouseLeave: handleMouseLeave, style: { height: "100%", width: "100%" } }, children)));
|
|
2612
|
+
return (React__namespace.createElement(GridCellContext.Provider, { value: { participant, isHovered, avatarSize } },
|
|
2613
|
+
React__namespace.createElement("div", { ref: ref, "data-cell-id": cellId, className: className, onMouseEnter: handleMouseEnter, onMouseLeave: handleMouseLeave, style: { height: "100%", width: "100%" } }, children)));
|
|
2596
2614
|
});
|
|
2597
2615
|
GridCell.displayName = "GridCell";
|
|
2598
2616
|
const GridVideoView = React__namespace.forwardRef((_a, ref) => {
|
|
2599
2617
|
var { stream, style } = _a, rest = __rest(_a, ["stream", "style"]);
|
|
2600
2618
|
const videoEl = React__namespace.useRef(null);
|
|
2601
|
-
const { onSetClientAspectRatio, clientAspectRatios, participant, isConstrained } = useGridCell();
|
|
2619
|
+
const { onSetClientAspectRatio, clientAspectRatios, participant, isConstrained, avatarSize } = useGridCell();
|
|
2602
2620
|
if (!participant)
|
|
2603
2621
|
return null;
|
|
2604
2622
|
const aspectRatio = clientAspectRatios[participant.id];
|
|
@@ -2613,9 +2631,9 @@ const GridVideoView = React__namespace.forwardRef((_a, ref) => {
|
|
|
2613
2631
|
}, [clientAspectRatios, participant.id, onSetClientAspectRatio]);
|
|
2614
2632
|
const s = stream || participant.stream;
|
|
2615
2633
|
if (!s || !participant.isVideoEnabled) {
|
|
2616
|
-
return (React__namespace.createElement(VideoMutedIndicator, { isSmallCell: false, displayName: (participant === null || participant === void 0 ? void 0 : participant.displayName) || "Guest", withRoundedCorners: true, muted: participant.isLocalClient, stream: participant.stream }));
|
|
2634
|
+
return (React__namespace.createElement(VideoMutedIndicator, { isSmallCell: false, avatarSize: avatarSize, displayName: (participant === null || participant === void 0 ? void 0 : participant.displayName) || "Guest", withRoundedCorners: true, muted: participant.isLocalClient, stream: participant.stream }));
|
|
2617
2635
|
}
|
|
2618
|
-
return (React__namespace.createElement(VideoView, Object.assign({ ref: videoEl, style: Object.assign(Object.assign({ borderRadius: isConstrained ? 0 : "8px" }, (isConstrained ? { objectFit: "cover" } : {})), style), muted: participant.isLocalClient }, rest, { stream: s, onVideoResize: handleResize })));
|
|
2636
|
+
return (React__namespace.createElement(VideoView, Object.assign({ ref: videoEl, style: Object.assign(Object.assign({ borderRadius: isConstrained ? 0 : "8px" }, (isConstrained || avatarSize ? { objectFit: "cover" } : {})), style), muted: participant.isLocalClient }, rest, { stream: s, onVideoResize: handleResize })));
|
|
2619
2637
|
});
|
|
2620
2638
|
GridVideoView.displayName = "GridVideoView";
|
|
2621
2639
|
function renderCellView({ cellView, enableParticipantMenu, render, renderIntegration }) {
|
|
@@ -2847,6 +2865,7 @@ exports.VideoView = VideoView;
|
|
|
2847
2865
|
exports.WherebyProvider = Provider;
|
|
2848
2866
|
exports.subscribeToRoomIntegrationPicker = subscribeToRoomIntegrationPicker;
|
|
2849
2867
|
exports.useGrid = useGrid;
|
|
2868
|
+
exports.useGridCell = useGridCell;
|
|
2850
2869
|
exports.useLocalMedia = useLocalMedia;
|
|
2851
2870
|
exports.useRoomConnection = useRoomConnection;
|
|
2852
2871
|
exports.useRoomIntegrationPicker = useRoomIntegrationPicker;
|
package/dist/react/index.d.ts
CHANGED
|
@@ -229,9 +229,33 @@ type StageLayout = {
|
|
|
229
229
|
overflowNeedBounds?: Bounds;
|
|
230
230
|
};
|
|
231
231
|
|
|
232
|
+
declare const useGridCell: () => {
|
|
233
|
+
participant: ClientView;
|
|
234
|
+
isHovered: boolean;
|
|
235
|
+
avatarSize?: number;
|
|
236
|
+
onSetClientAspectRatio: ({ aspectRatio, clientId }: {
|
|
237
|
+
aspectRatio: number;
|
|
238
|
+
clientId: string;
|
|
239
|
+
}) => void;
|
|
240
|
+
cellViewsVideoGrid: CellView[];
|
|
241
|
+
cellViewsInPresentationGrid: CellView[];
|
|
242
|
+
cellViewsInSubgrid: CellView[];
|
|
243
|
+
clientAspectRatios: {
|
|
244
|
+
[key: string]: number;
|
|
245
|
+
};
|
|
246
|
+
maximizedCellId: string | null;
|
|
247
|
+
setMaximizedCellId: React.Dispatch<React.SetStateAction<string | null>>;
|
|
248
|
+
maximizedParticipant: ClientView | null;
|
|
249
|
+
floatingCellId: string | null;
|
|
250
|
+
setFloatingCellId: React.Dispatch<React.SetStateAction<string | null>>;
|
|
251
|
+
floatingParticipant: ClientView | null;
|
|
252
|
+
isConstrained?: boolean;
|
|
253
|
+
};
|
|
254
|
+
|
|
232
255
|
type GridCellSelfProps = {
|
|
233
256
|
participant: ClientView;
|
|
234
257
|
cellId?: string;
|
|
258
|
+
avatarSize?: number;
|
|
235
259
|
};
|
|
236
260
|
type GridCellProps = GridCellSelfProps & React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>;
|
|
237
261
|
declare const GridCell: React.ForwardRefExoticComponent<Omit<GridCellProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -354,5 +378,5 @@ declare function subscribeToRoomIntegrationPicker({ pickerOrigin, getSource, onO
|
|
|
354
378
|
onOutcome: (outcome: RoomIntegrationPickerOutcome) => void;
|
|
355
379
|
}): () => void;
|
|
356
380
|
|
|
357
|
-
export { GridCell, GridVideoView, ParticipantMenu, ParticipantMenuContent, ParticipantMenuItem, ParticipantMenuTrigger, Grid as VideoGrid, VideoView, Provider as WherebyProvider, subscribeToRoomIntegrationPicker, useGrid, useLocalMedia, useRoomConnection, useRoomIntegrationPicker, useRoomIntegrationView };
|
|
381
|
+
export { GridCell, GridVideoView, ParticipantMenu, ParticipantMenuContent, ParticipantMenuItem, ParticipantMenuTrigger, Grid as VideoGrid, VideoView, Provider as WherebyProvider, subscribeToRoomIntegrationPicker, useGrid, useGridCell, useLocalMedia, useRoomConnection, useRoomIntegrationPicker, useRoomIntegrationView };
|
|
358
382
|
export type { CellView, IntegrationCellView, RoomConnectionActions, RoomConnectionOptions, RoomIntegrationIframeProps, RoomIntegrationPickerOutcome, UseLocalMediaResult, UseRoomIntegrationPickerOptions, UseRoomIntegrationPickerResult, UseRoomIntegrationViewOptions, UseRoomIntegrationViewResult, VideoCellView };
|
package/dist/react/index.esm.js
CHANGED
|
@@ -151,7 +151,7 @@ const VideoView = React.forwardRef((_a, ref) => {
|
|
|
151
151
|
});
|
|
152
152
|
VideoView.displayName = "VideoView";
|
|
153
153
|
|
|
154
|
-
const browserSdkVersion = "3.
|
|
154
|
+
const browserSdkVersion = "3.34.1";
|
|
155
155
|
|
|
156
156
|
const initialState$1 = {
|
|
157
157
|
chatMessages: [],
|
|
@@ -531,18 +531,20 @@ function getGridSizeForCount({ count, width, height, aspectRatio, }) {
|
|
|
531
531
|
}
|
|
532
532
|
|
|
533
533
|
function VideoCell(_a) {
|
|
534
|
-
var { aspectRatio, children, className, height, style, width, withRoundedCorners = false, withShadow = true } = _a, rest = __rest(_a, ["aspectRatio", "children", "className", "height", "style", "width", "withRoundedCorners", "withShadow"]);
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
let
|
|
538
|
-
let
|
|
539
|
-
|
|
534
|
+
var { aspectRatio, children, className, height, paddings, style, width, withRoundedCorners = false, withShadow = true } = _a, rest = __rest(_a, ["aspectRatio", "children", "className", "height", "paddings", "style", "width", "withRoundedCorners", "withShadow"]);
|
|
535
|
+
const innerWidth = Math.max(0, width - ((paddings === null || paddings === void 0 ? void 0 : paddings.left) || 0) - ((paddings === null || paddings === void 0 ? void 0 : paddings.right) || 0));
|
|
536
|
+
const innerHeight = Math.max(0, height - ((paddings === null || paddings === void 0 ? void 0 : paddings.top) || 0) - ((paddings === null || paddings === void 0 ? void 0 : paddings.bottom) || 0));
|
|
537
|
+
let contentWidth = innerWidth;
|
|
538
|
+
let contentHeight = innerHeight;
|
|
539
|
+
let leftOffset = (paddings === null || paddings === void 0 ? void 0 : paddings.left) || 0;
|
|
540
|
+
let topOffset = (paddings === null || paddings === void 0 ? void 0 : paddings.top) || 0;
|
|
541
|
+
if (aspectRatio && innerWidth && innerHeight) {
|
|
540
542
|
({ width: contentWidth, height: contentHeight } = fitToBounds(aspectRatio, {
|
|
541
|
-
width,
|
|
542
|
-
height,
|
|
543
|
+
width: innerWidth,
|
|
544
|
+
height: innerHeight,
|
|
543
545
|
}));
|
|
544
|
-
leftOffset
|
|
545
|
-
topOffset
|
|
546
|
+
leftOffset += (innerWidth - contentWidth) / 2;
|
|
547
|
+
topOffset += (innerHeight - contentHeight) / 2;
|
|
546
548
|
}
|
|
547
549
|
const contentStyle = Object.assign({ width: `${Math.round(contentWidth)}px`, height: `${Math.round(contentHeight)}px` }, (leftOffset || topOffset
|
|
548
550
|
? { transform: `translate3d(${Math.round(leftOffset)}px, ${Math.round(topOffset)}px, 0)` }
|
|
@@ -564,7 +566,7 @@ function generateStylesFromFrame({ origin, bounds }) {
|
|
|
564
566
|
}
|
|
565
567
|
function renderVideoCell({ cell, child, clientId, style = {}, withRoundedCorners = false, withShadow = false, }) {
|
|
566
568
|
const isHidden = !hasBounds(cell.bounds);
|
|
567
|
-
return (React.createElement(VideoCell, { width: cell.bounds.width, height: cell.bounds.height, aspectRatio: cell.aspectRatio, style: isHidden ? { width: 0, height: 0 } : style, withRoundedCorners: withRoundedCorners, withShadow: withShadow, key: clientId }, child));
|
|
569
|
+
return (React.createElement(VideoCell, { width: cell.bounds.width, height: cell.bounds.height, aspectRatio: cell.aspectRatio, paddings: cell.paddings, style: isHidden ? { width: 0, height: 0 } : style, withRoundedCorners: withRoundedCorners, withShadow: withShadow, key: clientId }, child));
|
|
568
570
|
}
|
|
569
571
|
function renderSubgridVideoCells({ content, stageLayout, withRoundedCorners, withShadow, }) {
|
|
570
572
|
const cells = stageLayout.subgrid.cells;
|
|
@@ -1571,8 +1573,8 @@ function calculateStageLayout({ cellPaddings, cellSizeOptions, containerBounds,
|
|
|
1571
1573
|
isPortrait,
|
|
1572
1574
|
videosContainer: makeFrame(Object.assign(Object.assign({}, videosContainerBounds), videosContainerOrigin)),
|
|
1573
1575
|
subgrid: Object.assign(Object.assign({}, makeFrame(Object.assign(Object.assign({}, subgridBounds), subgridOrigin))), { cells: subgridLayout.videoCells.map((cell, index) => {
|
|
1574
|
-
var _a
|
|
1575
|
-
return (Object.assign({ aspectRatio:
|
|
1576
|
+
var _a;
|
|
1577
|
+
return (Object.assign({ aspectRatio: 1, type: "video", clientId: (_a = subgridVideos[index]) === null || _a === void 0 ? void 0 : _a.clientId }, cell));
|
|
1576
1578
|
}), contentBounds: subgridLayout.contentBounds }),
|
|
1577
1579
|
hasOverflow: hasOverflow || shouldOverflowSubgrid || hasConstrainedOverflow,
|
|
1578
1580
|
overflowNeedBounds: shouldOverflowSubgrid ? makeBounds() : overflowNeedBounds,
|
|
@@ -2079,11 +2081,16 @@ function calculateSubgridViews({ clientViews, activeVideosSubgridTrigger, should
|
|
|
2079
2081
|
return [];
|
|
2080
2082
|
}
|
|
2081
2083
|
const hasSpotlights = spotlightedParticipants.length > 0;
|
|
2082
|
-
const
|
|
2084
|
+
const hasMaximized = !!maximizedCellId && clientViews.some((client) => client.id === maximizedCellId);
|
|
2085
|
+
const hasPresentationStage = hasSpotlights || hasStagedIntegration || hasMaximized;
|
|
2083
2086
|
const notMaximized = maximizedCellId ? clientViews.filter((client) => client.id !== maximizedCellId) : clientViews;
|
|
2084
2087
|
const notSpotlighted = notMaximized.filter((client) => !client.isPresentation && !spotlightedParticipants.includes(client));
|
|
2085
2088
|
const noVideoViews = notSpotlighted.filter((client) => !client.isVideoEnabled);
|
|
2086
2089
|
const videoLimitReached = notSpotlighted.filter((client) => client.isVideoEnabled).length > activeVideosSubgridTrigger;
|
|
2090
|
+
if (isPhoneResolution && hasPresentationStage) {
|
|
2091
|
+
const offStage = hasSpotlights && !hasStagedIntegration && !hasMaximized ? notSpotlighted : notMaximized;
|
|
2092
|
+
return [...offStage.filter((client) => !noVideoViews.includes(client)), ...noVideoViews];
|
|
2093
|
+
}
|
|
2087
2094
|
const unmutedVideos = notSpotlighted.filter((client) => !noVideoViews.includes(client) && client.isAudioEnabled);
|
|
2088
2095
|
const mutedVideos = notSpotlighted.filter((client) => !noVideoViews.includes(client) && !client.isAudioEnabled);
|
|
2089
2096
|
if (noVideoViews.length && hasPresentationStage) {
|
|
@@ -2241,6 +2248,16 @@ function useGrid({ activeVideosSubgridTrigger, forceSubgrid, stageParticipantLim
|
|
|
2241
2248
|
isConstrained: !!enableConstrainedGrid && !!isConstrained,
|
|
2242
2249
|
includeIntegrations,
|
|
2243
2250
|
});
|
|
2251
|
+
React.useEffect(() => {
|
|
2252
|
+
if (maximizedCellId && !maximizedClientView) {
|
|
2253
|
+
setMaximizedCellId(null);
|
|
2254
|
+
}
|
|
2255
|
+
}, [maximizedCellId, maximizedClientView]);
|
|
2256
|
+
React.useEffect(() => {
|
|
2257
|
+
if (floatingCellId && !floatingClientView) {
|
|
2258
|
+
setFloatingCellId(null);
|
|
2259
|
+
}
|
|
2260
|
+
}, [floatingCellId, floatingClientView]);
|
|
2244
2261
|
const cellViewsFloating = React.useMemo(() => {
|
|
2245
2262
|
return floatingClientView
|
|
2246
2263
|
? [
|
|
@@ -2380,8 +2397,9 @@ function Avatar(_a) {
|
|
|
2380
2397
|
} }))));
|
|
2381
2398
|
}
|
|
2382
2399
|
|
|
2383
|
-
function VideoMutedIndicator({ avatarUrl, displayName, isSmallCell, withRoundedCorners, stream, muted }) {
|
|
2400
|
+
function VideoMutedIndicator({ avatarSize, avatarUrl, displayName, isSmallCell, withRoundedCorners, stream, muted, }) {
|
|
2384
2401
|
const audioElRef = useAudioElement({ stream, muted });
|
|
2402
|
+
const size = avatarSize !== null && avatarSize !== void 0 ? avatarSize : (isSmallCell ? 60 : 80);
|
|
2385
2403
|
return (React.createElement(React.Fragment, null,
|
|
2386
2404
|
React.createElement("div", { style: {
|
|
2387
2405
|
display: "flex",
|
|
@@ -2396,12 +2414,12 @@ function VideoMutedIndicator({ avatarUrl, displayName, isSmallCell, withRoundedC
|
|
|
2396
2414
|
borderRadius: withRoundedCorners ? "8px" : "0",
|
|
2397
2415
|
} },
|
|
2398
2416
|
React.createElement("div", { style: {
|
|
2399
|
-
height:
|
|
2400
|
-
width:
|
|
2417
|
+
height: size,
|
|
2418
|
+
width: size,
|
|
2401
2419
|
pointerEvents: "none",
|
|
2402
2420
|
position: "relative",
|
|
2403
2421
|
} },
|
|
2404
|
-
React.createElement(Avatar, { variant: "square", avatarUrl: avatarUrl, name: displayName, size:
|
|
2422
|
+
React.createElement(Avatar, { variant: "square", avatarUrl: avatarUrl, name: displayName, size: size }))),
|
|
2405
2423
|
React.createElement("audio", { ref: audioElRef, autoPlay: true, playsInline: true })));
|
|
2406
2424
|
}
|
|
2407
2425
|
|
|
@@ -2415,7 +2433,7 @@ const PopoverContent = React.forwardRef((_a, ref) => {
|
|
|
2415
2433
|
PopoverContent.displayName = PopoverPrimitive.Content.displayName;
|
|
2416
2434
|
|
|
2417
2435
|
const GridContext = React.createContext({});
|
|
2418
|
-
const GridCellContext = React.createContext(
|
|
2436
|
+
const GridCellContext = React.createContext(null);
|
|
2419
2437
|
const useGridCell = () => {
|
|
2420
2438
|
const gridContext = React.useContext(GridContext);
|
|
2421
2439
|
const gridCellContext = React.useContext(GridCellContext);
|
|
@@ -2562,7 +2580,7 @@ function DefaultParticipantMenu({ participant }) {
|
|
|
2562
2580
|
isSpotlighted ? "Remove spotlight" : "Spotlight"))));
|
|
2563
2581
|
}
|
|
2564
2582
|
|
|
2565
|
-
const GridCell = React.forwardRef(({ className, participant, children }, ref) => {
|
|
2583
|
+
const GridCell = React.forwardRef(({ className, participant, cellId, avatarSize, children }, ref) => {
|
|
2566
2584
|
const [isHovered, setIsHovered] = React.useState(false);
|
|
2567
2585
|
const handleMouseEnter = React.useCallback(() => {
|
|
2568
2586
|
setIsHovered(true);
|
|
@@ -2570,14 +2588,14 @@ const GridCell = React.forwardRef(({ className, participant, children }, ref) =>
|
|
|
2570
2588
|
const handleMouseLeave = React.useCallback(() => {
|
|
2571
2589
|
setIsHovered(false);
|
|
2572
2590
|
}, []);
|
|
2573
|
-
return (React.createElement(GridCellContext.Provider, { value: { participant, isHovered } },
|
|
2574
|
-
React.createElement("div", { ref: ref, className: className, onMouseEnter: handleMouseEnter, onMouseLeave: handleMouseLeave, style: { height: "100%", width: "100%" } }, children)));
|
|
2591
|
+
return (React.createElement(GridCellContext.Provider, { value: { participant, isHovered, avatarSize } },
|
|
2592
|
+
React.createElement("div", { ref: ref, "data-cell-id": cellId, className: className, onMouseEnter: handleMouseEnter, onMouseLeave: handleMouseLeave, style: { height: "100%", width: "100%" } }, children)));
|
|
2575
2593
|
});
|
|
2576
2594
|
GridCell.displayName = "GridCell";
|
|
2577
2595
|
const GridVideoView = React.forwardRef((_a, ref) => {
|
|
2578
2596
|
var { stream, style } = _a, rest = __rest(_a, ["stream", "style"]);
|
|
2579
2597
|
const videoEl = React.useRef(null);
|
|
2580
|
-
const { onSetClientAspectRatio, clientAspectRatios, participant, isConstrained } = useGridCell();
|
|
2598
|
+
const { onSetClientAspectRatio, clientAspectRatios, participant, isConstrained, avatarSize } = useGridCell();
|
|
2581
2599
|
if (!participant)
|
|
2582
2600
|
return null;
|
|
2583
2601
|
const aspectRatio = clientAspectRatios[participant.id];
|
|
@@ -2592,9 +2610,9 @@ const GridVideoView = React.forwardRef((_a, ref) => {
|
|
|
2592
2610
|
}, [clientAspectRatios, participant.id, onSetClientAspectRatio]);
|
|
2593
2611
|
const s = stream || participant.stream;
|
|
2594
2612
|
if (!s || !participant.isVideoEnabled) {
|
|
2595
|
-
return (React.createElement(VideoMutedIndicator, { isSmallCell: false, displayName: (participant === null || participant === void 0 ? void 0 : participant.displayName) || "Guest", withRoundedCorners: true, muted: participant.isLocalClient, stream: participant.stream }));
|
|
2613
|
+
return (React.createElement(VideoMutedIndicator, { isSmallCell: false, avatarSize: avatarSize, displayName: (participant === null || participant === void 0 ? void 0 : participant.displayName) || "Guest", withRoundedCorners: true, muted: participant.isLocalClient, stream: participant.stream }));
|
|
2596
2614
|
}
|
|
2597
|
-
return (React.createElement(VideoView, Object.assign({ ref: videoEl, style: Object.assign(Object.assign({ borderRadius: isConstrained ? 0 : "8px" }, (isConstrained ? { objectFit: "cover" } : {})), style), muted: participant.isLocalClient }, rest, { stream: s, onVideoResize: handleResize })));
|
|
2615
|
+
return (React.createElement(VideoView, Object.assign({ ref: videoEl, style: Object.assign(Object.assign({ borderRadius: isConstrained ? 0 : "8px" }, (isConstrained || avatarSize ? { objectFit: "cover" } : {})), style), muted: participant.isLocalClient }, rest, { stream: s, onVideoResize: handleResize })));
|
|
2598
2616
|
});
|
|
2599
2617
|
GridVideoView.displayName = "GridVideoView";
|
|
2600
2618
|
function renderCellView({ cellView, enableParticipantMenu, render, renderIntegration }) {
|
|
@@ -2779,4 +2797,4 @@ function useRoomIntegrationPicker({ integration, onPicked, onCancel, onError, fe
|
|
|
2779
2797
|
};
|
|
2780
2798
|
}
|
|
2781
2799
|
|
|
2782
|
-
export { GridCell, GridVideoView, ParticipantMenu, ParticipantMenuContent, ParticipantMenuItem, ParticipantMenuTrigger, Grid as VideoGrid, VideoView, Provider as WherebyProvider, subscribeToRoomIntegrationPicker, useGrid, useLocalMedia, useRoomConnection, useRoomIntegrationPicker, useRoomIntegrationView };
|
|
2800
|
+
export { GridCell, GridVideoView, ParticipantMenu, ParticipantMenuContent, ParticipantMenuItem, ParticipantMenuTrigger, Grid as VideoGrid, VideoView, Provider as WherebyProvider, subscribeToRoomIntegrationPicker, useGrid, useGridCell, useLocalMedia, useRoomConnection, useRoomIntegrationPicker, useRoomIntegrationView };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@whereby.com/browser-sdk",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.34.1",
|
|
4
4
|
"description": "Modules for integration Whereby video in web apps",
|
|
5
5
|
"author": "Whereby AS",
|
|
6
6
|
"license": "MIT",
|
|
@@ -68,8 +68,8 @@
|
|
|
68
68
|
"@whereby.com/eslint-config": "0.1.0",
|
|
69
69
|
"@whereby.com/jest-config": "0.1.0",
|
|
70
70
|
"@whereby.com/prettier-config": "0.1.0",
|
|
71
|
-
"@whereby.com/
|
|
72
|
-
"@whereby.com/
|
|
71
|
+
"@whereby.com/tsconfig": "0.1.0",
|
|
72
|
+
"@whereby.com/rollup-config": "0.1.1"
|
|
73
73
|
},
|
|
74
74
|
"dependencies": {
|
|
75
75
|
"@radix-ui/react-popover": "^1.0.7",
|