Skip to content

Commit b6c94c5

Browse files
author
Miriad
committed
fix: vertical-only infographics now populate 'infographics' field for video pipeline
When enableHorizontalInfographics is false, horizontalRefs is empty and the 'infographics' field (which video-pipeline reads) was never written. Videos rendered with zero infographic URLs, falling back to B-roll. Fix: write verticalRefs to 'infographics' when no horizontal refs exist. Also use vertical CDN URLs for scene-level distribution as fallback.
1 parent dee0f4b commit b6c94c5

1 file changed

Lines changed: 8 additions & 3 deletions

File tree

app/api/cron/check-research/route.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -483,18 +483,23 @@ async function finalizeInfographics(
483483
if (verticalRefs.length > 0) {
484484
patchData.infographicsVertical = verticalRefs;
485485
}
486-
// Backward compat
486+
// Backward compat — 'infographics' is the primary field video-pipeline reads
487+
// Use horizontal if available, otherwise fall back to vertical
487488
if (horizontalRefs.length > 0) {
488489
patchData.infographics = horizontalRefs;
490+
} else if (verticalRefs.length > 0) {
491+
patchData.infographics = verticalRefs;
489492
}
490493

491494
// Distribute infographic URLs back to scene-level for Remotion
492-
if (doc.script?.scenes && infographicUrls.length > 0) {
495+
// Use horizontal URLs if available, otherwise fall back to vertical
496+
const availableUrls = infographicUrls.length > 0 ? infographicUrls : verticalUrls;
497+
if (doc.script?.scenes && availableUrls.length > 0) {
493498
let urlIndex = 0;
494499
const updatedScenes = doc.script.scenes.map((scene) => {
495500
const mapping = scenePromptMap.find(m => m.sceneNumber === scene.sceneNumber);
496501
if (mapping && mapping.promptCount > 0) {
497-
const sceneUrls = infographicUrls.slice(urlIndex, urlIndex + mapping.promptCount);
502+
const sceneUrls = availableUrls.slice(urlIndex, urlIndex + mapping.promptCount);
498503
urlIndex += mapping.promptCount;
499504
return { ...scene, infographicUrls: sceneUrls };
500505
}

0 commit comments

Comments
 (0)