mirror of
https://github.com/shumaiOne/shumai.git
synced 2026-11-23 20:58:44 +00:00
feat(transcode): update preview thumbnail resolution to 300p with max length constraint (#281)
* feat(transcode): update preview thumbnail resolution to 300p with max length constraint * fix(transcode): address code review feedback on preview thumbnail transcoding
This commit is contained in:
@@ -377,6 +377,10 @@ export async function transcodeImageActivity(
|
||||
outputFile,
|
||||
params.imageSpec.width,
|
||||
params.imageSpec.quality,
|
||||
{
|
||||
height: params.imageSpec.height || null,
|
||||
isPreview: params.imageSpec.isPreview ?? false,
|
||||
},
|
||||
)
|
||||
const buffer = fs.readFileSync(outputFile)
|
||||
await s3Service.putObject(bucket, key, buffer, buffer.length, 'image/webp')
|
||||
|
||||
@@ -115,8 +115,8 @@ describe('transcodeImageWorkflow', () => {
|
||||
|
||||
mockActivities.transcodeImageActivity.mockResolvedValue({
|
||||
key: 't.webp',
|
||||
width: 480,
|
||||
height: 480,
|
||||
width: 300,
|
||||
height: 300,
|
||||
format: 'webp',
|
||||
})
|
||||
|
||||
@@ -132,8 +132,8 @@ describe('transcodeImageWorkflow', () => {
|
||||
mediaInfo: expect.objectContaining({
|
||||
thumbnail: expect.objectContaining({
|
||||
key: 't.webp',
|
||||
width: 480,
|
||||
height: 480,
|
||||
width: 300,
|
||||
height: 300,
|
||||
}),
|
||||
}),
|
||||
})
|
||||
|
||||
@@ -75,7 +75,7 @@ export async function transcodeImageWorkflow(task: WorkflowTask): Promise<void>
|
||||
const thumbTranscode = await executeActivity(workerQueue, transcodeImageActivity, {
|
||||
assetKey: key,
|
||||
filePath,
|
||||
imageSpec: { width: 480, height: 0, quality: 80, format: 'webp' },
|
||||
imageSpec: { width: 300, height: 300, quality: 80, format: 'webp', isPreview: true },
|
||||
})
|
||||
mediaInfo.thumbnail = thumbTranscode
|
||||
}
|
||||
|
||||
@@ -124,8 +124,8 @@ describe('transcodeVideoWorkflow', () => {
|
||||
})
|
||||
mockActivities.transcodeImageActivity.mockResolvedValue({
|
||||
key: 't.webp',
|
||||
width: 480,
|
||||
height: 270,
|
||||
width: 300,
|
||||
height: 300,
|
||||
})
|
||||
|
||||
await transcodeVideoWorkflow(task)
|
||||
|
||||
@@ -108,7 +108,7 @@ export async function transcodeVideoWorkflow(task: WorkflowTask): Promise<void>
|
||||
const thumbTranscode = await executeActivity(workerQueue, transcodeImageActivity, {
|
||||
assetKey: key,
|
||||
filePath,
|
||||
imageSpec: { width: 480, height: 0, quality: 80, format: 'webp' },
|
||||
imageSpec: { width: 300, height: 300, quality: 80, format: 'webp', isPreview: true },
|
||||
})
|
||||
mediaInfo.thumbnail = thumbTranscode
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user