@stream-io/video-react-sdk 1.19.3 → 1.19.5
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 +13 -0
- package/dist/index.cjs.js +12 -11
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +12 -11
- package/dist/index.es.js.map +1 -1
- package/package.json +3 -3
- package/src/hooks/usePersistedDevicePreferences.ts +15 -8
package/dist/index.es.js
CHANGED
|
@@ -98,17 +98,18 @@ const usePersistedDevicePreferences = (key = '@stream-io/device-preferences') =>
|
|
|
98
98
|
}
|
|
99
99
|
setApplyingState('applying');
|
|
100
100
|
(async () => {
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
['
|
|
104
|
-
['
|
|
101
|
+
const { audio, video } = settings;
|
|
102
|
+
for (const [deviceKey, state, defaultMuted, enabledInCallType] of [
|
|
103
|
+
['microphone', microphoneState, !audio.mic_default_on, true],
|
|
104
|
+
['camera', cameraState, !video.camera_default_on, video.enabled],
|
|
105
|
+
['speaker', speakerState, false, true],
|
|
105
106
|
]) {
|
|
106
107
|
const preferences = parseLocalDevicePreferences(key);
|
|
107
108
|
const preference = preferences[deviceKey];
|
|
108
109
|
const manager = state[deviceKey];
|
|
109
110
|
const applyPromise = preference
|
|
110
|
-
? applyLocalDevicePreference(manager, [preference].flat(), state.devices)
|
|
111
|
-
: applyMutedState(manager, defaultMuted);
|
|
111
|
+
? applyLocalDevicePreference(manager, [preference].flat(), state.devices, enabledInCallType)
|
|
112
|
+
: applyMutedState(manager, defaultMuted, enabledInCallType);
|
|
112
113
|
await applyPromise.catch((err) => {
|
|
113
114
|
console.warn(`Failed to apply ${deviceKey} device preferences`, err);
|
|
114
115
|
});
|
|
@@ -298,7 +299,7 @@ const patchLocalDevicePreference = (key, deviceKey, state) => {
|
|
|
298
299
|
].slice(0, 3),
|
|
299
300
|
}));
|
|
300
301
|
};
|
|
301
|
-
const applyLocalDevicePreference = async (manager, preference, devices) => {
|
|
302
|
+
const applyLocalDevicePreference = async (manager, preference, devices, enabledInCallType) => {
|
|
302
303
|
let muted;
|
|
303
304
|
for (const p of preference) {
|
|
304
305
|
muted ?? (muted = p.muted);
|
|
@@ -316,11 +317,11 @@ const applyLocalDevicePreference = async (manager, preference, devices) => {
|
|
|
316
317
|
}
|
|
317
318
|
}
|
|
318
319
|
if (typeof muted === 'boolean') {
|
|
319
|
-
await applyMutedState(manager, muted);
|
|
320
|
+
await applyMutedState(manager, muted, enabledInCallType);
|
|
320
321
|
}
|
|
321
322
|
};
|
|
322
|
-
const applyMutedState = async (manager, muted) => {
|
|
323
|
-
if (!manager.state.status) {
|
|
323
|
+
const applyMutedState = async (manager, muted, enabledInCallType) => {
|
|
324
|
+
if (enabledInCallType && !manager.state.status) {
|
|
324
325
|
await manager[muted ? 'disable' : 'enable']?.();
|
|
325
326
|
}
|
|
326
327
|
};
|
|
@@ -2956,7 +2957,7 @@ const checkCanJoinEarly = (startsAt, joinAheadTimeSeconds) => {
|
|
|
2956
2957
|
return Date.now() >= +startsAt - (joinAheadTimeSeconds ?? 0) * 1000;
|
|
2957
2958
|
};
|
|
2958
2959
|
|
|
2959
|
-
const [major, minor, patch] = ("1.19.
|
|
2960
|
+
const [major, minor, patch] = ("1.19.5").split('.');
|
|
2960
2961
|
setSdkInfo({
|
|
2961
2962
|
type: SfuModels.SdkType.REACT,
|
|
2962
2963
|
major,
|