@stream-io/video-react-sdk 1.4.4 → 1.5.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.
@@ -2,7 +2,7 @@ import { ReactElement } from 'react';
2
2
  export type DropDownSelectOptionProps = {
3
3
  label: string;
4
4
  selected?: boolean;
5
- icon: string;
5
+ icon?: string;
6
6
  };
7
7
  export declare const DropDownSelectOption: (props: DropDownSelectOptionProps) => import("react/jsx-runtime").JSX.Element;
8
8
  export declare const DropDownSelect: (props: {
@@ -2,6 +2,11 @@ import { ComponentPropsWithoutRef, ComponentType } from 'react';
2
2
  import { StreamVideoParticipant, VideoTrackType } from '@stream-io/video-client';
3
3
  import { VideoPlaceholderProps } from './DefaultVideoPlaceholder';
4
4
  export type VideoProps = ComponentPropsWithoutRef<'video'> & {
5
+ /**
6
+ * Pass false to disable rendering video and render fallback
7
+ * even if the participant has published video.
8
+ */
9
+ enabled?: boolean;
5
10
  /**
6
11
  * The track type to display.
7
12
  */
@@ -35,6 +40,6 @@ export type VideoProps = ComponentPropsWithoutRef<'video'> & {
35
40
  };
36
41
  };
37
42
  export declare const Video: {
38
- ({ trackType, participant, className, VideoPlaceholder, refs, ...rest }: VideoProps): import("react/jsx-runtime").JSX.Element | null;
43
+ ({ enabled, trackType, participant, className, VideoPlaceholder, refs, ...rest }: VideoProps): import("react/jsx-runtime").JSX.Element | null;
39
44
  displayName: string;
40
45
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stream-io/video-react-sdk",
3
- "version": "1.4.4",
3
+ "version": "1.5.0",
4
4
  "packageManager": "yarn@3.2.4",
5
5
  "main": "./dist/index.cjs.js",
6
6
  "module": "./dist/index.es.js",
@@ -32,9 +32,9 @@
32
32
  ],
33
33
  "dependencies": {
34
34
  "@floating-ui/react": "^0.26.24",
35
- "@stream-io/video-client": "1.7.3",
35
+ "@stream-io/video-client": "1.8.0",
36
36
  "@stream-io/video-filters-web": "0.1.4",
37
- "@stream-io/video-react-bindings": "1.0.9",
37
+ "@stream-io/video-react-bindings": "1.1.0",
38
38
  "chart.js": "^4.4.4",
39
39
  "clsx": "^2.0.0",
40
40
  "react-chartjs-2": "^5.2.0"
@@ -48,7 +48,7 @@
48
48
  "@rollup/plugin-replace": "^5.0.7",
49
49
  "@rollup/plugin-typescript": "^11.1.6",
50
50
  "@stream-io/audio-filters-web": "^0.2.2",
51
- "@stream-io/video-styling": "^1.0.6",
51
+ "@stream-io/video-styling": "^1.1.0",
52
52
  "@types/react": "^18.3.2",
53
53
  "@types/react-dom": "^18.3.0",
54
54
  "react": "^18.3.1",
@@ -31,6 +31,7 @@ export const CompositeButton = forwardRef<
31
31
  IconButtonWithMenuProps
32
32
  >(function CompositeButton(
33
33
  {
34
+ disabled,
34
35
  caption,
35
36
  children,
36
37
  className,
@@ -63,6 +64,7 @@ export const CompositeButton = forwardRef<
63
64
  active && variant === 'primary',
64
65
  'str-video__composite-button__button-group--active-secondary':
65
66
  active && variant === 'secondary',
67
+ 'str-video__composite-button__button-group--disabled': disabled,
66
68
  })}
67
69
  >
68
70
  <button
@@ -72,6 +74,7 @@ export const CompositeButton = forwardRef<
72
74
  e.preventDefault();
73
75
  onClick?.(e);
74
76
  }}
77
+ disabled={disabled}
75
78
  {...restButtonProps}
76
79
  >
77
80
  {children}
@@ -11,10 +11,8 @@ import { IconButton } from '../Button';
11
11
  import { MenuToggle, ToggleMenuButtonProps } from '../Menu';
12
12
  import { WithTooltip } from '../Tooltip';
13
13
  import { Avatar } from '../Avatar';
14
- import {
15
- ParticipantActionsContextMenu,
16
- ParticipantViewContext,
17
- } from '../../core/';
14
+ import { ParticipantActionsContextMenu } from '../../core/components/ParticipantView/ParticipantActionsContextMenu';
15
+ import { ParticipantViewContext } from '../../core/components/ParticipantView/ParticipantViewContext';
18
16
 
19
17
  type CallParticipantListingItemProps = {
20
18
  /** Participant object be rendered */
@@ -162,7 +162,7 @@ const Select = (props: {
162
162
  export type DropDownSelectOptionProps = {
163
163
  label: string;
164
164
  selected?: boolean;
165
- icon: string;
165
+ icon?: string;
166
166
  };
167
167
 
168
168
  export const DropDownSelectOption = (props: DropDownSelectOptionProps) => {
@@ -179,7 +179,7 @@ export const DropDownSelectOption = (props: DropDownSelectOptionProps) => {
179
179
  onClick: () => handleSelect(index),
180
180
  })}
181
181
  >
182
- <Icon className="str-video__dropdown-icon" icon={icon} />
182
+ {icon && <Icon className="str-video__dropdown-icon" icon={icon} />}
183
183
  <span className="str-video__dropdown-label">{label}</span>
184
184
  </div>
185
185
  );
@@ -11,9 +11,9 @@ import { useParticipantViewContext } from './ParticipantViewContext';
11
11
  import {
12
12
  GenericMenu,
13
13
  GenericMenuButtonItem,
14
- Icon,
15
14
  useMenuContext,
16
- } from '../../../components';
15
+ } from '../../../components/Menu';
16
+ import { Icon } from '../../../components/Icon';
17
17
 
18
18
  export const ParticipantActionsContextMenu = () => {
19
19
  const { participant, participantViewElement, videoElement } =
@@ -13,6 +13,7 @@ import {
13
13
  StreamVideoParticipant,
14
14
  VideoTrackType,
15
15
  } from '@stream-io/video-client';
16
+ import { useCallStateHooks } from '@stream-io/video-react-bindings';
16
17
 
17
18
  import { Audio } from '../Audio';
18
19
  import { Video, VideoProps } from '../Video';
@@ -100,6 +101,9 @@ export const ParticipantView = forwardRef<HTMLDivElement, ParticipantViewProps>(
100
101
  trackType,
101
102
  });
102
103
 
104
+ const { useIncomingVideoSettings } = useCallStateHooks();
105
+ const { isParticipantVideoEnabled } = useIncomingVideoSettings();
106
+
103
107
  const participantViewContextValue = useMemo(
104
108
  () => ({
105
109
  participant,
@@ -167,6 +171,11 @@ export const ParticipantView = forwardRef<HTMLDivElement, ParticipantViewProps>(
167
171
  participant={participant}
168
172
  trackType={trackType}
169
173
  refs={videoRefs}
174
+ enabled={
175
+ isLocalParticipant ||
176
+ trackType !== 'videoTrack' ||
177
+ isParticipantVideoEnabled(participant.sessionId)
178
+ }
170
179
  autoPlay
171
180
  />
172
181
  {isComponentType(ParticipantViewUI) ? (
@@ -20,6 +20,12 @@ import {
20
20
  import { useCall } from '@stream-io/video-react-bindings';
21
21
 
22
22
  export type VideoProps = ComponentPropsWithoutRef<'video'> & {
23
+ /**
24
+ * Pass false to disable rendering video and render fallback
25
+ * even if the participant has published video.
26
+ */
27
+ enabled?: boolean;
28
+
23
29
  /**
24
30
  * The track type to display.
25
31
  */
@@ -54,6 +60,7 @@ export type VideoProps = ComponentPropsWithoutRef<'video'> & {
54
60
  };
55
61
 
56
62
  export const Video = ({
63
+ enabled,
57
64
  trackType,
58
65
  participant,
59
66
  className,
@@ -139,7 +146,7 @@ export const Video = ({
139
146
  trackType === 'none' ||
140
147
  viewportVisibilityState?.[trackType] === VisibilityState.INVISIBLE;
141
148
 
142
- const hasNoVideoOrInvisible = !isPublishingTrack || isInvisible;
149
+ const hasNoVideoOrInvisible = !enabled || !isPublishingTrack || isInvisible;
143
150
  const mirrorVideo = isLocalParticipant && trackType === 'videoTrack';
144
151
  const isScreenShareTrack = trackType === 'screenShareTrack';
145
152
  return (