Use default duration if getDuration fails

Add a fallback for video duration by including this.getDuration(videoPath).catch(() => 60) in the Promise.all alongside fileTypeFromFile. This prevents Promise.all from rejecting when duration retrieval fails and supplies a sensible default (60s) for downstream processing (e.g., thumbnail generation).
This commit is contained in:
手瓜一十雪
2026-03-13 19:48:31 +08:00
parent 973ccaebed
commit 0ae05ccb8d
@@ -101,6 +101,7 @@ export class FFmpegExecAdapter implements IFFmpegAdapter {
// 获取文件大小和类型
const [fileType, duration] = await Promise.all([
fileTypeFromFile(videoPath).catch(() => null),
this.getDuration(videoPath).catch(() => 60),
]);
// 创建临时缩略图路径