mirror of
https://github.com/shumaiOne/shumai.git
synced 2026-11-26 10:55:27 +00:00
fix(search): preview matched video chunks on hover (#540)
* fix(search): preview matched video chunks on hover * fix(search): show chunk covers before hover * fix(search): reuse sprites for whole-video matches
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import { logger } from '@shumai/core/src/logger'
|
||||
import { isFullVideoRange } from '@shumai/core/src/transcode/video-sprite'
|
||||
import type { WorkflowTask } from '@shumai/db'
|
||||
import { ApplicationFailure } from '@shumai/workflow-core'
|
||||
import { deleteS3ObjectActivity, transcodeVideoChunkActivity } from '../activities/transcode'
|
||||
@@ -8,6 +9,7 @@ export interface TranscodedVideoChunkItem {
|
||||
startTime: number
|
||||
endTime: number
|
||||
chunkKey: string
|
||||
sprite?: PrismaJson.VideoChunkSprite
|
||||
}
|
||||
|
||||
export async function transcodeVideoChunksWorkflow(task: WorkflowTask): Promise<void> {
|
||||
@@ -47,20 +49,21 @@ export async function transcodeVideoChunksWorkflow(task: WorkflowTask): Promise<
|
||||
|
||||
const chunks: TranscodedVideoChunkItem[] = []
|
||||
for (const range of payload.videoChunks.chunks) {
|
||||
const { chunkKey } = await transcodeVideoChunkActivity({
|
||||
const fullSpriteKey = isFullVideoRange(range.startTime, range.endTime, asset.media?.duration)
|
||||
? asset.media?.sprite?.key
|
||||
: undefined
|
||||
const chunk = await transcodeVideoChunkActivity({
|
||||
taskId: task.id,
|
||||
assetId: asset.id,
|
||||
assetKey: targetKey,
|
||||
originalKey: key,
|
||||
startTime: range.startTime,
|
||||
endTime: range.endTime,
|
||||
format: payload.videoChunks.format,
|
||||
...(fullSpriteKey && { fullSpriteKey }),
|
||||
})
|
||||
uploadedChunkKeys.push(chunkKey)
|
||||
chunks.push({
|
||||
startTime: range.startTime,
|
||||
endTime: range.endTime,
|
||||
chunkKey,
|
||||
})
|
||||
uploadedChunkKeys.push(chunk.chunkKey)
|
||||
chunks.push({ ...range, ...chunk })
|
||||
}
|
||||
|
||||
await completeTask(task.id, { chunks })
|
||||
|
||||
Reference in New Issue
Block a user