Write HTML. Render video. Built for agents.
JavaScript aiai-agentsanimationclaude-codeffmpegframeworkgsaphtmlhtml-to-videomcpmotion-graphicspuppeteerrenderingtypescriptvideo-editor
fix(producer): handle no-audio stream gracefully in resolveMediaDuration
Miguel Ángel8b234be20c7f
diff --git a/packages/producer/src/services/htmlCompiler.ts b/packages/producer/src/services/htmlCompiler.tsindex 557ec2deea..54f297c48d 100644--- a/packages/producer/src/services/htmlCompiler.ts+++ b/packages/producer/src/services/htmlCompiler.ts@@ -167,10 +167,19 @@ async function resolveMediaDuration(return { duration: 0, resolvedPath: filePath };}- const metadata =- tagName === "video"- ? await extractMediaMetadata(filePath)- : await extractAudioMetadata(filePath);+ let metadata: { durationSeconds: number };+ if (tagName === "video") {+ metadata = await extractMediaMetadata(filePath);+ } else {+ try {+ metadata = await extractAudioMetadata(filePath);+ } catch {+ // Source file has no audio stream (e.g. a silent video used as an audio src).+ // Return duration 0 so the element is excluded from the composition gracefully,+ // matching how missing files and failed downloads are already handled above.+ return { duration: 0, resolvedPath: filePath };+ }+ }const fileDuration = metadata.durationSeconds;const effectiveDuration = fileDuration - mediaStart;