@stream-io/video-react-sdk 1.7.24 → 1.7.25
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 +11 -0
- package/dist/index.cjs.js +26 -17
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +26 -17
- package/dist/index.es.js.map +1 -1
- package/dist/src/components/DeviceSettings/DeviceSelectorAudio.d.ts +4 -3
- package/dist/src/components/DeviceSettings/DeviceSelectorVideo.d.ts +4 -3
- package/dist/src/utilities/callControlHandler.d.ts +1 -1
- package/package.json +3 -3
- package/src/components/DeviceSettings/DeviceSelectorAudio.tsx +18 -11
- package/src/components/DeviceSettings/DeviceSelectorVideo.tsx +16 -11
- package/src/hooks/usePersistedDevicePreferences.ts +21 -6
- package/src/utilities/callControlHandler.ts +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,17 @@
|
|
|
2
2
|
|
|
3
3
|
This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
|
|
4
4
|
|
|
5
|
+
## [1.7.25](https://github.com/GetStream/stream-video-js/compare/@stream-io/video-react-sdk-1.7.24...@stream-io/video-react-sdk-1.7.25) (2024-11-27)
|
|
6
|
+
|
|
7
|
+
### Dependency Updates
|
|
8
|
+
|
|
9
|
+
* `@stream-io/video-client` updated to version `1.11.9`
|
|
10
|
+
* `@stream-io/video-react-bindings` updated to version `1.2.3`
|
|
11
|
+
|
|
12
|
+
### Bug Fixes
|
|
13
|
+
|
|
14
|
+
* cover some device selection edge cases ([#1604](https://github.com/GetStream/stream-video-js/issues/1604)) ([a8fc0ea](https://github.com/GetStream/stream-video-js/commit/a8fc0eaf1ed6c79ce24f77f52351a1e90701bd02))
|
|
15
|
+
|
|
5
16
|
## [1.7.24](https://github.com/GetStream/stream-video-js/compare/@stream-io/video-react-sdk-1.7.23...@stream-io/video-react-sdk-1.7.24) (2024-11-27)
|
|
6
17
|
|
|
7
18
|
### Dependency Updates
|
package/dist/index.cjs.js
CHANGED
|
@@ -128,8 +128,10 @@ const usePersistDevicePreferences = (key, shouldPersistRef) => {
|
|
|
128
128
|
*
|
|
129
129
|
* @param key the key to use for local storage.
|
|
130
130
|
*/
|
|
131
|
-
const useApplyDevicePreferences = (key, onApplied) => {
|
|
131
|
+
const useApplyDevicePreferences = (key, onWillApply, onApplied) => {
|
|
132
132
|
const call = videoReactBindings.useCall();
|
|
133
|
+
const onWillApplyRef = react.useRef(onWillApply);
|
|
134
|
+
onWillApplyRef.current = onWillApply;
|
|
133
135
|
const onAppliedRef = react.useRef(onApplied);
|
|
134
136
|
onAppliedRef.current = onApplied;
|
|
135
137
|
react.useEffect(() => {
|
|
@@ -178,16 +180,21 @@ const useApplyDevicePreferences = (key, onApplied) => {
|
|
|
178
180
|
console.warn('Failed to load device preferences', err);
|
|
179
181
|
}
|
|
180
182
|
if (preferences) {
|
|
181
|
-
await initMic(preferences.mic)
|
|
182
|
-
|
|
183
|
+
await initMic(preferences.mic).catch((err) => {
|
|
184
|
+
console.warn('Failed to apply microphone preferences', err);
|
|
185
|
+
});
|
|
186
|
+
await initCamera(preferences.camera).catch((err) => {
|
|
187
|
+
console.warn('Failed to apply camera preferences', err);
|
|
188
|
+
});
|
|
183
189
|
initSpeaker(preferences.speaker);
|
|
184
190
|
}
|
|
185
191
|
};
|
|
192
|
+
onWillApplyRef.current();
|
|
186
193
|
apply()
|
|
187
|
-
.then(() => onAppliedRef.current())
|
|
188
194
|
.catch((err) => {
|
|
189
195
|
console.warn('Failed to apply device preferences', err);
|
|
190
|
-
})
|
|
196
|
+
})
|
|
197
|
+
.then(() => onAppliedRef.current());
|
|
191
198
|
return () => {
|
|
192
199
|
cancel = true;
|
|
193
200
|
};
|
|
@@ -200,7 +207,7 @@ const useApplyDevicePreferences = (key, onApplied) => {
|
|
|
200
207
|
*/
|
|
201
208
|
const usePersistedDevicePreferences = (key = '@stream-io/device-preferences') => {
|
|
202
209
|
const shouldPersistRef = react.useRef(false);
|
|
203
|
-
useApplyDevicePreferences(key, () => (shouldPersistRef.current = true));
|
|
210
|
+
useApplyDevicePreferences(key, () => (shouldPersistRef.current = false), () => (shouldPersistRef.current = true));
|
|
204
211
|
usePersistDevicePreferences(key, shouldPersistRef);
|
|
205
212
|
};
|
|
206
213
|
const parseDeviceId = (deviceId) => deviceId !== defaultDevice ? deviceId : undefined;
|
|
@@ -1101,9 +1108,9 @@ const DefaultReactionsMenu = ({ reactions, layout = 'horizontal', }) => {
|
|
|
1101
1108
|
*/
|
|
1102
1109
|
const createCallControlHandler = (props, handler) => {
|
|
1103
1110
|
const logger = videoClient.getLogger(['react-sdk']);
|
|
1104
|
-
return async () => {
|
|
1111
|
+
return async (...args) => {
|
|
1105
1112
|
try {
|
|
1106
|
-
await handler();
|
|
1113
|
+
await handler(...args);
|
|
1107
1114
|
}
|
|
1108
1115
|
catch (error) {
|
|
1109
1116
|
if (props.onError) {
|
|
@@ -1250,12 +1257,13 @@ const DeviceSelector = (props) => {
|
|
|
1250
1257
|
return jsxRuntime.jsx(DeviceSelectorDropdown, { ...rest, icon: icon });
|
|
1251
1258
|
};
|
|
1252
1259
|
|
|
1253
|
-
const DeviceSelectorAudioInput = (
|
|
1260
|
+
const DeviceSelectorAudioInput = (props) => {
|
|
1254
1261
|
const { useMicrophoneState } = videoReactBindings.useCallStateHooks();
|
|
1255
1262
|
const { microphone, selectedDevice, devices } = useMicrophoneState();
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1263
|
+
const handleChange = createCallControlHandler(props, async (deviceId) => {
|
|
1264
|
+
await microphone.select(deviceId);
|
|
1265
|
+
});
|
|
1266
|
+
return (jsxRuntime.jsx(DeviceSelector, { devices: devices || [], selectedDeviceId: selectedDevice, type: "audioinput", onChange: handleChange, title: props.title, visualType: props.visualType, icon: "mic" }));
|
|
1259
1267
|
};
|
|
1260
1268
|
const DeviceSelectorAudioOutput = ({ title, visualType, }) => {
|
|
1261
1269
|
const { useSpeakerState } = videoReactBindings.useCallStateHooks();
|
|
@@ -1267,12 +1275,13 @@ const DeviceSelectorAudioOutput = ({ title, visualType, }) => {
|
|
|
1267
1275
|
}, title: title, visualType: visualType, icon: "speaker" }));
|
|
1268
1276
|
};
|
|
1269
1277
|
|
|
1270
|
-
const DeviceSelectorVideo = (
|
|
1278
|
+
const DeviceSelectorVideo = (props) => {
|
|
1271
1279
|
const { useCameraState } = videoReactBindings.useCallStateHooks();
|
|
1272
1280
|
const { camera, devices, selectedDevice } = useCameraState();
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1281
|
+
const handleChange = createCallControlHandler(props, async (deviceId) => {
|
|
1282
|
+
await camera.select(deviceId);
|
|
1283
|
+
});
|
|
1284
|
+
return (jsxRuntime.jsx(DeviceSelector, { devices: devices || [], type: "videoinput", selectedDeviceId: selectedDevice, onChange: handleChange, title: props.title, visualType: props.visualType, icon: "camera" }));
|
|
1276
1285
|
};
|
|
1277
1286
|
|
|
1278
1287
|
const DeviceSettings = ({ visualType = exports.MenuVisualType.MENU, }) => {
|
|
@@ -2554,7 +2563,7 @@ const LivestreamPlayer = (props) => {
|
|
|
2554
2563
|
return (jsxRuntime.jsx(StreamCall, { call: call, children: jsxRuntime.jsx(LivestreamLayout, { ...layoutProps }) }));
|
|
2555
2564
|
};
|
|
2556
2565
|
|
|
2557
|
-
const [major, minor, patch] = ("1.7.
|
|
2566
|
+
const [major, minor, patch] = ("1.7.25").split('.');
|
|
2558
2567
|
videoClient.setSdkInfo({
|
|
2559
2568
|
type: videoClient.SfuModels.SdkType.REACT,
|
|
2560
2569
|
major,
|