Skip to content

armgit / Cap

Public Imported from GitHub
0

Open source Loom alternative. Beautiful, shareable screen recordings.

version: 0.2.6 - Camera mirror option/toggle

Richie McIlroy8329402bc2f0
diff --git a/apps/desktop/src/components/windows/Camera.tsx b/apps/desktop/src/components/windows/Camera.tsx
index d9e364669..fd6cf7a26 100644
--- a/apps/desktop/src/components/windows/Camera.tsx
+++ b/apps/desktop/src/components/windows/Camera.tsx
@@ -13,7 +13,9 @@ export const Camera = () => {
const [isLoading, setIsLoading] = useState(true);
const tauriWindowImport = import("@tauri-apps/api/window");
const [cameraMirrored, setCameraMirrored] = useState(
- localStorage.getItem("cameraMirrored") || "false"
+ typeof window !== "undefined"
+ ? localStorage.getItem("cameraMirrored") || "false"
+ : "false"
);
useEffect(() => {
@@ -55,7 +57,9 @@ export const Camera = () => {
video.style.transform =
newCameraMirrored === "true" ? "scaleX(-1)" : "scaleX(1)";
setCameraMirrored(newCameraMirrored);
- localStorage.setItem("cameraMirrored", newCameraMirrored);
+ if (typeof window !== "undefined") {
+ localStorage.setItem("cameraMirrored", newCameraMirrored);
+ }
}
};