Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 13 additions & 4 deletions packages/producer/src/services/htmlCompiler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Loading