From f131a681ab8e5c13e8bd992cf8b4516f905df436 Mon Sep 17 00:00:00 2001 From: "[dyad]" Date: Fri, 30 Jan 2026 08:28:59 +0100 Subject: [PATCH] [dyad] Add clear button to remove video - wrote 1 file(s) --- src/components/video-editor.tsx | 57 ++++++++++++++++++++++----------- 1 file changed, 38 insertions(+), 19 deletions(-) diff --git a/src/components/video-editor.tsx b/src/components/video-editor.tsx index cdfef46..ebf7a21 100644 --- a/src/components/video-editor.tsx +++ b/src/components/video-editor.tsx @@ -7,7 +7,7 @@ import { Input } from "@/components/ui/input"; import { Label } from "@/components/ui/label"; import { Slider } from "@/components/ui/slider"; import { Progress } from "@/components/ui/progress"; -import { UploadCloud, Scissors, Download, Loader2, RotateCcw } from "lucide-react"; +import { UploadCloud, Scissors, Download, Loader2, RotateCcw, Trash2 } from "lucide-react"; import { getFFmpeg } from "@/lib/ffmpeg"; import { fetchFile } from "@ffmpeg/util"; @@ -148,6 +148,19 @@ export function VideoEditor() { } }; + const handleClear = () => { + if (videoSrc) { + URL.revokeObjectURL(videoSrc); + } + setVideoSrc(null); + setVideoFile(null); + setDuration(0); + setTrimValues([0, 0]); + setIsTrimming(false); + setTrimmedVideoUrl(null); + setProgress(0); + }; + return ( @@ -220,25 +233,31 @@ export function VideoEditor() { )} {videoSrc && ( - - - - +
+ + + +
)}