@stream-io/video-react-sdk 1.7.4 → 1.7.5

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.
@@ -37,6 +37,7 @@ export declare const translations: {
37
37
  Me: string;
38
38
  Unknown: string;
39
39
  "Toggle device menu": string;
40
+ Default: string;
40
41
  "Call Recordings": string;
41
42
  Refresh: string;
42
43
  "Check your browser video permissions": string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stream-io/video-react-sdk",
3
- "version": "1.7.4",
3
+ "version": "1.7.5",
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.10.0",
35
+ "@stream-io/video-client": "1.10.1",
36
36
  "@stream-io/video-filters-web": "0.1.4",
37
- "@stream-io/video-react-bindings": "1.1.9",
37
+ "@stream-io/video-react-bindings": "1.1.10",
38
38
  "chart.js": "^4.4.4",
39
39
  "clsx": "^2.0.0",
40
40
  "react-chartjs-2": "^5.2.0"
@@ -3,6 +3,7 @@ import { ChangeEventHandler, useCallback } from 'react';
3
3
 
4
4
  import { DropDownSelect, DropDownSelectOption } from '../DropdownSelect';
5
5
  import { useMenuContext } from '../Menu';
6
+ import { useI18n } from '@stream-io/video-react-bindings';
6
7
 
7
8
  type DeviceSelectorOptionProps = {
8
9
  id: string;
@@ -57,26 +58,9 @@ const DeviceSelectorList = (props: {
57
58
  title?: string;
58
59
  onChange?: (deviceId: string) => void;
59
60
  }) => {
60
- const {
61
- devices = [],
62
- selectedDeviceId: selectedDeviceFromProps,
63
- title,
64
- type,
65
- onChange,
66
- } = props;
67
-
61
+ const { devices = [], selectedDeviceId, title, type, onChange } = props;
68
62
  const { close } = useMenuContext();
69
-
70
- // sometimes the browser (Chrome) will report the system-default device
71
- // with an id of 'default'. In case when it doesn't, we'll select the first
72
- // available device.
73
- let selectedDeviceId = selectedDeviceFromProps;
74
- if (
75
- devices.length > 0 &&
76
- !devices.find((d) => d.deviceId === selectedDeviceId)
77
- ) {
78
- selectedDeviceId = devices[0].deviceId;
79
- }
63
+ const { t } = useI18n();
80
64
 
81
65
  return (
82
66
  <div className="str-video__device-settings__device-kind">
@@ -85,10 +69,10 @@ const DeviceSelectorList = (props: {
85
69
  {title}
86
70
  </div>
87
71
  )}
88
- {!devices.length ? (
72
+ {devices.length === 0 ? (
89
73
  <DeviceSelectorOption
90
74
  id={`${type}--default`}
91
- label="Default"
75
+ label={t('Default')}
92
76
  name={type}
93
77
  defaultChecked
94
78
  value="default"
@@ -122,28 +106,10 @@ const DeviceSelectorDropdown = (props: {
122
106
  selectedDeviceId?: string;
123
107
  title?: string;
124
108
  onChange?: (deviceId: string) => void;
125
- visualType?: 'list' | 'dropdown';
126
109
  icon: string;
127
- placeholder?: string;
128
110
  }) => {
129
- const {
130
- devices = [],
131
- selectedDeviceId: selectedDeviceFromProps,
132
- title,
133
- onChange,
134
- icon,
135
- } = props;
136
-
137
- // sometimes the browser (Chrome) will report the system-default device
138
- // with an id of 'default'. In case when it doesn't, we'll select the first
139
- // available device.
140
- let selectedDeviceId = selectedDeviceFromProps;
141
- if (
142
- devices.length > 0 &&
143
- !devices.find((d) => d.deviceId === selectedDeviceId)
144
- ) {
145
- selectedDeviceId = devices[0].deviceId;
146
- }
111
+ const { devices = [], selectedDeviceId, title, onChange, icon } = props;
112
+ const { t } = useI18n();
147
113
 
148
114
  const selectedIndex = devices.findIndex(
149
115
  (d) => d.deviceId === selectedDeviceId,
@@ -164,11 +130,13 @@ const DeviceSelectorDropdown = (props: {
164
130
  <DropDownSelect
165
131
  icon={icon}
166
132
  defaultSelectedIndex={selectedIndex}
167
- defaultSelectedLabel={devices[selectedIndex]?.label}
133
+ defaultSelectedLabel={devices[selectedIndex]?.label ?? t('Default')}
168
134
  handleSelect={handleSelect}
169
135
  >
170
- {devices.map((device) => {
171
- return (
136
+ {devices.length === 0 ? (
137
+ <DropDownSelectOption icon={icon} label={t('Default')} selected />
138
+ ) : (
139
+ devices.map((device) => (
172
140
  <DropDownSelectOption
173
141
  key={device.deviceId}
174
142
  icon={icon}
@@ -177,8 +145,8 @@ const DeviceSelectorDropdown = (props: {
177
145
  device.deviceId === selectedDeviceId || devices.length === 1
178
146
  }
179
147
  />
180
- );
181
- })}
148
+ ))
149
+ )}
182
150
  </DropDownSelect>
183
151
  </div>
184
152
  );
@@ -199,7 +167,5 @@ export const DeviceSelector = (props: {
199
167
  if (visualType === 'list') {
200
168
  return <DeviceSelectorList {...rest} />;
201
169
  }
202
- return (
203
- <DeviceSelectorDropdown {...rest} icon={icon} placeholder={placeholder} />
204
- );
170
+ return <DeviceSelectorDropdown {...rest} icon={icon} />;
205
171
  };
@@ -38,6 +38,7 @@
38
38
  "Me": "Me",
39
39
  "Unknown": "Unknown",
40
40
  "Toggle device menu": "Toggle device menu",
41
+ "Default": "Default",
41
42
  "Call Recordings": "Call Recordings",
42
43
  "Refresh": "Refresh",
43
44
  "Check your browser video permissions": "Check your browser video permissions",