Skip to content

Commit e4e0f78

Browse files
committed
added autoupdate for path a checks on ffmpeg download
1 parent 560621a commit e4e0f78

3 files changed

Lines changed: 10 additions & 6 deletions

File tree

src-frontend/components/settings/FFmpegDownloadProgress.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,9 @@ export function FFmpegDownloadProgress({
5454

5555
const handleDownload = async () => {
5656
try {
57-
await startDownload();
58-
if (ffmpegPath && onComplete) {
59-
onComplete(ffmpegPath);
57+
const path = await startDownload();
58+
if (path && onComplete) {
59+
onComplete(path);
6060
}
6161
} catch {
6262
// Error is handled by the hook

src-frontend/hooks/useFFmpegDownload.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ export interface FFmpegDownloadState {
3030
versionInfo: FFmpegVersionInfo | null;
3131
/** Whether version check is in progress */
3232
isCheckingVersion: boolean;
33-
/** Start the FFmpeg download */
34-
startDownload: () => Promise<void>;
33+
/** Start the FFmpeg download, returns the path on success */
34+
startDownload: () => Promise<string>;
3535
/** Cancel the current download */
3636
cancelDownload: () => Promise<void>;
3737
/** Check for an existing bundled FFmpeg */
@@ -116,7 +116,7 @@ export function useFFmpegDownload(): FFmpegDownloadState {
116116
}, []);
117117

118118
// Start the FFmpeg download
119-
const startDownload = useCallback(async (): Promise<void> => {
119+
const startDownload = useCallback(async (): Promise<string> => {
120120
setIsDownloading(true);
121121
setError(null);
122122
setProgress({
@@ -130,6 +130,7 @@ export function useFFmpegDownload(): FFmpegDownloadState {
130130
const path = await invoke<string>('download_ffmpeg');
131131
setFFmpegPath(path);
132132
setIsDownloading(false);
133+
return path;
133134
} catch (err) {
134135
const errorMessage = String(err);
135136
setError(errorMessage);

src-frontend/views/Settings.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -313,6 +313,9 @@ export function Settings() {
313313
<FFmpegDownloadProgress
314314
installedVersion={settings.ffmpegVersion || undefined}
315315
onComplete={(path: string) => {
316+
// Immediately update local state for live feedback
317+
setSettings((prev) => ({ ...prev, ffmpegPath: path }));
318+
// Save to backend
316319
saveSettings({ ffmpegPath: path });
317320
// Refresh FFmpeg version
318321
api.system

0 commit comments

Comments
 (0)