fix:首帧预览bug修复

This commit is contained in:
非凡主儿 2025-10-16 16:14:32 +08:00
parent 9513e1348f
commit 83315aa7f5
2 changed files with 17 additions and 3 deletions

View File

@ -77,6 +77,7 @@ export interface MovieProject {
final_video_url: string;
final_simple_video_url: string;
video_urls: string;
video_snapshot_url?: string;
last_message: string;
updated_at: string;
created_at: string;

View File

@ -294,6 +294,21 @@ export default function CreateToVideo2() {
onDownloadAll: ()=>{}
});
};
const getPosterUrl = (project: MovieProject): string => {
if (project.video_snapshot_url && project.video_snapshot_url.trim() !== '') {
return project.video_snapshot_url;
}
//使用getFirstFrame生成
const videoUrl = project.final_video_url || project.final_simple_video_url || project.video_urls || '';
if (videoUrl && videoUrl.trim() !== '') {
return getFirstFrame(videoUrl, 300);
}
return '';
};
// 根据 aspect_ratio 计算纵横比
const getAspectRatio = () => {
switch (project.aspect_ratio) {
@ -333,9 +348,7 @@ export default function CreateToVideo2() {
loop
playsInline
preload="auto"
poster={
getFirstFrame(project.final_video_url || project.final_simple_video_url || project.video_urls || '', 300)
}
poster={getPosterUrl(project)}
/>
) : (
<div