@stream-io/video-react-sdk 1.19.5 → 1.19.6

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": "1.19.5",
3
+ "version": "1.19.6",
4
4
  "main": "./dist/index.cjs.js",
5
5
  "module": "./dist/index.es.js",
6
6
  "types": "./dist/index.d.ts",
@@ -59,13 +59,16 @@ export const usePersistedDevicePreferences = (
59
59
  'idle' | 'applying' | 'applied'
60
60
  >('idle');
61
61
 
62
+ // when the camera is disabled on call type level, we should discard
63
+ // any stored camera preferences.
64
+ const cameraDevices = settings?.video?.enabled ? cameraState.devices : false;
62
65
  useEffect(
63
66
  function apply() {
64
67
  if (
65
68
  callingState === CallingState.LEFT ||
66
- !microphoneState.devices.length ||
67
- !cameraState.devices.length ||
68
- !speakerState.devices ||
69
+ microphoneState.devices.length === 0 ||
70
+ (Array.isArray(cameraDevices) && cameraDevices.length === 0) ||
71
+ speakerState.devices.length === 0 ||
69
72
  !settings ||
70
73
  applyingState !== 'idle'
71
74
  ) {
@@ -91,7 +94,7 @@ export const usePersistedDevicePreferences = (
91
94
  ? applyLocalDevicePreference(
92
95
  manager,
93
96
  [preference].flat(),
94
- state.devices,
97
+ deviceKey === 'camera' ? cameraDevices || [] : state.devices,
95
98
  enabledInCallType,
96
99
  )
97
100
  : applyMutedState(manager, defaultMuted, enabledInCallType);
@@ -111,7 +114,7 @@ export const usePersistedDevicePreferences = (
111
114
  applyingState,
112
115
  callingState,
113
116
  cameraState,
114
- cameraState.devices,
117
+ cameraDevices,
115
118
  key,
116
119
  microphoneState,
117
120
  microphoneState.devices,
@@ -130,7 +133,7 @@ export const usePersistedDevicePreferences = (
130
133
  for (const [deviceKey, devices, selectedDevice, isMute] of [
131
134
  [
132
135
  'camera',
133
- cameraState.devices,
136
+ cameraDevices || [],
134
137
  cameraState.selectedDevice,
135
138
  cameraState.isMute,
136
139
  ],
@@ -161,7 +164,7 @@ export const usePersistedDevicePreferences = (
161
164
  [
162
165
  applyingState,
163
166
  callingState,
164
- cameraState.devices,
167
+ cameraDevices,
165
168
  cameraState.isMute,
166
169
  cameraState.selectedDevice,
167
170
  key,