forked from 77media/video-flow
只有 iframe 真正完成时才会完成。
This commit is contained in:
parent
8c7fb3f994
commit
a3ae89e81a
@ -84,7 +84,6 @@ export const AIEditingIframe: React.FC<AIEditingIframeProps> = ({
|
|||||||
const [isProcessing, setIsProcessing] = useState(false);
|
const [isProcessing, setIsProcessing] = useState(false);
|
||||||
const iframeRef = useRef<HTMLIFrameElement>(null);
|
const iframeRef = useRef<HTMLIFrameElement>(null);
|
||||||
const progressIntervalRef = useRef<NodeJS.Timeout | null>(null);
|
const progressIntervalRef = useRef<NodeJS.Timeout | null>(null);
|
||||||
const timeoutRef = useRef<NodeJS.Timeout | null>(null);
|
|
||||||
|
|
||||||
// 构建智能剪辑URL
|
// 构建智能剪辑URL
|
||||||
const aiEditingUrl = `https://smartcut.movieflow.ai/ai-editor/${projectId}?token=${token}&user_id=${userId}&auto=true&embedded=true`;
|
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);
|
clearInterval(progressIntervalRef.current);
|
||||||
progressIntervalRef.current = null;
|
progressIntervalRef.current = null;
|
||||||
}
|
}
|
||||||
// 清理超时
|
|
||||||
if (timeoutRef.current) {
|
|
||||||
clearTimeout(timeoutRef.current);
|
|
||||||
timeoutRef.current = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
onComplete({
|
onComplete({
|
||||||
videoUrl: data.videoUrl,
|
videoUrl: data.videoUrl,
|
||||||
@ -151,11 +146,7 @@ export const AIEditingIframe: React.FC<AIEditingIframeProps> = ({
|
|||||||
clearInterval(progressIntervalRef.current);
|
clearInterval(progressIntervalRef.current);
|
||||||
progressIntervalRef.current = null;
|
progressIntervalRef.current = null;
|
||||||
}
|
}
|
||||||
// 清理超时
|
|
||||||
if (timeoutRef.current) {
|
|
||||||
clearTimeout(timeoutRef.current);
|
|
||||||
timeoutRef.current = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
onError(data.error);
|
onError(data.error);
|
||||||
break;
|
break;
|
||||||
@ -182,11 +173,7 @@ export const AIEditingIframe: React.FC<AIEditingIframeProps> = ({
|
|||||||
clearInterval(progressIntervalRef.current);
|
clearInterval(progressIntervalRef.current);
|
||||||
progressIntervalRef.current = null;
|
progressIntervalRef.current = null;
|
||||||
}
|
}
|
||||||
// 清理超时
|
|
||||||
if (timeoutRef.current) {
|
|
||||||
clearTimeout(timeoutRef.current);
|
|
||||||
timeoutRef.current = null;
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
}, [onComplete, onError, onProgress]);
|
}, [onComplete, onError, onProgress]);
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user