Skip to content

Commit 8329402

Browse files
committed
version: 0.2.6 - Camera mirror option/toggle
1 parent f75d249 commit 8329402

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

apps/desktop/src/components/windows/Camera.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,9 @@ export const Camera = () => {
1313
const [isLoading, setIsLoading] = useState(true);
1414
const tauriWindowImport = import("@tauri-apps/api/window");
1515
const [cameraMirrored, setCameraMirrored] = useState(
16-
localStorage.getItem("cameraMirrored") || "false"
16+
typeof window !== "undefined"
17+
? localStorage.getItem("cameraMirrored") || "false"
18+
: "false"
1719
);
1820

1921
useEffect(() => {
@@ -55,7 +57,9 @@ export const Camera = () => {
5557
video.style.transform =
5658
newCameraMirrored === "true" ? "scaleX(-1)" : "scaleX(1)";
5759
setCameraMirrored(newCameraMirrored);
58-
localStorage.setItem("cameraMirrored", newCameraMirrored);
60+
if (typeof window !== "undefined") {
61+
localStorage.setItem("cameraMirrored", newCameraMirrored);
62+
}
5963
}
6064
};
6165

0 commit comments

Comments
 (0)