Fix dl issue
Some checks failed
ci / Deployment (push) Waiting to run
ci / Image build (push) Has been cancelled

This commit is contained in:
Joris Bertomeu
2025-08-26 20:20:36 +02:00
parent a750b52832
commit c05981713e
3 changed files with 17 additions and 20 deletions

View File

@@ -172,24 +172,17 @@ export class AppComponent implements OnInit {
}
downloadFileFromAPI(filePath: string, filename: string, job: any) {
job.isDownloading = true;
this.videoProcessingService.downloadFile(`${job.data.mp4Filename}/${filename}`).subscribe({
next: (response) => {
const blob = new Blob([response], { type: 'video/mkv' });
const url = window.URL.createObjectURL(blob);
const a = document.createElement('a');
a.href = url;
a.download = filename;
a.click();
window.URL.revokeObjectURL(url);
job.isDownloading = false;
},
error: (error) => {
console.error('Error downloading file:', error);
job.isDownloading = false;
}
});
}
job.isDownloading = true;
// Redirection directe vers l'URL de téléchargement
const encodedPath = encodeURIComponent(`${job.data.mp4Filename}/${filename}`);
window.open(this.videoProcessingService.getDownloadUrl(`${job.data.mp4Filename}/${filename}`), '_blank');
// Simuler un délai pour l'UX, puis remettre le flag à false
setTimeout(() => {
job.isDownloading = false;
}, 2000);
}
processUpdate(item: any, binType: string) {
item.isUpdating = true;

View File

@@ -35,6 +35,10 @@ export class VideoProcessingService {
return this.http.get(`${this.apiUrl}/download?filename=${encodeURIComponent(filename)}`, { responseType: 'blob' });
}
getDownloadUrl(filename: string): string {
return `${this.apiUrl}/download?filename=${encodeURIComponent(filename)}`;
}
flushQueue(): Observable<any> {
return this.http.delete<any>(`${this.apiUrl}/jobs/completed`, {});
}

View File

@@ -1,4 +1,4 @@
export const environment = {
serviceEndpoint: '/api'
//serviceEndpoint: 'http://192.168.1.230:6080/api'
//serviceEndpoint: '/api'
serviceEndpoint: 'http://192.168.1.230:6080/api'
};