@stream-io/video-react-sdk 1.31.0 → 1.31.2

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 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.31.2](https://github.com/GetStream/stream-video-js/compare/@stream-io/video-react-sdk-1.31.1...@stream-io/video-react-sdk-1.31.2) (2026-01-15)
6
+
7
+ ### Dependency Updates
8
+
9
+ - `@stream-io/video-client` updated to version `1.40.2`
10
+ - `@stream-io/video-react-bindings` updated to version `1.12.9`
11
+
12
+ ## [1.31.1](https://github.com/GetStream/stream-video-js/compare/@stream-io/video-react-sdk-1.31.0...@stream-io/video-react-sdk-1.31.1) (2026-01-14)
13
+
14
+ ### Dependency Updates
15
+
16
+ - `@stream-io/video-client` updated to version `1.40.1`
17
+ - `@stream-io/video-react-bindings` updated to version `1.12.8`
18
+
19
+ ### Bug Fixes
20
+
21
+ - ensure proper set up of server-side preferences for mic and camera ([#2080](https://github.com/GetStream/stream-video-js/issues/2080)) ([3529c8f](https://github.com/GetStream/stream-video-js/commit/3529c8fc0233d3f9f8f21c80cffc4ec27334954f))
22
+
5
23
  ## [1.31.0](https://github.com/GetStream/stream-video-js/compare/@stream-io/video-react-sdk-1.30.1...@stream-io/video-react-sdk-1.31.0) (2026-01-09)
6
24
 
7
25
  ### Dependency Updates
package/dist/index.cjs.js CHANGED
@@ -85,6 +85,28 @@ const usePersistedDevicePreferences = (key = '@stream-io/device-preferences') =>
85
85
  const cameraState = useCameraState();
86
86
  const speakerState = useSpeakerState();
87
87
  const [applyingState, setApplyingState] = react.useState('idle');
88
+ const call = videoReactBindings.useCall();
89
+ // Set deferServerDefaults flag synchronously during render.
90
+ // Please ensure the flag is set BEFORE any call.get() or call.getOrCreate()
91
+ // is called, preventing server defaults from overriding user preferences.
92
+ const deferredCallRef = react.useRef(null);
93
+ if (call && deferredCallRef.current !== call) {
94
+ call.camera.deferServerDefaults = true;
95
+ call.microphone.deferServerDefaults = true;
96
+ deferredCallRef.current = call;
97
+ }
98
+ // Cleanup: reset the flag when the component unmounts or call changes.
99
+ // This allows server defaults to apply if the hook is no longer used.
100
+ react.useEffect(() => {
101
+ return () => {
102
+ const currentCall = deferredCallRef.current;
103
+ if (currentCall) {
104
+ currentCall.camera.deferServerDefaults = false;
105
+ currentCall.microphone.deferServerDefaults = false;
106
+ deferredCallRef.current = null;
107
+ }
108
+ };
109
+ }, [call]);
88
110
  // when the camera is disabled on call type level, we should discard
89
111
  // any stored camera preferences.
90
112
  const cameraDevices = settings?.video?.enabled ? cameraState.devices : false;
@@ -178,91 +200,6 @@ const usePersistedDevicePreferences = (key = '@stream-io/device-preferences') =>
178
200
  speakerState.selectedDevice,
179
201
  ]);
180
202
  };
181
- // const usePersistedDevicePreference = <K extends DeviceKey>(
182
- // key: string,
183
- // deviceKey: K,
184
- // state: DeviceState<K>,
185
- // defaultMuted?: boolean,
186
- // ): void => {
187
- // const { useCallCallingState } = useCallStateHooks();
188
- // const callingState = useCallCallingState();
189
- // const [applyingState, setApplyingState] = useState<
190
- // 'idle' | 'applying' | 'applied'
191
- // >('idle');
192
- // const manager = state[deviceKey];
193
- // useEffect(
194
- // function apply() {
195
- // if (
196
- // callingState === CallingState.LEFT ||
197
- // !state.devices?.length ||
198
- // typeof defaultMuted !== 'boolean' ||
199
- // applyingState !== 'idle'
200
- // ) {
201
- // return;
202
- // }
203
- // const preferences = parseLocalDevicePreferences(key);
204
- // const preference = preferences[deviceKey];
205
- // setApplyingState('applying');
206
- // if (!manager.state.selectedDevice) {
207
- // const applyPromise = preference
208
- // ? applyLocalDevicePreference(
209
- // manager,
210
- // [preference].flat(),
211
- // state.devices,
212
- // )
213
- // : applyMutedState(manager, defaultMuted);
214
- // applyPromise
215
- // .catch((err) => {
216
- // console.warn(
217
- // `Failed to apply ${deviceKey} device preferences`,
218
- // err,
219
- // );
220
- // })
221
- // .finally(() => setApplyingState('applied'));
222
- // } else {
223
- // setApplyingState('applied');
224
- // }
225
- // },
226
- // [
227
- // applyingState,
228
- // callingState,
229
- // defaultMuted,
230
- // deviceKey,
231
- // key,
232
- // manager,
233
- // state.devices,
234
- // ],
235
- // );
236
- // useEffect(
237
- // function persist() {
238
- // if (
239
- // callingState === CallingState.LEFT ||
240
- // !state.devices?.length ||
241
- // applyingState !== 'applied'
242
- // ) {
243
- // return;
244
- // }
245
- // try {
246
- // patchLocalDevicePreference(key, deviceKey, {
247
- // devices: state.devices,
248
- // selectedDevice: state.selectedDevice,
249
- // isMute: state.isMute,
250
- // });
251
- // } catch (err) {
252
- // console.warn(`Failed to save ${deviceKey} device preferences`, err);
253
- // }
254
- // },
255
- // [
256
- // applyingState,
257
- // callingState,
258
- // deviceKey,
259
- // key,
260
- // state.devices,
261
- // state.isMute,
262
- // state.selectedDevice,
263
- // ],
264
- // );
265
- // };
266
203
  const parseLocalDevicePreferences = (key) => {
267
204
  const preferencesStr = window.localStorage.getItem(key);
268
205
  let preferences = {};
@@ -1564,7 +1501,7 @@ const SpeakerTest = (props) => {
1564
1501
  const audioElementRef = react.useRef(null);
1565
1502
  const [isPlaying, setIsPlaying] = react.useState(false);
1566
1503
  const { t } = videoReactBindings.useI18n();
1567
- const { audioUrl = `https://unpkg.com/${"@stream-io/video-react-sdk"}@${"1.31.0"}/assets/piano.mp3`, } = props;
1504
+ const { audioUrl = `https://unpkg.com/${"@stream-io/video-react-sdk"}@${"1.31.2"}/assets/piano.mp3`, } = props;
1568
1505
  // Update audio output device when selection changes
1569
1506
  react.useEffect(() => {
1570
1507
  const audio = audioElementRef.current;
@@ -3281,7 +3218,7 @@ const checkCanJoinEarly = (startsAt, joinAheadTimeSeconds) => {
3281
3218
  return Date.now() >= +startsAt - (joinAheadTimeSeconds ?? 0) * 1000;
3282
3219
  };
3283
3220
 
3284
- const [major, minor, patch] = ("1.31.0").split('.');
3221
+ const [major, minor, patch] = ("1.31.2").split('.');
3285
3222
  videoClient.setSdkInfo({
3286
3223
  type: videoClient.SfuModels.SdkType.REACT,
3287
3224
  major,