File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff 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
Original file line number Diff line number Diff 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 ) ;
Original file line number Diff line number Diff 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
You can’t perform that action at this time.
0 commit comments