@stream-io/video-react-sdk 0.5.6 → 0.5.7

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stream-io/video-react-sdk",
3
- "version": "0.5.6",
3
+ "version": "0.5.7",
4
4
  "packageManager": "yarn@3.2.4",
5
5
  "main": "./dist/index.cjs.js",
6
6
  "module": "./dist/index.es.js",
@@ -29,8 +29,8 @@
29
29
  ],
30
30
  "dependencies": {
31
31
  "@floating-ui/react": "^0.26.5",
32
- "@stream-io/video-client": "^0.6.4",
33
- "@stream-io/video-react-bindings": "^0.4.4",
32
+ "@stream-io/video-client": "^0.6.5",
33
+ "@stream-io/video-react-bindings": "^0.4.5",
34
34
  "chart.js": "^4.4.1",
35
35
  "clsx": "^2.0.0",
36
36
  "react-chartjs-2": "^5.2.0"
@@ -1,4 +1,5 @@
1
1
  import { useEffect } from 'react';
2
+ import { CallingState } from '@stream-io/video-client';
2
3
  import { useCall, useCallStateHooks } from '@stream-io/video-react-bindings';
3
4
 
4
5
  export type LocalDevicePreference = {
@@ -22,12 +23,14 @@ const usePersistDevicePreferences = (key: string) => {
22
23
  useSpeakerState,
23
24
  useCallSettings,
24
25
  } = useCallStateHooks();
26
+ const call = useCall();
25
27
  const mic = useMicrophoneState();
26
28
  const camera = useCameraState();
27
29
  const speaker = useSpeakerState();
28
30
  const settings = useCallSettings();
29
31
  useEffect(() => {
30
- if (!settings) return;
32
+ if (!call || !settings) return;
33
+ if (call.state.callingState === CallingState.LEFT) return;
31
34
  try {
32
35
  const hasPreferences = !!window.localStorage.getItem(key);
33
36
  const { audio, video } = settings;
@@ -51,6 +54,7 @@ const usePersistDevicePreferences = (key: string) => {
51
54
  console.warn('Failed to save device preferences', err);
52
55
  }
53
56
  }, [
57
+ call,
54
58
  camera.isMute,
55
59
  camera.selectedDevice,
56
60
  key,