@stream-io/video-react-sdk 1.14.0 → 1.14.2

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/index.cjs.js CHANGED
@@ -359,6 +359,7 @@ const MenuToggle = ({ ToggleButton, placement = 'top-start', strategy = 'absolut
359
359
  offset,
360
360
  });
361
361
  react.useEffect(() => {
362
+ const parentDocument = domReference?.ownerDocument;
362
363
  const handleClick = (event) => {
363
364
  if (!floating && domReference?.contains(event.target)) {
364
365
  setMenuShown(true);
@@ -378,11 +379,13 @@ const MenuToggle = ({ ToggleButton, placement = 'top-start', strategy = 'absolut
378
379
  toggleHandler.current?.(false);
379
380
  }
380
381
  };
381
- document?.addEventListener('click', handleClick, { capture: true });
382
- document?.addEventListener('keydown', handleKeyDown);
382
+ parentDocument?.addEventListener('click', handleClick, { capture: true });
383
+ parentDocument?.addEventListener('keydown', handleKeyDown);
383
384
  return () => {
384
- document?.removeEventListener('click', handleClick, { capture: true });
385
- document?.removeEventListener('keydown', handleKeyDown);
385
+ parentDocument?.removeEventListener('click', handleClick, {
386
+ capture: true,
387
+ });
388
+ parentDocument?.removeEventListener('keydown', handleKeyDown);
386
389
  };
387
390
  }, [floating, domReference]);
388
391
  return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [menuShown && (jsxRuntime.jsx(MenuContext.Provider, { value: { close: () => setMenuShown(false) }, children: visualType === exports.MenuVisualType.PORTAL ? (jsxRuntime.jsx(MenuPortal, { refs: refs, children: children })) : visualType === exports.MenuVisualType.MENU ? (jsxRuntime.jsx("div", { className: "str-video__menu-container", ref: refs.setFloating, style: {
@@ -2364,6 +2367,8 @@ const applyParticipantsFilter = (participants, filter) => {
2364
2367
  name: participant.name,
2365
2368
  roles: participant.roles,
2366
2369
  isPinned: videoClient.isPinned(participant),
2370
+ hasVideo: videoClient.hasVideo(participant),
2371
+ hasAudio: videoClient.hasAudio(participant),
2367
2372
  }, filter);
2368
2373
  return participants.filter(filterCallback);
2369
2374
  };
@@ -2498,7 +2503,7 @@ const PaginatedGridLayoutGroup = ({ group, mirror, VideoPlaceholder, PictureInPi
2498
2503
  const PaginatedGridLayout = (props) => {
2499
2504
  const { groupSize = (props.groupSize || 0) > 0
2500
2505
  ? props.groupSize || GROUP_SIZE
2501
- : GROUP_SIZE, excludeLocalParticipant = false, filterParticipants, mirrorLocalParticipantVideo = true, pageArrowsVisible = true, VideoPlaceholder, ParticipantViewUI = DefaultParticipantViewUI, } = props;
2506
+ : GROUP_SIZE, excludeLocalParticipant = false, filterParticipants, mirrorLocalParticipantVideo = true, pageArrowsVisible = true, VideoPlaceholder, ParticipantViewUI = DefaultParticipantViewUI, PictureInPicturePlaceholder, muted, } = props;
2502
2507
  const [page, setPage] = react.useState(0);
2503
2508
  const [paginatedGridLayoutWrapperElement, setPaginatedGridLayoutWrapperElement,] = react.useState(null);
2504
2509
  const call = videoReactBindings.useCall();
@@ -2528,7 +2533,7 @@ const PaginatedGridLayout = (props) => {
2528
2533
  const mirror = mirrorLocalParticipantVideo ? undefined : false;
2529
2534
  if (!call)
2530
2535
  return null;
2531
- return (jsxRuntime.jsxs("div", { className: "str-video__paginated-grid-layout__wrapper", ref: setPaginatedGridLayoutWrapperElement, children: [jsxRuntime.jsx(ParticipantsAudio, { participants: remoteParticipants }), jsxRuntime.jsxs("div", { className: "str-video__paginated-grid-layout", children: [pageArrowsVisible && pageCount > 1 && (jsxRuntime.jsx(IconButton, { icon: "caret-left", disabled: page === 0, onClick: () => setPage((currentPage) => Math.max(0, currentPage - 1)) })), selectedGroup && (jsxRuntime.jsx(PaginatedGridLayoutGroup, { group: selectedGroup, mirror: mirror, VideoPlaceholder: VideoPlaceholder, ParticipantViewUI: ParticipantViewUI })), pageArrowsVisible && pageCount > 1 && (jsxRuntime.jsx(IconButton, { disabled: page === pageCount - 1, icon: "caret-right", onClick: () => setPage((currentPage) => Math.min(pageCount - 1, currentPage + 1)) }))] })] }));
2536
+ return (jsxRuntime.jsxs("div", { className: "str-video__paginated-grid-layout__wrapper", ref: setPaginatedGridLayoutWrapperElement, children: [!muted && jsxRuntime.jsx(ParticipantsAudio, { participants: remoteParticipants }), jsxRuntime.jsxs("div", { className: "str-video__paginated-grid-layout", children: [pageArrowsVisible && pageCount > 1 && (jsxRuntime.jsx(IconButton, { icon: "caret-left", disabled: page === 0, onClick: () => setPage((currentPage) => Math.max(0, currentPage - 1)) })), selectedGroup && (jsxRuntime.jsx(PaginatedGridLayoutGroup, { group: selectedGroup, mirror: mirror, VideoPlaceholder: VideoPlaceholder, ParticipantViewUI: ParticipantViewUI, PictureInPicturePlaceholder: PictureInPicturePlaceholder })), pageArrowsVisible && pageCount > 1 && (jsxRuntime.jsx(IconButton, { disabled: page === pageCount - 1, icon: "caret-right", onClick: () => setPage((currentPage) => Math.min(pageCount - 1, currentPage + 1)) }))] })] }));
2532
2537
  };
2533
2538
  PaginatedGridLayout.displayName = 'PaginatedGridLayout';
2534
2539
 
@@ -2588,7 +2593,7 @@ hostElement, limit) => {
2588
2593
  };
2589
2594
 
2590
2595
  const DefaultParticipantViewUIBar = () => (jsxRuntime.jsx(DefaultParticipantViewUI, { menuPlacement: "top-end" }));
2591
- const SpeakerLayout = ({ ParticipantViewUIBar = DefaultParticipantViewUIBar, ParticipantViewUISpotlight = DefaultParticipantViewUI, VideoPlaceholder, PictureInPicturePlaceholder, participantsBarPosition = 'bottom', participantsBarLimit, mirrorLocalParticipantVideo = true, excludeLocalParticipant = false, filterParticipants, pageArrowsVisible = true, }) => {
2596
+ const SpeakerLayout = ({ ParticipantViewUIBar = DefaultParticipantViewUIBar, ParticipantViewUISpotlight = DefaultParticipantViewUI, VideoPlaceholder, PictureInPicturePlaceholder, participantsBarPosition = 'bottom', participantsBarLimit, mirrorLocalParticipantVideo = true, excludeLocalParticipant = false, filterParticipants, pageArrowsVisible = true, muted, }) => {
2592
2597
  const call = videoReactBindings.useCall();
2593
2598
  const { useParticipants, useRemoteParticipants } = videoReactBindings.useCallStateHooks();
2594
2599
  const allParticipants = useParticipants();
@@ -2625,7 +2630,7 @@ const SpeakerLayout = ({ ParticipantViewUIBar = DefaultParticipantViewUIBar, Par
2625
2630
  return null;
2626
2631
  const renderParticipantsBar = participantsBarPosition &&
2627
2632
  (participantsWithAppliedLimit.length > 0 || isSpeakerScreenSharing);
2628
- return (jsxRuntime.jsxs("div", { className: "str-video__speaker-layout__wrapper", children: [jsxRuntime.jsx(ParticipantsAudio, { participants: remoteParticipants }), jsxRuntime.jsxs("div", { className: clsx('str-video__speaker-layout', participantsBarPosition &&
2633
+ return (jsxRuntime.jsxs("div", { className: "str-video__speaker-layout__wrapper", children: [!muted && jsxRuntime.jsx(ParticipantsAudio, { participants: remoteParticipants }), jsxRuntime.jsxs("div", { className: clsx('str-video__speaker-layout', participantsBarPosition &&
2629
2634
  `str-video__speaker-layout--variant-${participantsBarPosition}`), children: [jsxRuntime.jsx("div", { className: "str-video__speaker-layout__spotlight", children: participantInSpotlight && (jsxRuntime.jsx(ParticipantView, { participant: participantInSpotlight, muteAudio: true, mirror: mirror, trackType: isSpeakerScreenSharing ? 'screenShareTrack' : 'videoTrack', ParticipantViewUI: ParticipantViewUISpotlight, VideoPlaceholder: VideoPlaceholder, PictureInPicturePlaceholder: PictureInPicturePlaceholder })) }), renderParticipantsBar && (jsxRuntime.jsxs("div", { ref: setButtonsWrapperElement, className: "str-video__speaker-layout__participants-bar-buttons-wrapper", children: [jsxRuntime.jsx("div", { className: "str-video__speaker-layout__participants-bar-wrapper", ref: setParticipantsBarWrapperElement, children: jsxRuntime.jsxs("div", { ref: setParticipantsBarElement, className: "str-video__speaker-layout__participants-bar", children: [isSpeakerScreenSharing && (jsxRuntime.jsx("div", { className: "str-video__speaker-layout__participant-tile", children: jsxRuntime.jsx(ParticipantView, { participant: participantInSpotlight, ParticipantViewUI: ParticipantViewUIBar, VideoPlaceholder: VideoPlaceholder, PictureInPicturePlaceholder: PictureInPicturePlaceholder, mirror: mirror, muteAudio: true }) }, participantInSpotlight.sessionId)), participantsWithAppliedLimit.map((participant) => (jsxRuntime.jsx("div", { className: "str-video__speaker-layout__participant-tile", children: jsxRuntime.jsx(ParticipantView, { participant: participant, ParticipantViewUI: ParticipantViewUIBar, VideoPlaceholder: VideoPlaceholder, PictureInPicturePlaceholder: PictureInPicturePlaceholder, mirror: mirror, muteAudio: true }) }, participant.sessionId)))] }) }), pageArrowsVisible && isVertical && (jsxRuntime.jsx(VerticalScrollButtons, { scrollWrapper: participantsBarWrapperElement })), pageArrowsVisible && isHorizontal && (jsxRuntime.jsx(HorizontalScrollButtons, { scrollWrapper: participantsBarWrapperElement }))] }))] })] }));
2630
2635
  };
2631
2636
  SpeakerLayout.displayName = 'SpeakerLayout';
@@ -2650,6 +2655,34 @@ const VerticalScrollButtons = ({ scrollWrapper, }) => {
2650
2655
  return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [scrollPosition && scrollPosition !== 'top' && (jsxRuntime.jsx(IconButton, { onClick: scrollTopClickHandler, icon: "caret-up", className: "str-video__speaker-layout__participants-bar--button-top" })), scrollPosition && scrollPosition !== 'bottom' && (jsxRuntime.jsx(IconButton, { onClick: scrollBottomClickHandler, icon: "caret-down", className: "str-video__speaker-layout__participants-bar--button-bottom" }))] }));
2651
2656
  };
2652
2657
 
2658
+ const Pip = (props) => {
2659
+ const { excludeLocalParticipant = false, filterParticipants, mirrorLocalParticipantVideo = true, VideoPlaceholder, ParticipantViewUI = DefaultParticipantViewUI, PictureInPicturePlaceholder, } = props;
2660
+ const [layoutWrapperElement, setLayoutWrapperElement] = react.useState(null);
2661
+ const call = videoReactBindings.useCall();
2662
+ const participants = useFilteredParticipants({
2663
+ excludeLocalParticipant,
2664
+ filterParticipants,
2665
+ });
2666
+ usePaginatedLayoutSortPreset(call);
2667
+ react.useEffect(() => {
2668
+ if (!layoutWrapperElement || !call)
2669
+ return;
2670
+ return call.setViewport(layoutWrapperElement);
2671
+ }, [layoutWrapperElement, call]);
2672
+ const mirror = mirrorLocalParticipantVideo ? undefined : false;
2673
+ if (!call)
2674
+ return null;
2675
+ return (jsxRuntime.jsx("div", { className: "str-video__pip-layout", ref: setLayoutWrapperElement, children: participants.map((participant) => (jsxRuntime.jsx(ParticipantView, { participant: participant, muteAudio: true, mirror: mirror, VideoPlaceholder: VideoPlaceholder, PictureInPicturePlaceholder: PictureInPicturePlaceholder, ParticipantViewUI: ParticipantViewUI }, participant.sessionId))) }));
2676
+ };
2677
+ Pip.displayName = 'PipLayout.Pip';
2678
+ const Host = () => {
2679
+ const { useRemoteParticipants } = videoReactBindings.useCallStateHooks();
2680
+ const remoteParticipants = useRemoteParticipants();
2681
+ return jsxRuntime.jsx(ParticipantsAudio, { participants: remoteParticipants });
2682
+ };
2683
+ Host.displayName = 'PipLayout.Host';
2684
+ const PipLayout = { Pip, Host };
2685
+
2653
2686
  const LivestreamPlayer = (props) => {
2654
2687
  const { callType, callId, layoutProps } = props;
2655
2688
  const client = videoReactBindings.useStreamVideoClient();
@@ -2674,7 +2707,7 @@ const LivestreamPlayer = (props) => {
2674
2707
  return (jsxRuntime.jsx(StreamCall, { call: call, children: jsxRuntime.jsx(LivestreamLayout, { ...layoutProps }) }));
2675
2708
  };
2676
2709
 
2677
- const [major, minor, patch] = ("1.14.0").split('.');
2710
+ const [major, minor, patch] = ("1.14.2").split('.');
2678
2711
  videoClient.setSdkInfo({
2679
2712
  type: videoClient.SfuModels.SdkType.REACT,
2680
2713
  major,
@@ -2733,6 +2766,7 @@ exports.ParticipantsAudio = ParticipantsAudio;
2733
2766
  exports.PermissionNotification = PermissionNotification;
2734
2767
  exports.PermissionRequestList = PermissionRequestList;
2735
2768
  exports.PermissionRequests = PermissionRequests;
2769
+ exports.PipLayout = PipLayout;
2736
2770
  exports.ReactionsButton = ReactionsButton;
2737
2771
  exports.RecordCallButton = RecordCallButton;
2738
2772
  exports.RecordCallConfirmationButton = RecordCallConfirmationButton;
@@ -2763,6 +2797,7 @@ exports.defaultReactions = defaultReactions;
2763
2797
  exports.translations = translations;
2764
2798
  exports.useBackgroundFilters = useBackgroundFilters;
2765
2799
  exports.useDeviceList = useDeviceList;
2800
+ exports.useFilteredParticipants = useFilteredParticipants;
2766
2801
  exports.useHorizontalScrollPosition = useHorizontalScrollPosition;
2767
2802
  exports.useMenuContext = useMenuContext;
2768
2803
  exports.useNoiseCancellation = useNoiseCancellation;