feat(shorts): worker force scenes for AI-tips — terminal/compare/fix/bullets/bang

This commit is contained in:
asepharyana
2026-09-22 22:42:29 +07:00
parent a992d73eda
commit 005d9880e6
2 changed files with 25 additions and 11 deletions
+21 -7
View File
@@ -237,13 +237,27 @@ async function renderScript(script) {
}
// 3. Remotion timeline (frames)
const timeline = voiced.map((s) => ({
text: s.text,
duration: Math.max(30, Math.round(s.durationSec * FPS)),
label: s.label,
sentences: s.sentences || undefined,
stat: extractStatData(s.text),
}));
const timeline = voiced.map((s) => {
const t = {
text: s.text,
duration: Math.max(30, Math.round(s.durationSec * FPS)),
label: s.label,
sentences: s.sentences || undefined,
stat: extractStatData(s.text),
};
// AI-agent tips: force scene per label for the terminal/compare/bullets/bang
// variety (brands keep their own kinetic/caption mapping).
const L = (s.label || "").toUpperCase();
if (script.category === "ai-agent-tips") {
if (L === "HOOK") t.scene = "terminal";
else if (L === "THE MISTAKE" || L === "WHY IT FAILS") t.scene = "compare";
else if (L === "THE FIX") t.scene = "fix";
else if (L === "THE INSIGHT") t.scene = "bullets";
else if (L === "THE CONFLICT") t.scene = "bang";
else if (L === "CTA") t.scene = "cta";
}
return t;
});
// Inject source card scene — REPLACES the visual of the 2nd segment
// (story). Total timeline duration stays == audio duration, so the mux