@stream-io/video-react-sdk 1.5.0 → 1.6.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.
@@ -26,6 +26,11 @@ export type LivestreamLayoutProps = {
26
26
  * Whether to show the speaker name. Defaults to `false`.
27
27
  */
28
28
  showSpeakerName?: boolean;
29
+ /**
30
+ * When set to `false` disables mirroring of the local partipant's video.
31
+ * @default true
32
+ */
33
+ mirrorLocalParticipantVideo?: boolean;
29
34
  /**
30
35
  * The props to pass to the floating participant element.
31
36
  */
@@ -9,6 +9,11 @@ export type PaginatedGridLayoutProps = {
9
9
  * @default false
10
10
  */
11
11
  excludeLocalParticipant?: boolean;
12
+ /**
13
+ * When set to `false` disables mirroring of the local partipant's video.
14
+ * @default true
15
+ */
16
+ mirrorLocalParticipantVideo?: boolean;
12
17
  /**
13
18
  * Turns on/off the pagination arrows.
14
19
  * @default true
@@ -23,6 +23,11 @@ export type SpeakerLayoutProps = {
23
23
  * @default false
24
24
  */
25
25
  excludeLocalParticipant?: boolean;
26
+ /**
27
+ * When set to `false` disables mirroring of the local partipant's video.
28
+ * @default true
29
+ */
30
+ mirrorLocalParticipantVideo?: boolean;
26
31
  /**
27
32
  * Turns on/off the pagination arrows.
28
33
  * @default true
@@ -30,6 +35,6 @@ export type SpeakerLayoutProps = {
30
35
  pageArrowsVisible?: boolean;
31
36
  } & Pick<ParticipantViewProps, 'VideoPlaceholder'>;
32
37
  export declare const SpeakerLayout: {
33
- ({ ParticipantViewUIBar, ParticipantViewUISpotlight, VideoPlaceholder, participantsBarPosition, participantsBarLimit, excludeLocalParticipant, pageArrowsVisible, }: SpeakerLayoutProps): import("react/jsx-runtime").JSX.Element | null;
38
+ ({ ParticipantViewUIBar, ParticipantViewUISpotlight, VideoPlaceholder, participantsBarPosition, participantsBarLimit, mirrorLocalParticipantVideo, excludeLocalParticipant, pageArrowsVisible, }: SpeakerLayoutProps): import("react/jsx-runtime").JSX.Element | null;
34
39
  displayName: string;
35
40
  };
@@ -18,6 +18,11 @@ export type ParticipantViewProps = {
18
18
  * You can use `none` if you're building an audio-only call.
19
19
  */
20
20
  trackType?: VideoTrackType | 'none';
21
+ /**
22
+ * Forces participant's video to be mirrored or unmirrored. By default, video track
23
+ * from the local participant is mirrored, and all other videos are not mirrored.
24
+ */
25
+ mirror?: boolean;
21
26
  /**
22
27
  * This prop is only useful for advanced use-cases (for example, building your own layout).
23
28
  * When set to `true` it will mute the give participant's audio stream on the client side.
@@ -54,6 +59,11 @@ export declare const ParticipantView: import("react").ForwardRefExoticComponent<
54
59
  * You can use `none` if you're building an audio-only call.
55
60
  */
56
61
  trackType?: VideoTrackType | "none";
62
+ /**
63
+ * Forces participant's video to be mirrored or unmirrored. By default, video track
64
+ * from the local participant is mirrored, and all other videos are not mirrored.
65
+ */
66
+ mirror?: boolean;
57
67
  /**
58
68
  * This prop is only useful for advanced use-cases (for example, building your own layout).
59
69
  * When set to `true` it will mute the give participant's audio stream on the client side.
@@ -7,6 +7,11 @@ export type VideoProps = ComponentPropsWithoutRef<'video'> & {
7
7
  * even if the participant has published video.
8
8
  */
9
9
  enabled?: boolean;
10
+ /**
11
+ * Forces the video to be mirrored or unmirrored. By default, video track
12
+ * from the local participant is mirrored, and all other videos are not mirrored.
13
+ */
14
+ mirror?: boolean;
10
15
  /**
11
16
  * The track type to display.
12
17
  */
@@ -40,6 +45,6 @@ export type VideoProps = ComponentPropsWithoutRef<'video'> & {
40
45
  };
41
46
  };
42
47
  export declare const Video: {
43
- ({ enabled, trackType, participant, className, VideoPlaceholder, refs, ...rest }: VideoProps): import("react/jsx-runtime").JSX.Element | null;
48
+ ({ enabled, mirror, trackType, participant, className, VideoPlaceholder, refs, ...rest }: VideoProps): import("react/jsx-runtime").JSX.Element | null;
44
49
  displayName: string;
45
50
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stream-io/video-react-sdk",
3
- "version": "1.5.0",
3
+ "version": "1.6.0",
4
4
  "packageManager": "yarn@3.2.4",
5
5
  "main": "./dist/index.cjs.js",
6
6
  "module": "./dist/index.es.js",
@@ -44,6 +44,12 @@ export type LivestreamLayoutProps = {
44
44
  */
45
45
  showSpeakerName?: boolean;
46
46
 
47
+ /**
48
+ * When set to `false` disables mirroring of the local partipant's video.
49
+ * @default true
50
+ */
51
+ mirrorLocalParticipantVideo?: boolean;
52
+
47
53
  /**
48
54
  * The props to pass to the floating participant element.
49
55
  */
@@ -116,6 +122,9 @@ export const LivestreamLayout = (props: LivestreamLayoutProps) => {
116
122
  )}
117
123
  participant={currentSpeaker}
118
124
  ParticipantViewUI={FloatingParticipantOverlay || Overlay}
125
+ mirror={
126
+ props.mirrorLocalParticipantVideo !== false ? undefined : false
127
+ }
119
128
  muteAudio // audio is rendered by ParticipantsAudio
120
129
  />
121
130
  )}
@@ -20,11 +20,12 @@ type PaginatedGridLayoutGroupProps = {
20
20
  * The group of participants to render.
21
21
  */
22
22
  group: Array<StreamVideoParticipant>;
23
- } & Pick<ParticipantViewProps, 'VideoPlaceholder'> &
23
+ } & Pick<ParticipantViewProps, 'VideoPlaceholder' | 'mirror'> &
24
24
  Required<Pick<ParticipantViewProps, 'ParticipantViewUI'>>;
25
25
 
26
26
  const PaginatedGridLayoutGroup = ({
27
27
  group,
28
+ mirror,
28
29
  VideoPlaceholder,
29
30
  ParticipantViewUI,
30
31
  }: PaginatedGridLayoutGroupProps) => {
@@ -43,6 +44,7 @@ const PaginatedGridLayoutGroup = ({
43
44
  key={participant.sessionId}
44
45
  participant={participant}
45
46
  muteAudio
47
+ mirror={mirror}
46
48
  VideoPlaceholder={VideoPlaceholder}
47
49
  ParticipantViewUI={ParticipantViewUI}
48
50
  />
@@ -63,6 +65,12 @@ export type PaginatedGridLayoutProps = {
63
65
  */
64
66
  excludeLocalParticipant?: boolean;
65
67
 
68
+ /**
69
+ * When set to `false` disables mirroring of the local partipant's video.
70
+ * @default true
71
+ */
72
+ mirrorLocalParticipantVideo?: boolean;
73
+
66
74
  /**
67
75
  * Turns on/off the pagination arrows.
68
76
  * @default true
@@ -76,6 +84,7 @@ export const PaginatedGridLayout = (props: PaginatedGridLayoutProps) => {
76
84
  ? props.groupSize || GROUP_SIZE
77
85
  : GROUP_SIZE,
78
86
  excludeLocalParticipant = false,
87
+ mirrorLocalParticipantVideo = true,
79
88
  pageArrowsVisible = true,
80
89
  VideoPlaceholder,
81
90
  ParticipantViewUI = DefaultParticipantViewUI,
@@ -121,6 +130,7 @@ export const PaginatedGridLayout = (props: PaginatedGridLayoutProps) => {
121
130
  }, [page, pageCount]);
122
131
 
123
132
  const selectedGroup = participantGroups[page];
133
+ const mirror = mirrorLocalParticipantVideo ? undefined : false;
124
134
 
125
135
  if (!call) return null;
126
136
 
@@ -143,6 +153,7 @@ export const PaginatedGridLayout = (props: PaginatedGridLayoutProps) => {
143
153
  {selectedGroup && (
144
154
  <PaginatedGridLayoutGroup
145
155
  group={selectedGroup}
156
+ mirror={mirror}
146
157
  VideoPlaceholder={VideoPlaceholder}
147
158
  ParticipantViewUI={ParticipantViewUI}
148
159
  />
@@ -41,6 +41,11 @@ export type SpeakerLayoutProps = {
41
41
  * @default false
42
42
  */
43
43
  excludeLocalParticipant?: boolean;
44
+ /**
45
+ * When set to `false` disables mirroring of the local partipant's video.
46
+ * @default true
47
+ */
48
+ mirrorLocalParticipantVideo?: boolean;
44
49
  /**
45
50
  * Turns on/off the pagination arrows.
46
51
  * @default true
@@ -58,6 +63,7 @@ export const SpeakerLayout = ({
58
63
  VideoPlaceholder,
59
64
  participantsBarPosition = 'bottom',
60
65
  participantsBarLimit,
66
+ mirrorLocalParticipantVideo = true,
61
67
  excludeLocalParticipant = false,
62
68
  pageArrowsVisible = true,
63
69
  }: SpeakerLayoutProps) => {
@@ -117,6 +123,8 @@ export const SpeakerLayout = ({
117
123
  );
118
124
  }
119
125
 
126
+ const mirror = mirrorLocalParticipantVideo ? undefined : false;
127
+
120
128
  if (!call) return null;
121
129
 
122
130
  return (
@@ -134,6 +142,7 @@ export const SpeakerLayout = ({
134
142
  <ParticipantView
135
143
  participant={participantInSpotlight}
136
144
  muteAudio={true}
145
+ mirror={mirror}
137
146
  trackType={
138
147
  isSpeakerScreenSharing ? 'screenShareTrack' : 'videoTrack'
139
148
  }
@@ -164,6 +173,7 @@ export const SpeakerLayout = ({
164
173
  participant={participantInSpotlight}
165
174
  ParticipantViewUI={ParticipantViewUIBar}
166
175
  VideoPlaceholder={VideoPlaceholder}
176
+ mirror={mirror}
167
177
  muteAudio={true}
168
178
  />
169
179
  </div>
@@ -177,6 +187,7 @@ export const SpeakerLayout = ({
177
187
  participant={participant}
178
188
  ParticipantViewUI={ParticipantViewUIBar}
179
189
  VideoPlaceholder={VideoPlaceholder}
190
+ mirror={mirror}
180
191
  muteAudio={true}
181
192
  />
182
193
  </div>
@@ -42,6 +42,12 @@ export type ParticipantViewProps = {
42
42
  */
43
43
  trackType?: VideoTrackType | 'none';
44
44
 
45
+ /**
46
+ * Forces participant's video to be mirrored or unmirrored. By default, video track
47
+ * from the local participant is mirrored, and all other videos are not mirrored.
48
+ */
49
+ mirror?: boolean;
50
+
45
51
  /**
46
52
  * This prop is only useful for advanced use-cases (for example, building your own layout).
47
53
  * When set to `true` it will mute the give participant's audio stream on the client side.
@@ -69,6 +75,7 @@ export const ParticipantView = forwardRef<HTMLDivElement, ParticipantViewProps>(
69
75
  {
70
76
  participant,
71
77
  trackType = 'videoTrack',
78
+ mirror,
72
79
  muteAudio,
73
80
  refs: { setVideoElement, setVideoPlaceholderElement } = {},
74
81
  className,
@@ -176,6 +183,7 @@ export const ParticipantView = forwardRef<HTMLDivElement, ParticipantViewProps>(
176
183
  trackType !== 'videoTrack' ||
177
184
  isParticipantVideoEnabled(participant.sessionId)
178
185
  }
186
+ mirror={mirror}
179
187
  autoPlay
180
188
  />
181
189
  {isComponentType(ParticipantViewUI) ? (
@@ -25,7 +25,11 @@ export type VideoProps = ComponentPropsWithoutRef<'video'> & {
25
25
  * even if the participant has published video.
26
26
  */
27
27
  enabled?: boolean;
28
-
28
+ /**
29
+ * Forces the video to be mirrored or unmirrored. By default, video track
30
+ * from the local participant is mirrored, and all other videos are not mirrored.
31
+ */
32
+ mirror?: boolean;
29
33
  /**
30
34
  * The track type to display.
31
35
  */
@@ -61,6 +65,7 @@ export type VideoProps = ComponentPropsWithoutRef<'video'> & {
61
65
 
62
66
  export const Video = ({
63
67
  enabled,
68
+ mirror,
64
69
  trackType,
65
70
  participant,
66
71
  className,
@@ -147,7 +152,10 @@ export const Video = ({
147
152
  viewportVisibilityState?.[trackType] === VisibilityState.INVISIBLE;
148
153
 
149
154
  const hasNoVideoOrInvisible = !enabled || !isPublishingTrack || isInvisible;
150
- const mirrorVideo = isLocalParticipant && trackType === 'videoTrack';
155
+ const mirrorVideo =
156
+ mirror === undefined
157
+ ? isLocalParticipant && trackType === 'videoTrack'
158
+ : mirror;
151
159
  const isScreenShareTrack = trackType === 'screenShareTrack';
152
160
  return (
153
161
  <>