fix: support video durations from 5 to 14 seconds

This commit is contained in:
xuejianwu
2026-07-31 13:41:09 +08:00
parent afd4118fdb
commit 77dc339f87
5 changed files with 25 additions and 9 deletions

View File

@@ -456,6 +456,8 @@ function switchModule(module) {
}
function createShot(seed = {}, index = state.shots.length) {
const seedDuration = Number(seed.duration);
const duration = Number.isFinite(seedDuration) ? Math.min(14, Math.max(5, Math.round(seedDuration))) : 5;
return {
id: seed.id || `shot-${Date.now()}-${Math.random().toString(36).slice(2, 7)}`,
title: seed.title || (index === 0 ? "电梯口对话" : `片段 ${String(index + 1).padStart(2, "0")}`),
@@ -466,7 +468,7 @@ function createShot(seed = {}, index = state.shots.length) {
roleIds: Array.isArray(seed.roleIds) ? [...seed.roleIds] : state.roles.map((role) => role.id),
model: seed.model || "doubao-seedance-2-0-260128",
ratio: seed.ratio || "9:16",
duration: Number(seed.duration) || 5,
duration,
resolution: seed.resolution || "720p",
generateAudio: seed.generateAudio !== false,
watermark: Boolean(seed.watermark),