feat(agent): improve timestamp precision and proxy selection for video screenshots (#374)

This commit is contained in:
Yiling-J
2026-09-01 21:15:28 +08:00
committed by GitHub
parent 64b68e7d63
commit 5a754bcb94
5 changed files with 82 additions and 10 deletions
@@ -17,10 +17,23 @@ export async function takeVideoScreenshotsWorkflow(task: WorkflowTask): Promise<
}
const { asset, key } = await fetchAssetWithKey(workerQueue, task.assetId)
let targetKey = key
if (asset?.media) {
const mediaInfo = asset.media as unknown as PrismaJson.MediaInfo
if (mediaInfo.videoTranscodes && mediaInfo.videoTranscodes.length > 0) {
const sorted = [...mediaInfo.videoTranscodes]
.filter((t) => t.key)
.sort((a, b) => (b.height || 0) - (a.height || 0))
if (sorted.length > 0 && sorted[0].key) {
targetKey = sorted[0].key
}
}
}
const { takeScreenshotsActivity } = getActivities()
const screenshots = await executeActivity(workerQueue, takeScreenshotsActivity, {
assetKey: key,
assetKey: targetKey,
assetId: asset.id,
start: payload.screenshot.start,
end: payload.screenshot.end,