@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/dist/index.es.js CHANGED
@@ -87,11 +87,14 @@ const usePersistedDevicePreferences = (key = '@stream-io/device-preferences') =>
87
87
  const cameraState = useCameraState();
88
88
  const speakerState = useSpeakerState();
89
89
  const [applyingState, setApplyingState] = useState('idle');
90
+ // when the camera is disabled on call type level, we should discard
91
+ // any stored camera preferences.
92
+ const cameraDevices = settings?.video?.enabled ? cameraState.devices : false;
90
93
  useEffect(function apply() {
91
94
  if (callingState === CallingState.LEFT ||
92
- !microphoneState.devices.length ||
93
- !cameraState.devices.length ||
94
- !speakerState.devices ||
95
+ microphoneState.devices.length === 0 ||
96
+ (Array.isArray(cameraDevices) && cameraDevices.length === 0) ||
97
+ speakerState.devices.length === 0 ||
95
98
  !settings ||
96
99
  applyingState !== 'idle') {
97
100
  return;
@@ -108,7 +111,7 @@ const usePersistedDevicePreferences = (key = '@stream-io/device-preferences') =>
108
111
  const preference = preferences[deviceKey];
109
112
  const manager = state[deviceKey];
110
113
  const applyPromise = preference
111
- ? applyLocalDevicePreference(manager, [preference].flat(), state.devices, enabledInCallType)
114
+ ? applyLocalDevicePreference(manager, [preference].flat(), deviceKey === 'camera' ? cameraDevices || [] : state.devices, enabledInCallType)
112
115
  : applyMutedState(manager, defaultMuted, enabledInCallType);
113
116
  await applyPromise.catch((err) => {
114
117
  console.warn(`Failed to apply ${deviceKey} device preferences`, err);
@@ -119,7 +122,7 @@ const usePersistedDevicePreferences = (key = '@stream-io/device-preferences') =>
119
122
  applyingState,
120
123
  callingState,
121
124
  cameraState,
122
- cameraState.devices,
125
+ cameraDevices,
123
126
  key,
124
127
  microphoneState,
125
128
  microphoneState.devices,
@@ -134,7 +137,7 @@ const usePersistedDevicePreferences = (key = '@stream-io/device-preferences') =>
134
137
  for (const [deviceKey, devices, selectedDevice, isMute] of [
135
138
  [
136
139
  'camera',
137
- cameraState.devices,
140
+ cameraDevices || [],
138
141
  cameraState.selectedDevice,
139
142
  cameraState.isMute,
140
143
  ],
@@ -165,7 +168,7 @@ const usePersistedDevicePreferences = (key = '@stream-io/device-preferences') =>
165
168
  }, [
166
169
  applyingState,
167
170
  callingState,
168
- cameraState.devices,
171
+ cameraDevices,
169
172
  cameraState.isMute,
170
173
  cameraState.selectedDevice,
171
174
  key,
@@ -2957,7 +2960,7 @@ const checkCanJoinEarly = (startsAt, joinAheadTimeSeconds) => {
2957
2960
  return Date.now() >= +startsAt - (joinAheadTimeSeconds ?? 0) * 1000;
2958
2961
  };
2959
2962
 
2960
- const [major, minor, patch] = ("1.19.5").split('.');
2963
+ const [major, minor, patch] = ("1.19.6").split('.');
2961
2964
  setSdkInfo({
2962
2965
  type: SfuModels.SdkType.REACT,
2963
2966
  major,