diff --git a/frontend/assets/js/result2.js b/frontend/assets/js/result2.js index 4a0993b..f4637d0 100644 --- a/frontend/assets/js/result2.js +++ b/frontend/assets/js/result2.js @@ -19,6 +19,7 @@ document.addEventListener('alpine:init', () => { isDownloadReady: false, copyBtnText: 'Copy URL', scrollAnimationId: null, + videoGenerationFailed: false, hasError: false, errorTitle: '', errorMessage: '', @@ -180,6 +181,13 @@ document.addEventListener('alpine:init', () => { const response = await fetch(`${API_BASE_URL}/api/results/${this.sessionId}`); const data = await response.json(); + // Check if video generation failed + if (data.success === false || data.status === 'fail') { + console.log('[Result API] Video generation failed.'); + this.videoGenerationFailed = true; + return true; // Stop polling + } + if (data.pet_name) { //this.petName = data.pet_name.toLowerCase().replace(/\s+/g, '-'); //this.petName = `${data.pet_name}'s`; @@ -323,6 +331,11 @@ document.addEventListener('alpine:init', () => { if (this.isDownloadReady) { return null; // No status text when ready } + + if (this.videoGenerationFailed) { + return null; // Hide status when video failed + } + if (this.timerEnded && !this.videoUrl) { return 'Your video is still processing, almost there...'; } diff --git a/frontend/result.php b/frontend/result.php index 3a82198..8ee7512 100644 --- a/frontend/result.php +++ b/frontend/result.php @@ -104,15 +104,23 @@ Download now to keep your song -
After downloading, you’ll find your Pet Love Song in ‘Files’ (iPhone) or ‘Downloads’ (Android).
+
+ + +