@stream-io/video-react-sdk 1.2.16 → 1.2.18
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 +18 -0
- package/dist/index.cjs.js +12 -24
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +12 -24
- package/dist/index.es.js.map +1 -1
- package/package.json +3 -3
- package/src/hooks/usePersistedDevicePreferences.ts +15 -25
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,24 @@
|
|
|
2
2
|
|
|
3
3
|
This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
|
|
4
4
|
|
|
5
|
+
### [1.2.18](https://github.com/GetStream/stream-video-js/compare/@stream-io/video-react-sdk-1.2.17...@stream-io/video-react-sdk-1.2.18) (2024-07-29)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
* remove applying default settings in usePersistedDevicePreferences ([#1446](https://github.com/GetStream/stream-video-js/issues/1446)) ([b196826](https://github.com/GetStream/stream-video-js/commit/b196826b6c2dcf5bd1d2d3ac8b5b852aeddeee81)), closes [/github.com/GetStream/stream-video-js/blob/main/packages/client/src/Call.ts#L2127](https://github.com/GetStream//github.com/GetStream/stream-video-js/blob/main/packages/client/src/Call.ts/issues/L2127)
|
|
11
|
+
|
|
12
|
+
### [1.2.17](https://github.com/GetStream/stream-video-js/compare/@stream-io/video-react-sdk-1.2.16...@stream-io/video-react-sdk-1.2.17) (2024-07-25)
|
|
13
|
+
|
|
14
|
+
### Dependency Updates
|
|
15
|
+
|
|
16
|
+
* `@stream-io/video-client` updated to version `1.4.6`
|
|
17
|
+
* `@stream-io/video-react-bindings` updated to version `0.4.50`
|
|
18
|
+
|
|
19
|
+
### Bug Fixes
|
|
20
|
+
|
|
21
|
+
* allow reusing call instances after leaving ([#1433](https://github.com/GetStream/stream-video-js/issues/1433)) ([61e05af](https://github.com/GetStream/stream-video-js/commit/61e05af25c441b7db9db16166a6b4eca20ec7748))
|
|
22
|
+
|
|
5
23
|
### [1.2.16](https://github.com/GetStream/stream-video-js/compare/@stream-io/video-react-sdk-1.2.15...@stream-io/video-react-sdk-1.2.16) (2024-07-23)
|
|
6
24
|
|
|
7
25
|
|
package/dist/index.cjs.js
CHANGED
|
@@ -236,35 +236,32 @@ const useFloatingUIPreset = ({ middleware = [], placement, strategy, offset: off
|
|
|
236
236
|
return { refs, x, y, domReference, floating, strategy, context };
|
|
237
237
|
};
|
|
238
238
|
|
|
239
|
+
const defaultDevice = 'default';
|
|
239
240
|
/**
|
|
240
241
|
* This hook will persist the device settings to local storage.
|
|
241
242
|
*
|
|
242
243
|
* @param key the key to use for local storage.
|
|
243
244
|
*/
|
|
244
245
|
const usePersistDevicePreferences = (key) => {
|
|
245
|
-
const { useMicrophoneState, useCameraState, useSpeakerState
|
|
246
|
+
const { useMicrophoneState, useCameraState, useSpeakerState } = videoReactBindings.useCallStateHooks();
|
|
246
247
|
const call = videoReactBindings.useCall();
|
|
247
248
|
const mic = useMicrophoneState();
|
|
248
249
|
const camera = useCameraState();
|
|
249
250
|
const speaker = useSpeakerState();
|
|
250
|
-
const settings = useCallSettings();
|
|
251
251
|
react.useEffect(() => {
|
|
252
|
-
if (!call
|
|
252
|
+
if (!call)
|
|
253
253
|
return;
|
|
254
254
|
if (call.state.callingState === videoClient.CallingState.LEFT)
|
|
255
255
|
return;
|
|
256
256
|
try {
|
|
257
|
-
const hasPreferences = !!window.localStorage.getItem(key);
|
|
258
|
-
const { audio, video } = settings;
|
|
259
|
-
const defaultDevice = 'default';
|
|
260
257
|
const preferences = {
|
|
261
258
|
mic: {
|
|
262
259
|
selectedDeviceId: mic.selectedDevice || defaultDevice,
|
|
263
|
-
muted:
|
|
260
|
+
muted: mic.isMute,
|
|
264
261
|
},
|
|
265
262
|
camera: {
|
|
266
263
|
selectedDeviceId: camera.selectedDevice || defaultDevice,
|
|
267
|
-
muted:
|
|
264
|
+
muted: camera.isMute,
|
|
268
265
|
},
|
|
269
266
|
speaker: {
|
|
270
267
|
selectedDeviceId: speaker.selectedDevice || defaultDevice,
|
|
@@ -283,7 +280,6 @@ const usePersistDevicePreferences = (key) => {
|
|
|
283
280
|
key,
|
|
284
281
|
mic.isMute,
|
|
285
282
|
mic.selectedDevice,
|
|
286
|
-
settings,
|
|
287
283
|
speaker.selectedDevice,
|
|
288
284
|
]);
|
|
289
285
|
};
|
|
@@ -294,16 +290,14 @@ const usePersistDevicePreferences = (key) => {
|
|
|
294
290
|
*/
|
|
295
291
|
const useApplyDevicePreferences = (key) => {
|
|
296
292
|
const call = videoReactBindings.useCall();
|
|
297
|
-
const { useCallSettings } = videoReactBindings.useCallStateHooks();
|
|
298
|
-
const settings = useCallSettings();
|
|
299
293
|
react.useEffect(() => {
|
|
300
|
-
if (!call
|
|
294
|
+
if (!call)
|
|
301
295
|
return;
|
|
302
296
|
if (call.state.callingState === videoClient.CallingState.LEFT)
|
|
303
297
|
return;
|
|
304
298
|
const apply = async () => {
|
|
305
299
|
const initMic = async (setting) => {
|
|
306
|
-
await call.microphone.select(setting.selectedDeviceId);
|
|
300
|
+
await call.microphone.select(parseDeviceId(setting.selectedDeviceId));
|
|
307
301
|
if (setting.muted) {
|
|
308
302
|
await call.microphone.disable();
|
|
309
303
|
}
|
|
@@ -312,7 +306,7 @@ const useApplyDevicePreferences = (key) => {
|
|
|
312
306
|
}
|
|
313
307
|
};
|
|
314
308
|
const initCamera = async (setting) => {
|
|
315
|
-
await call.camera.select(setting.selectedDeviceId);
|
|
309
|
+
await call.camera.select(parseDeviceId(setting.selectedDeviceId));
|
|
316
310
|
if (setting.muted) {
|
|
317
311
|
await call.camera.disable();
|
|
318
312
|
}
|
|
@@ -321,7 +315,7 @@ const useApplyDevicePreferences = (key) => {
|
|
|
321
315
|
}
|
|
322
316
|
};
|
|
323
317
|
const initSpeaker = (setting) => {
|
|
324
|
-
call.speaker.select(setting.selectedDeviceId);
|
|
318
|
+
call.speaker.select(parseDeviceId(setting.selectedDeviceId) ?? '');
|
|
325
319
|
};
|
|
326
320
|
let preferences = null;
|
|
327
321
|
try {
|
|
@@ -335,18 +329,11 @@ const useApplyDevicePreferences = (key) => {
|
|
|
335
329
|
await initCamera(preferences.camera);
|
|
336
330
|
initSpeaker(preferences.speaker);
|
|
337
331
|
}
|
|
338
|
-
else {
|
|
339
|
-
const { audio, video } = settings;
|
|
340
|
-
if (audio.mic_default_on)
|
|
341
|
-
await call.microphone.enable();
|
|
342
|
-
if (video.camera_default_on)
|
|
343
|
-
await call.camera.enable();
|
|
344
|
-
}
|
|
345
332
|
};
|
|
346
333
|
apply().catch((err) => {
|
|
347
334
|
console.warn('Failed to apply device preferences', err);
|
|
348
335
|
});
|
|
349
|
-
}, [call, key
|
|
336
|
+
}, [call, key]);
|
|
350
337
|
};
|
|
351
338
|
/**
|
|
352
339
|
* This hook will apply and persist the device preferences from local storage.
|
|
@@ -357,6 +344,7 @@ const usePersistedDevicePreferences = (key = '@stream-io/device-preferences') =>
|
|
|
357
344
|
useApplyDevicePreferences(key);
|
|
358
345
|
usePersistDevicePreferences(key);
|
|
359
346
|
};
|
|
347
|
+
const parseDeviceId = (deviceId) => deviceId !== defaultDevice ? deviceId : undefined;
|
|
360
348
|
|
|
361
349
|
const SCROLL_THRESHOLD = 10;
|
|
362
350
|
/**
|
|
@@ -2616,7 +2604,7 @@ const LivestreamPlayer = (props) => {
|
|
|
2616
2604
|
return (jsxRuntime.jsx(StreamCall, { call: call, children: jsxRuntime.jsx(LivestreamLayout, { ...layoutProps }) }));
|
|
2617
2605
|
};
|
|
2618
2606
|
|
|
2619
|
-
const [major, minor, patch] = ("1.2.
|
|
2607
|
+
const [major, minor, patch] = ("1.2.18" ).split('.');
|
|
2620
2608
|
videoClient.setSdkInfo({
|
|
2621
2609
|
type: videoClient.SfuModels.SdkType.REACT,
|
|
2622
2610
|
major,
|