Fixing comparison of constraints state
Comparison was broken because we were not performing a deep comparison.
This commit is contained in:
parent
003bc86262
commit
a99815a1b4
@ -43,6 +43,7 @@
|
||||
"cross-env": "^7.0.3",
|
||||
"deep-copy-ts": "^0.5.0",
|
||||
"easystarjs": "^0.4.4",
|
||||
"fast-deep-equal": "^3.1.3",
|
||||
"generic-type-guard": "^3.4.2",
|
||||
"google-protobuf": "^3.13.0",
|
||||
"phaser": "^3.54.0",
|
||||
|
@ -12,6 +12,7 @@ import { privacyShutdownStore } from "./PrivacyShutdownStore";
|
||||
import { MediaStreamConstraintsError } from "./Errors/MediaStreamConstraintsError";
|
||||
import { SoundMeter } from "../Phaser/Components/SoundMeter";
|
||||
import { visibilityStore } from "./VisibilityStore";
|
||||
import deepEqual from "fast-deep-equal";
|
||||
|
||||
/**
|
||||
* A store that contains the camera state requested by the user (on or off).
|
||||
@ -242,7 +243,6 @@ export const mediaStreamConstraintsStore = derived(
|
||||
privacyShutdownStore,
|
||||
cameraEnergySavingStore,
|
||||
isSilentStore,
|
||||
visibilityStore,
|
||||
],
|
||||
(
|
||||
[
|
||||
@ -255,7 +255,6 @@ export const mediaStreamConstraintsStore = derived(
|
||||
$privacyShutdownStore,
|
||||
$cameraEnergySavingStore,
|
||||
$isSilentStore,
|
||||
$visibilityStore,
|
||||
],
|
||||
set
|
||||
) => {
|
||||
@ -317,10 +316,10 @@ export const mediaStreamConstraintsStore = derived(
|
||||
currentAudioConstraint = false;
|
||||
}
|
||||
|
||||
// Let's make the changes only if the new value is different from the old one.
|
||||
// Let's make the changes only if the new value is different from the old one.tile
|
||||
if (
|
||||
previousComputedVideoConstraint != currentVideoConstraint ||
|
||||
previousComputedAudioConstraint != currentAudioConstraint
|
||||
!deepEqual(previousComputedVideoConstraint, currentVideoConstraint) ||
|
||||
!deepEqual(previousComputedAudioConstraint, currentAudioConstraint)
|
||||
) {
|
||||
previousComputedVideoConstraint = currentVideoConstraint;
|
||||
previousComputedAudioConstraint = currentAudioConstraint;
|
||||
|
Loading…
Reference in New Issue
Block a user