diff --git a/src/components/VideoPreview.tsx b/src/components/VideoPreview.tsx index d684c1e5..ce89b639 100644 --- a/src/components/VideoPreview.tsx +++ b/src/components/VideoPreview.tsx @@ -70,14 +70,15 @@ export default function VideoPreview({ useEffect(() => { if (!file) return; - if (urlRef.current) URL.revokeObjectURL(urlRef.current); setIsLoading(true); const id = ++lastId.current; - const url = URL.createObjectURL(file); + // Clean up and revoke the old object URL before allocating a new one if (urlRef.current) { URL.revokeObjectURL(urlRef.current); } + + const url = URL.createObjectURL(file); urlRef.current = url; const video = videoRef.current; @@ -92,7 +93,6 @@ export default function VideoPreview({ }; onLoadedRef.current = handleLoaded; - video.addEventListener("loadeddata", handleLoaded); return () => { @@ -155,7 +155,7 @@ export default function VideoPreview({ // Preview container is 16:9 const containerW = 16; const containerH = 9; - const containerRatio = containerW / containerH; // 1.777… + const containerRatio = containerW / containerH; const outputRatio = preset.width / preset.height; if (recipe.framing === "fit") { @@ -217,14 +217,14 @@ export default function VideoPreview({
{isLoading && (
)} @@ -246,18 +246,18 @@ export default function VideoPreview({ {overlay.mode === "fit" ? ( // Letterbox: semi-transparent bars outside the content area <> -
-
-
-
+
+
+
+
) : ( // Fill/crop: dashed border around the surviving area, dimmed outside <> -
-
-
-
+
+
+
+
setShowOverlay((v) => !v)} className={`absolute top-2 left-2 px-2 py-1 text-[10px] font-heading font-bold uppercase tracking-wider rounded transition-colors z-10 pointer-events-auto ${ showOverlay - ? "bg-[var(--accent)] text-white" - : "bg-[var(--surface)] text-[var(--muted)] hover:bg-[var(--accent-muted)] hover:text-[var(--text)]" + ? "bg-film-600 text-white" + : "bg-black/60 text-white/70 hover:bg-black/80" }`} aria-pressed={showOverlay} aria-label={showOverlay ? "Hide framing overlay" : "Show framing overlay"} @@ -309,8 +309,8 @@ export default function VideoPreview({ onClick={() => setShowComparison((v) => !v)} className={`absolute top-2 right-32 px-2 py-1 text-[10px] font-heading font-bold uppercase tracking-wider rounded transition-colors z-10 pointer-events-auto ${ showComparison - ? "bg-[var(--accent)] text-white" - : "bg-[var(--surface)] text-[var(--muted)] hover:bg-[var(--accent-muted)] hover:text-[var(--text)]" + ? "bg-film-600 text-white" + : "bg-black/60 text-white/70 hover:bg-black/80" }`} aria-pressed={showComparison} aria-label={showComparison ? "Hide comparison preview" : "Show comparison preview"} @@ -325,7 +325,7 @@ export default function VideoPreview({