fix: show image viewer for video-to-gif/webp results instead of broken video player

When a video tool produces a non-video output (gif, webp, png), the
media player can't render it. Now detects the processed file extension
and switches to ImageViewer for image outputs while keeping the video
player for the input preview.
This commit is contained in:
SnapOtter
2026-06-14 21:30:54 +08:00
parent 69300b5c83
commit 90acd5bcd9
+14
View File
@@ -641,6 +641,20 @@ export function ToolPage() {
);
}
}
// Tools that convert video to a non-video format (gif, webp, frames):
// after processing, show the result as an image instead of a video player
if (hasProcessed && processedUrl) {
const ext = (currentEntry?.processedFilename ?? "").split(".").pop()?.toLowerCase();
if (ext && ["gif", "webp", "png", "jpg", "jpeg", "apng"].includes(ext)) {
return (
<ImageViewer
src={processedUrl}
filename={currentEntry?.processedFilename ?? ""}
fileSize={currentEntry?.processedSize ?? 0}
/>
);
}
}
return (
<Suspense fallback={<div className="text-sm text-muted-foreground">Loading...</div>}>
<MediaPlayerView />