diff --git a/client/src/Pages/ResultsPage.tsx b/client/src/Pages/ResultsPage.tsx index dc80bfb..36988ba 100644 --- a/client/src/Pages/ResultsPage.tsx +++ b/client/src/Pages/ResultsPage.tsx @@ -28,6 +28,26 @@ function ResultsPage() { const mediaFileRef = useRef(null); const audioClass = response.audio_class const isVideo = mediaFile?.type.includes('video'); + + const handleDownloadAll = () => { + if (audioClass === 'Music') { + extractedFiles.forEach(({ name, url }) => { + const link = document.createElement('a'); + link.href = url; + link.download = name; + document.body.appendChild(link); + link.click(); + document.body.removeChild(link); + }); + } else { + const link = document.createElement('a'); + link.href = downloadedFileURL; + link.download = mediaFile?.name ?? 'downloaded_file'; + document.body.appendChild(link); + link.click(); + document.body.removeChild(link); + } + }; useEffect(() => { if (!mediaFile) { @@ -163,7 +183,7 @@ function ResultsPage() { - +