@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.es.js CHANGED
@@ -359,6 +359,7 @@ const MenuToggle = ({ ToggleButton, placement = 'top-start', strategy = 'absolut
359
359
  offset,
360
360
  });
361
361
  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 (jsxs(Fragment, { children: [menuShown && (jsx(MenuContext.Provider, { value: { close: () => setMenuShown(false) }, children: visualType === MenuVisualType.PORTAL ? (jsx(MenuPortal, { refs: refs, children: children })) : visualType === MenuVisualType.MENU ? (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: isPinned(participant),
2370
+ hasVideo: hasVideo(participant),
2371
+ hasAudio: 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] = useState(0);
2503
2508
  const [paginatedGridLayoutWrapperElement, setPaginatedGridLayoutWrapperElement,] = useState(null);
2504
2509
  const call = 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 (jsxs("div", { className: "str-video__paginated-grid-layout__wrapper", ref: setPaginatedGridLayoutWrapperElement, children: [jsx(ParticipantsAudio, { participants: remoteParticipants }), jsxs("div", { className: "str-video__paginated-grid-layout", children: [pageArrowsVisible && pageCount > 1 && (jsx(IconButton, { icon: "caret-left", disabled: page === 0, onClick: () => setPage((currentPage) => Math.max(0, currentPage - 1)) })), selectedGroup && (jsx(PaginatedGridLayoutGroup, { group: selectedGroup, mirror: mirror, VideoPlaceholder: VideoPlaceholder, ParticipantViewUI: ParticipantViewUI })), pageArrowsVisible && pageCount > 1 && (jsx(IconButton, { disabled: page === pageCount - 1, icon: "caret-right", onClick: () => setPage((currentPage) => Math.min(pageCount - 1, currentPage + 1)) }))] })] }));
2536
+ return (jsxs("div", { className: "str-video__paginated-grid-layout__wrapper", ref: setPaginatedGridLayoutWrapperElement, children: [!muted && jsx(ParticipantsAudio, { participants: remoteParticipants }), jsxs("div", { className: "str-video__paginated-grid-layout", children: [pageArrowsVisible && pageCount > 1 && (jsx(IconButton, { icon: "caret-left", disabled: page === 0, onClick: () => setPage((currentPage) => Math.max(0, currentPage - 1)) })), selectedGroup && (jsx(PaginatedGridLayoutGroup, { group: selectedGroup, mirror: mirror, VideoPlaceholder: VideoPlaceholder, ParticipantViewUI: ParticipantViewUI, PictureInPicturePlaceholder: PictureInPicturePlaceholder })), pageArrowsVisible && pageCount > 1 && (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 = () => (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 = useCall();
2593
2598
  const { useParticipants, useRemoteParticipants } = 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 (jsxs("div", { className: "str-video__speaker-layout__wrapper", children: [jsx(ParticipantsAudio, { participants: remoteParticipants }), jsxs("div", { className: clsx('str-video__speaker-layout', participantsBarPosition &&
2633
+ return (jsxs("div", { className: "str-video__speaker-layout__wrapper", children: [!muted && jsx(ParticipantsAudio, { participants: remoteParticipants }), jsxs("div", { className: clsx('str-video__speaker-layout', participantsBarPosition &&
2629
2634
  `str-video__speaker-layout--variant-${participantsBarPosition}`), children: [jsx("div", { className: "str-video__speaker-layout__spotlight", children: participantInSpotlight && (jsx(ParticipantView, { participant: participantInSpotlight, muteAudio: true, mirror: mirror, trackType: isSpeakerScreenSharing ? 'screenShareTrack' : 'videoTrack', ParticipantViewUI: ParticipantViewUISpotlight, VideoPlaceholder: VideoPlaceholder, PictureInPicturePlaceholder: PictureInPicturePlaceholder })) }), renderParticipantsBar && (jsxs("div", { ref: setButtonsWrapperElement, className: "str-video__speaker-layout__participants-bar-buttons-wrapper", children: [jsx("div", { className: "str-video__speaker-layout__participants-bar-wrapper", ref: setParticipantsBarWrapperElement, children: jsxs("div", { ref: setParticipantsBarElement, className: "str-video__speaker-layout__participants-bar", children: [isSpeakerScreenSharing && (jsx("div", { className: "str-video__speaker-layout__participant-tile", children: jsx(ParticipantView, { participant: participantInSpotlight, ParticipantViewUI: ParticipantViewUIBar, VideoPlaceholder: VideoPlaceholder, PictureInPicturePlaceholder: PictureInPicturePlaceholder, mirror: mirror, muteAudio: true }) }, participantInSpotlight.sessionId)), participantsWithAppliedLimit.map((participant) => (jsx("div", { className: "str-video__speaker-layout__participant-tile", children: jsx(ParticipantView, { participant: participant, ParticipantViewUI: ParticipantViewUIBar, VideoPlaceholder: VideoPlaceholder, PictureInPicturePlaceholder: PictureInPicturePlaceholder, mirror: mirror, muteAudio: true }) }, participant.sessionId)))] }) }), pageArrowsVisible && isVertical && (jsx(VerticalScrollButtons, { scrollWrapper: participantsBarWrapperElement })), pageArrowsVisible && isHorizontal && (jsx(HorizontalScrollButtons, { scrollWrapper: participantsBarWrapperElement }))] }))] })] }));
2630
2635
  };
2631
2636
  SpeakerLayout.displayName = 'SpeakerLayout';
@@ -2650,6 +2655,34 @@ const VerticalScrollButtons = ({ scrollWrapper, }) => {
2650
2655
  return (jsxs(Fragment, { children: [scrollPosition && scrollPosition !== 'top' && (jsx(IconButton, { onClick: scrollTopClickHandler, icon: "caret-up", className: "str-video__speaker-layout__participants-bar--button-top" })), scrollPosition && scrollPosition !== 'bottom' && (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] = useState(null);
2661
+ const call = useCall();
2662
+ const participants = useFilteredParticipants({
2663
+ excludeLocalParticipant,
2664
+ filterParticipants,
2665
+ });
2666
+ usePaginatedLayoutSortPreset(call);
2667
+ 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 (jsx("div", { className: "str-video__pip-layout", ref: setLayoutWrapperElement, children: participants.map((participant) => (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 } = useCallStateHooks();
2680
+ const remoteParticipants = useRemoteParticipants();
2681
+ return 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 = useStreamVideoClient();
@@ -2674,7 +2707,7 @@ const LivestreamPlayer = (props) => {
2674
2707
  return (jsx(StreamCall, { call: call, children: 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
  setSdkInfo({
2679
2712
  type: SfuModels.SdkType.REACT,
2680
2713
  major,
@@ -2682,5 +2715,5 @@ setSdkInfo({
2682
2715
  patch,
2683
2716
  });
2684
2717
 
2685
- export { AcceptCallButton, Audio, Avatar, AvatarFallback, BackgroundFiltersProvider, BaseVideo, CallControls, CallParticipantListing, CallParticipantListingItem, CallParticipantsList, CallPreview, CallRecordingList, CallRecordingListHeader, CallRecordingListItem, CallStats, CallStatsButton, CancelCallButton, CancelCallConfirmButton, CompositeButton, DefaultParticipantViewUI, DefaultReactionsMenu, DefaultScreenShareOverlay, DefaultVideoPlaceholder, DeviceSelector, DeviceSelectorAudioInput, DeviceSelectorAudioOutput, DeviceSelectorVideo, DeviceSettings, DropDownSelect, DropDownSelectOption, EmptyCallRecordingListing, GenericMenu, GenericMenuButtonItem, Icon, IconButton, LivestreamLayout, LivestreamPlayer, LoadingCallRecordingListing, LoadingIndicator, MenuToggle, MenuVisualType, NoiseCancellationProvider, Notification, PaginatedGridLayout, ParticipantActionsContextMenu, ParticipantDetails, ParticipantView, ParticipantViewContext, ParticipantsAudio, PermissionNotification, PermissionRequestList, PermissionRequests, ReactionsButton, RecordCallButton, RecordCallConfirmationButton, RecordingInProgressNotification, RingingCall, RingingCallControls, ScreenShareButton, SearchInput, SearchResults, SpeakerLayout, SpeakingWhileMutedNotification, SpeechIndicator, StatCard, StreamCall, StreamTheme, StreamVideo, TextButton, ToggleAudioOutputButton, ToggleAudioPreviewButton, ToggleAudioPublishingButton, ToggleVideoPreviewButton, ToggleVideoPublishingButton, Tooltip, Video$1 as Video, VideoPreview, WithTooltip, defaultReactions, translations, useBackgroundFilters, useDeviceList, useHorizontalScrollPosition, useMenuContext, useNoiseCancellation, useParticipantViewContext, usePersistedDevicePreferences, useRequestPermission, useTrackElementVisibility, useVerticalScrollPosition };
2718
+ export { AcceptCallButton, Audio, Avatar, AvatarFallback, BackgroundFiltersProvider, BaseVideo, CallControls, CallParticipantListing, CallParticipantListingItem, CallParticipantsList, CallPreview, CallRecordingList, CallRecordingListHeader, CallRecordingListItem, CallStats, CallStatsButton, CancelCallButton, CancelCallConfirmButton, CompositeButton, DefaultParticipantViewUI, DefaultReactionsMenu, DefaultScreenShareOverlay, DefaultVideoPlaceholder, DeviceSelector, DeviceSelectorAudioInput, DeviceSelectorAudioOutput, DeviceSelectorVideo, DeviceSettings, DropDownSelect, DropDownSelectOption, EmptyCallRecordingListing, GenericMenu, GenericMenuButtonItem, Icon, IconButton, LivestreamLayout, LivestreamPlayer, LoadingCallRecordingListing, LoadingIndicator, MenuToggle, MenuVisualType, NoiseCancellationProvider, Notification, PaginatedGridLayout, ParticipantActionsContextMenu, ParticipantDetails, ParticipantView, ParticipantViewContext, ParticipantsAudio, PermissionNotification, PermissionRequestList, PermissionRequests, PipLayout, ReactionsButton, RecordCallButton, RecordCallConfirmationButton, RecordingInProgressNotification, RingingCall, RingingCallControls, ScreenShareButton, SearchInput, SearchResults, SpeakerLayout, SpeakingWhileMutedNotification, SpeechIndicator, StatCard, StreamCall, StreamTheme, StreamVideo, TextButton, ToggleAudioOutputButton, ToggleAudioPreviewButton, ToggleAudioPublishingButton, ToggleVideoPreviewButton, ToggleVideoPublishingButton, Tooltip, Video$1 as Video, VideoPreview, WithTooltip, defaultReactions, translations, useBackgroundFilters, useDeviceList, useFilteredParticipants, useHorizontalScrollPosition, useMenuContext, useNoiseCancellation, useParticipantViewContext, usePersistedDevicePreferences, useRequestPermission, useTrackElementVisibility, useVerticalScrollPosition };
2686
2719
  //# sourceMappingURL=index.es.js.map