@stream-io/video-react-sdk 1.7.29 → 1.8.0

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/CHANGELOG.md CHANGED
@@ -2,6 +2,23 @@
2
2
 
3
3
  This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
4
4
 
5
+ ## [1.8.0](https://github.com/GetStream/stream-video-js/compare/@stream-io/video-react-sdk-1.7.30...@stream-io/video-react-sdk-1.8.0) (2024-12-09)
6
+
7
+ ### Dependency Updates
8
+
9
+ * `@stream-io/video-client` updated to version `1.11.15`
10
+ * `@stream-io/video-react-bindings` updated to version `1.2.9`
11
+
12
+ ### Features
13
+
14
+ * add an option to filter participants in layouts ([#1612](https://github.com/GetStream/stream-video-js/issues/1612)) ([e1eac3f](https://github.com/GetStream/stream-video-js/commit/e1eac3fa4aa9239b9f0e75b6f33d51cd39c788e5))
15
+
16
+ ## [1.7.30](https://github.com/GetStream/stream-video-js/compare/@stream-io/video-react-sdk-1.7.29...@stream-io/video-react-sdk-1.7.30) (2024-12-04)
17
+
18
+ ### Dependency Updates
19
+
20
+ * `@stream-io/video-client` updated to version `1.11.14`
21
+ * `@stream-io/video-react-bindings` updated to version `1.2.8`
5
22
  ## [1.7.29](https://github.com/GetStream/stream-video-js/compare/@stream-io/video-react-sdk-1.7.28...@stream-io/video-react-sdk-1.7.29) (2024-12-03)
6
23
 
7
24
  ### Dependency Updates
package/dist/index.cjs.js CHANGED
@@ -2250,6 +2250,24 @@ const StreamVideo = (props) => {
2250
2250
  };
2251
2251
  StreamVideo.displayName = 'StreamVideo';
2252
2252
 
2253
+ const useFilteredParticipants = ({ excludeLocalParticipant = false, filterParticipants, }) => {
2254
+ const { useParticipants, useRemoteParticipants } = videoReactBindings.useCallStateHooks();
2255
+ const allParticipants = useParticipants();
2256
+ const remoteParticipants = useRemoteParticipants();
2257
+ return react.useMemo(() => {
2258
+ const unfilteredParticipants = excludeLocalParticipant
2259
+ ? remoteParticipants
2260
+ : allParticipants;
2261
+ return filterParticipants
2262
+ ? unfilteredParticipants.filter((participant) => filterParticipants(participant))
2263
+ : unfilteredParticipants;
2264
+ }, [
2265
+ allParticipants,
2266
+ remoteParticipants,
2267
+ excludeLocalParticipant,
2268
+ filterParticipants,
2269
+ ]);
2270
+ };
2253
2271
  const usePaginatedLayoutSortPreset = (call) => {
2254
2272
  react.useEffect(() => {
2255
2273
  if (!call)
@@ -2381,13 +2399,16 @@ const PaginatedGridLayoutGroup = ({ group, mirror, VideoPlaceholder, PictureInPi
2381
2399
  const PaginatedGridLayout = (props) => {
2382
2400
  const { groupSize = (props.groupSize || 0) > 0
2383
2401
  ? props.groupSize || GROUP_SIZE
2384
- : GROUP_SIZE, excludeLocalParticipant = false, mirrorLocalParticipantVideo = true, pageArrowsVisible = true, VideoPlaceholder, ParticipantViewUI = DefaultParticipantViewUI, } = props;
2402
+ : GROUP_SIZE, excludeLocalParticipant = false, filterParticipants, mirrorLocalParticipantVideo = true, pageArrowsVisible = true, VideoPlaceholder, ParticipantViewUI = DefaultParticipantViewUI, } = props;
2385
2403
  const [page, setPage] = react.useState(0);
2386
2404
  const [paginatedGridLayoutWrapperElement, setPaginatedGridLayoutWrapperElement,] = react.useState(null);
2387
2405
  const call = videoReactBindings.useCall();
2388
- const { useParticipants, useRemoteParticipants } = videoReactBindings.useCallStateHooks();
2389
- const participants = useParticipants();
2406
+ const { useRemoteParticipants } = videoReactBindings.useCallStateHooks();
2390
2407
  const remoteParticipants = useRemoteParticipants();
2408
+ const participants = useFilteredParticipants({
2409
+ excludeLocalParticipant,
2410
+ filterParticipants,
2411
+ });
2391
2412
  usePaginatedLayoutSortPreset(call);
2392
2413
  react.useEffect(() => {
2393
2414
  if (!paginatedGridLayoutWrapperElement || !call)
@@ -2396,7 +2417,7 @@ const PaginatedGridLayout = (props) => {
2396
2417
  return () => cleanup();
2397
2418
  }, [paginatedGridLayoutWrapperElement, call]);
2398
2419
  // only used to render video elements
2399
- const participantGroups = react.useMemo(() => chunk(excludeLocalParticipant ? remoteParticipants : participants, groupSize), [excludeLocalParticipant, remoteParticipants, participants, groupSize]);
2420
+ const participantGroups = react.useMemo(() => chunk(participants, groupSize), [participants, groupSize]);
2400
2421
  const pageCount = participantGroups.length;
2401
2422
  // update page when page count is reduced and selected page no longer exists
2402
2423
  react.useEffect(() => {
@@ -2468,14 +2489,12 @@ hostElement, limit) => {
2468
2489
  };
2469
2490
 
2470
2491
  const DefaultParticipantViewUIBar = () => (jsxRuntime.jsx(DefaultParticipantViewUI, { menuPlacement: "top-end" }));
2471
- const SpeakerLayout = ({ ParticipantViewUIBar = DefaultParticipantViewUIBar, ParticipantViewUISpotlight = DefaultParticipantViewUI, VideoPlaceholder, PictureInPicturePlaceholder, participantsBarPosition = 'bottom', participantsBarLimit, mirrorLocalParticipantVideo = true, excludeLocalParticipant = false, pageArrowsVisible = true, }) => {
2492
+ const SpeakerLayout = ({ ParticipantViewUIBar = DefaultParticipantViewUIBar, ParticipantViewUISpotlight = DefaultParticipantViewUI, VideoPlaceholder, PictureInPicturePlaceholder, participantsBarPosition = 'bottom', participantsBarLimit, mirrorLocalParticipantVideo = true, excludeLocalParticipant = false, filterParticipants, pageArrowsVisible = true, }) => {
2472
2493
  const call = videoReactBindings.useCall();
2473
2494
  const { useParticipants, useRemoteParticipants } = videoReactBindings.useCallStateHooks();
2474
2495
  const allParticipants = useParticipants();
2475
2496
  const remoteParticipants = useRemoteParticipants();
2476
- const [participantInSpotlight, ...otherParticipants] = excludeLocalParticipant
2477
- ? remoteParticipants
2478
- : allParticipants;
2497
+ const [participantInSpotlight, ...otherParticipants] = useFilteredParticipants({ excludeLocalParticipant, filterParticipants });
2479
2498
  const [participantsBarWrapperElement, setParticipantsBarWrapperElement] = react.useState(null);
2480
2499
  const [participantsBarElement, setParticipantsBarElement] = react.useState(null);
2481
2500
  const [buttonsWrapperElement, setButtonsWrapperElement] = react.useState(null);
@@ -2554,7 +2573,7 @@ const LivestreamPlayer = (props) => {
2554
2573
  return (jsxRuntime.jsx(StreamCall, { call: call, children: jsxRuntime.jsx(LivestreamLayout, { ...layoutProps }) }));
2555
2574
  };
2556
2575
 
2557
- const [major, minor, patch] = ("1.7.29").split('.');
2576
+ const [major, minor, patch] = ("1.8.0").split('.');
2558
2577
  videoClient.setSdkInfo({
2559
2578
  type: videoClient.SfuModels.SdkType.REACT,
2560
2579
  major,