mirror of
https://github.com/shumaiOne/shumai.git
synced 2026-11-24 12:19:46 +00:00
feat(asset): show poster and hover preview while video is transcoding (#419)
* feat(asset): show poster and hover preview while video is transcoding Generate and persist the sprite (and its poster) before the proxy transcodes run, so the poster/sprite are available in the file list while the asset is still processing. Render the preview in the file card behind a translucent processing overlay instead of a blank skeleton, and replace hardcoded status text with existing i18n keys. * feat(asset): pulse the cover and show Preparing/Uploading labels while processing Drop the processing text overlay on the file card preview in favour of a subtle pulsing opacity on the cover, and show "Uploading..."/"Preparing..." in the creator row so the real author and date only appear once the asset is ready. * feat(asset): use a hollow ring for the preparing placeholder Match the geometry of the upload progress ring (empty inside, no percentage) and hide the duration badge while processing, so the upload-to-processing transition reads as one continuous animation. * style(asset): shrink-only preparing ring in muted grey at fixed opacity Animate only the ring size (1 -> 0.8 -> 1) and hold a constant 0.6 opacity, using a muted grey stroke instead of primary.
This commit is contained in:
@@ -77,6 +77,43 @@ export async function transcodeVideoWorkflow(task: WorkflowTask): Promise<void>
|
||||
})
|
||||
}
|
||||
|
||||
// Generate the sprite (and its poster fallback) before the expensive proxy transcodes so the
|
||||
// file list can show a poster/sprite preview while the asset is still processing.
|
||||
if (spec.sprite || (spec.poster && !mediaInfo.poster)) {
|
||||
const lastSlashIndex = key.lastIndexOf('/')
|
||||
const assetDir = lastSlashIndex === -1 ? '' : key.substring(0, lastSlashIndex)
|
||||
|
||||
const spriteSpec: PrismaJson.SpriteInfo = {
|
||||
key: assetDir ? `${assetDir}/sprite.webp` : 'sprite.webp',
|
||||
frames: 100,
|
||||
tileX: 10,
|
||||
tileY: 10,
|
||||
}
|
||||
const posterSpec: PrismaJson.PosterInfo = mediaInfo.poster || {
|
||||
key: assetDir ? `${assetDir}/poster.webp` : 'poster.webp',
|
||||
}
|
||||
|
||||
const spriteResult = await executeActivity(workerQueue, generateSpriteActivity, {
|
||||
taskId: task.id,
|
||||
assetKey: key,
|
||||
filePath,
|
||||
spriteSpec,
|
||||
posterSpec,
|
||||
mediaInfo,
|
||||
})
|
||||
if (spec.sprite) {
|
||||
mediaInfo.sprite = spriteResult.sprite
|
||||
}
|
||||
if (!mediaInfo.poster) {
|
||||
mediaInfo.poster = spriteResult.poster
|
||||
}
|
||||
|
||||
await executeActivity(workerQueue, updateAssetMediaActivity, {
|
||||
assetId: asset.id,
|
||||
mediaInfo,
|
||||
})
|
||||
}
|
||||
|
||||
const metadata = mediaInfo.metadata
|
||||
|
||||
if (mediaInfo.proxyType === 'video' && metadata) {
|
||||
@@ -138,36 +175,6 @@ export async function transcodeVideoWorkflow(task: WorkflowTask): Promise<void>
|
||||
mediaInfo.thumbnail = thumbTranscode
|
||||
}
|
||||
|
||||
if (spec.sprite || (spec.poster && !mediaInfo.poster)) {
|
||||
const lastSlashIndex = key.lastIndexOf('/')
|
||||
const assetDir = lastSlashIndex === -1 ? '' : key.substring(0, lastSlashIndex)
|
||||
|
||||
const spriteSpec: PrismaJson.SpriteInfo = {
|
||||
key: assetDir ? `${assetDir}/sprite.webp` : 'sprite.webp',
|
||||
frames: 100,
|
||||
tileX: 10,
|
||||
tileY: 10,
|
||||
}
|
||||
const posterSpec: PrismaJson.PosterInfo = mediaInfo.poster || {
|
||||
key: assetDir ? `${assetDir}/poster.webp` : 'poster.webp',
|
||||
}
|
||||
|
||||
const spriteResult = await executeActivity(workerQueue, generateSpriteActivity, {
|
||||
taskId: task.id,
|
||||
assetKey: key,
|
||||
filePath,
|
||||
spriteSpec,
|
||||
posterSpec,
|
||||
mediaInfo,
|
||||
})
|
||||
if (spec.sprite) {
|
||||
mediaInfo.sprite = spriteResult.sprite
|
||||
}
|
||||
if (!mediaInfo.poster) {
|
||||
mediaInfo.poster = spriteResult.poster
|
||||
}
|
||||
}
|
||||
|
||||
await executeActivity(workerQueue, updateAssetMediaActivity, {
|
||||
assetId: asset.id,
|
||||
mediaInfo,
|
||||
|
||||
Reference in New Issue
Block a user