diff --git a/frontend/src/pages/Watch.jsx b/frontend/src/pages/Watch.jsx index 300ba07..66e91e9 100644 --- a/frontend/src/pages/Watch.jsx +++ b/frontend/src/pages/Watch.jsx @@ -710,7 +710,7 @@ export default function Watch() { }, [playRequested, fileReady, dlStatus?.status, dlStatus?.file_url, video?.is_downloaded, youtubeVideoId, pollForFile]); // eslint-disable-line react-hooks/exhaustive-deps const downloadMut = useMutation({ - mutationFn: () => createDownload(youtubeVideoId, selectedQuality), + mutationFn: (quality) => createDownload(youtubeVideoId, quality ?? selectedQuality), onSuccess: (res) => { setDownloadId(res.data.id); refetchVideo(); @@ -722,7 +722,7 @@ export default function Watch() { setPlayRequested(true); downloadMut.mutate(); }, [downloadMut]); - const handleRedownload = useCallback(async () => { + const handleRedownload = useCallback(async (quality) => { const dlId = downloadId ?? allDownloads.find( d => d.youtube_video_id === youtubeVideoId && d.status === "complete" )?.id; @@ -736,7 +736,7 @@ export default function Watch() { setIsRedownloading(false); qc.invalidateQueries({ queryKey: ["downloads"] }); refetchVideo(); - downloadMut.mutate(); + downloadMut.mutate(quality); }, [downloadId, allDownloads, youtubeVideoId, downloadMut, refetchVideo, qc]); const saveProgress = useCallback((secs) => { @@ -933,7 +933,11 @@ export default function Watch() { {!isDownloading && !downloadMut.isPending && !isRedownloading && (