@stream-io/video-react-sdk 1.3.0 → 1.3.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.
@@ -6,10 +6,12 @@ export type PaginatedGridLayoutProps = {
6
6
  groupSize?: number;
7
7
  /**
8
8
  * Whether to exclude the local participant from the grid.
9
+ * @default false
9
10
  */
10
11
  excludeLocalParticipant?: boolean;
11
12
  /**
12
13
  * Turns on/off the pagination arrows.
14
+ * @default true
13
15
  */
14
16
  pageArrowsVisible?: boolean;
15
17
  } & Pick<ParticipantViewProps, 'ParticipantViewUI' | 'VideoPlaceholder'>;
@@ -1,6 +1,12 @@
1
1
  import { ParticipantViewProps } from '../ParticipantView';
2
2
  export type SpeakerLayoutProps = {
3
+ /**
4
+ * The UI to be used for the participant in the spotlight.
5
+ */
3
6
  ParticipantViewUISpotlight?: ParticipantViewProps['ParticipantViewUI'];
7
+ /**
8
+ * The UI to be used for the participants in the participants bar.
9
+ */
4
10
  ParticipantViewUIBar?: ParticipantViewProps['ParticipantViewUI'];
5
11
  /**
6
12
  * The position of the participants who are not in focus.
@@ -12,8 +18,18 @@ export type SpeakerLayoutProps = {
12
18
  * Providing string `dynamic` will calculate hard limit based on screen width/height.
13
19
  */
14
20
  participantsBarLimit?: 'dynamic' | number;
21
+ /**
22
+ * When set to `true` will exclude the local participant from layout.
23
+ * @default false
24
+ */
25
+ excludeLocalParticipant?: boolean;
26
+ /**
27
+ * Turns on/off the pagination arrows.
28
+ * @default true
29
+ */
30
+ pageArrowsVisible?: boolean;
15
31
  } & Pick<ParticipantViewProps, 'VideoPlaceholder'>;
16
32
  export declare const SpeakerLayout: {
17
- ({ ParticipantViewUIBar, ParticipantViewUISpotlight, VideoPlaceholder, participantsBarPosition, participantsBarLimit, }: SpeakerLayoutProps): import("react/jsx-runtime").JSX.Element | null;
33
+ ({ ParticipantViewUIBar, ParticipantViewUISpotlight, VideoPlaceholder, participantsBarPosition, participantsBarLimit, excludeLocalParticipant, pageArrowsVisible, }: SpeakerLayoutProps): import("react/jsx-runtime").JSX.Element | null;
18
34
  displayName: string;
19
35
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stream-io/video-react-sdk",
3
- "version": "1.3.0",
3
+ "version": "1.3.2",
4
4
  "packageManager": "yarn@3.2.4",
5
5
  "main": "./dist/index.cjs.js",
6
6
  "module": "./dist/index.es.js",
@@ -29,9 +29,9 @@
29
29
  ],
30
30
  "dependencies": {
31
31
  "@floating-ui/react": "^0.26.5",
32
- "@stream-io/video-client": "1.6.0",
32
+ "@stream-io/video-client": "1.6.1",
33
33
  "@stream-io/video-filters-web": "0.1.3",
34
- "@stream-io/video-react-bindings": "1.0.0",
34
+ "@stream-io/video-react-bindings": "1.0.1",
35
35
  "chart.js": "^4.4.1",
36
36
  "clsx": "^2.0.0",
37
37
  "react-chartjs-2": "^5.2.0"
@@ -59,11 +59,13 @@ export type PaginatedGridLayoutProps = {
59
59
 
60
60
  /**
61
61
  * Whether to exclude the local participant from the grid.
62
+ * @default false
62
63
  */
63
64
  excludeLocalParticipant?: boolean;
64
65
 
65
66
  /**
66
67
  * Turns on/off the pagination arrows.
68
+ * @default true
67
69
  */
68
70
  pageArrowsVisible?: boolean;
69
71
  } & Pick<ParticipantViewProps, 'ParticipantViewUI' | 'VideoPlaceholder'>;
@@ -87,7 +89,6 @@ export const PaginatedGridLayout = (props: PaginatedGridLayoutProps) => {
87
89
  const call = useCall();
88
90
  const { useParticipants, useRemoteParticipants } = useCallStateHooks();
89
91
  const participants = useParticipants();
90
- // used to render audio elements
91
92
  const remoteParticipants = useRemoteParticipants();
92
93
 
93
94
  usePaginatedLayoutSortPreset(call);
@@ -141,7 +142,7 @@ export const PaginatedGridLayout = (props: PaginatedGridLayoutProps) => {
141
142
  )}
142
143
  {selectedGroup && (
143
144
  <PaginatedGridLayoutGroup
144
- group={participantGroups[page]}
145
+ group={selectedGroup}
145
146
  VideoPlaceholder={VideoPlaceholder}
146
147
  ParticipantViewUI={ParticipantViewUI}
147
148
  />
@@ -18,7 +18,13 @@ import { useCalculateHardLimit } from '../../hooks/useCalculateHardLimit';
18
18
  import { ParticipantsAudio } from '../Audio';
19
19
 
20
20
  export type SpeakerLayoutProps = {
21
+ /**
22
+ * The UI to be used for the participant in the spotlight.
23
+ */
21
24
  ParticipantViewUISpotlight?: ParticipantViewProps['ParticipantViewUI'];
25
+ /**
26
+ * The UI to be used for the participants in the participants bar.
27
+ */
22
28
  ParticipantViewUIBar?: ParticipantViewProps['ParticipantViewUI'];
23
29
  /**
24
30
  * The position of the participants who are not in focus.
@@ -30,25 +36,38 @@ export type SpeakerLayoutProps = {
30
36
  * Providing string `dynamic` will calculate hard limit based on screen width/height.
31
37
  */
32
38
  participantsBarLimit?: 'dynamic' | number;
39
+ /**
40
+ * When set to `true` will exclude the local participant from layout.
41
+ * @default false
42
+ */
43
+ excludeLocalParticipant?: boolean;
44
+ /**
45
+ * Turns on/off the pagination arrows.
46
+ * @default true
47
+ */
48
+ pageArrowsVisible?: boolean;
33
49
  } & Pick<ParticipantViewProps, 'VideoPlaceholder'>;
34
50
 
35
51
  const DefaultParticipantViewUIBar = () => (
36
52
  <DefaultParticipantViewUI menuPlacement="top-end" />
37
53
  );
38
54
 
39
- const DefaultParticipantViewUISpotlight = () => <DefaultParticipantViewUI />;
40
-
41
55
  export const SpeakerLayout = ({
42
56
  ParticipantViewUIBar = DefaultParticipantViewUIBar,
43
- ParticipantViewUISpotlight = DefaultParticipantViewUISpotlight,
57
+ ParticipantViewUISpotlight = DefaultParticipantViewUI,
44
58
  VideoPlaceholder,
45
59
  participantsBarPosition = 'bottom',
46
60
  participantsBarLimit,
61
+ excludeLocalParticipant = false,
62
+ pageArrowsVisible = true,
47
63
  }: SpeakerLayoutProps) => {
48
64
  const call = useCall();
49
65
  const { useParticipants, useRemoteParticipants } = useCallStateHooks();
50
- const [participantInSpotlight, ...otherParticipants] = useParticipants();
66
+ const allParticipants = useParticipants();
51
67
  const remoteParticipants = useRemoteParticipants();
68
+ const [participantInSpotlight, ...otherParticipants] = excludeLocalParticipant
69
+ ? remoteParticipants
70
+ : allParticipants;
52
71
  const [participantsBarWrapperElement, setParticipantsBarWrapperElement] =
53
72
  useState<HTMLDivElement | null>(null);
54
73
  const [participantsBarElement, setParticipantsBarElement] =
@@ -77,7 +96,7 @@ export const SpeakerLayout = ({
77
96
  return () => cleanup();
78
97
  }, [participantsBarWrapperElement, call]);
79
98
 
80
- const isOneOnOneCall = otherParticipants.length === 1;
99
+ const isOneOnOneCall = allParticipants.length === 2;
81
100
  useSpeakerLayoutSortPreset(call, isOneOnOneCall);
82
101
 
83
102
  let participantsWithAppliedLimit = otherParticipants;
@@ -164,12 +183,12 @@ export const SpeakerLayout = ({
164
183
  ))}
165
184
  </div>
166
185
  </div>
167
- {isVertical && (
186
+ {pageArrowsVisible && isVertical && (
168
187
  <VerticalScrollButtons
169
188
  scrollWrapper={participantsBarWrapperElement}
170
189
  />
171
190
  )}
172
- {isHorizontal && (
191
+ {pageArrowsVisible && isHorizontal && (
173
192
  <HorizontalScrollButtons
174
193
  scrollWrapper={participantsBarWrapperElement}
175
194
  />