只有 iframe 真正完成时才会完成。

This commit is contained in:
qikongjian 2025-09-03 21:38:26 +08:00
parent 8c7fb3f994
commit a3ae89e81a

View File

@ -84,7 +84,6 @@ export const AIEditingIframe: React.FC<AIEditingIframeProps> = ({
const [isProcessing, setIsProcessing] = useState(false);
const iframeRef = useRef<HTMLIFrameElement>(null);
const progressIntervalRef = useRef<NodeJS.Timeout | null>(null);
const timeoutRef = useRef<NodeJS.Timeout | null>(null);
// 构建智能剪辑URL
const aiEditingUrl = `https://smartcut.movieflow.ai/ai-editor/${projectId}?token=${token}&user_id=${userId}&auto=true&embedded=true`;
@ -124,11 +123,7 @@ export const AIEditingIframe: React.FC<AIEditingIframeProps> = ({
clearInterval(progressIntervalRef.current);
progressIntervalRef.current = null;
}
// 清理超时
if (timeoutRef.current) {
clearTimeout(timeoutRef.current);
timeoutRef.current = null;
}
onComplete({
videoUrl: data.videoUrl,
@ -151,11 +146,7 @@ export const AIEditingIframe: React.FC<AIEditingIframeProps> = ({
clearInterval(progressIntervalRef.current);
progressIntervalRef.current = null;
}
// 清理超时
if (timeoutRef.current) {
clearTimeout(timeoutRef.current);
timeoutRef.current = null;
}
onError(data.error);
break;
@ -182,11 +173,7 @@ export const AIEditingIframe: React.FC<AIEditingIframeProps> = ({
clearInterval(progressIntervalRef.current);
progressIntervalRef.current = null;
}
// 清理超时
if (timeoutRef.current) {
clearTimeout(timeoutRef.current);
timeoutRef.current = null;
}
};
}, [onComplete, onError, onProgress]);