From a85089c607992bd237c5826507e407db5340bb0e Mon Sep 17 00:00:00 2001 From: Anil Matcha Date: Mon, 9 Mar 2026 19:17:11 +0530 Subject: [PATCH] Video generation fix --- src/components/VideoStudio.js | 35 +++++++++++++++++++++++++++++------ 1 file changed, 29 insertions(+), 6 deletions(-) diff --git a/src/components/VideoStudio.js b/src/components/VideoStudio.js index a921f2e..457c1bf 100644 --- a/src/components/VideoStudio.js +++ b/src/components/VideoStudio.js @@ -877,12 +877,35 @@ export function VideoStudio() { } if (imageMode) { - await new Promise(resolve => setTimeout(resolve, 2500)); - const genId = Date.now().toString(); - lastGenerationId = genId; - lastGenerationModel = selectedModel; - addToHistory({ id: genId, url: 'https://cdn.muapi.ai/outputs/96bbb7e2df3241c5a27971726a615ef1.mp4', prompt, model: selectedModel, aspect_ratio: selectedAr, duration: selectedDuration, timestamp: new Date().toISOString() }); - showVideoInCanvas('https://cdn.muapi.ai/outputs/96bbb7e2df3241c5a27971726a615ef1.mp4', selectedModel); + const i2vParams = { + model: selectedModel, + image_url: uploadedImageUrl, + }; + if (prompt) i2vParams.prompt = prompt; + i2vParams.aspect_ratio = selectedAr; + const durations = getCurrentDurations(selectedModel); + if (durations.length > 0) i2vParams.duration = selectedDuration; + const resolutions = getCurrentResolutions(selectedModel); + if (resolutions.length > 0) i2vParams.resolution = selectedResolution; + if (selectedQuality) i2vParams.quality = selectedQuality; + + const res = await muapi.generateI2V(i2vParams); + console.log('[VideoStudio] I2V response:', res); + + if (res && res.url) { + const genId = res.id || res.request_id || Date.now().toString(); + if (selectedModel === 'seedance-v2.0-i2v') { + lastGenerationId = genId; + lastGenerationModel = selectedModel; + } else { + lastGenerationId = null; + lastGenerationModel = null; + } + addToHistory({ id: genId, url: res.url, prompt, model: selectedModel, aspect_ratio: selectedAr, duration: selectedDuration, timestamp: new Date().toISOString() }); + showVideoInCanvas(res.url, selectedModel); + } else { + throw new Error('No video URL returned by API'); + } generateBtn.disabled = false; generateBtn.innerHTML = `Generate ✨`; return;