@devx-labs/strapi-plugin-video-thumbnail
v1.1.0
Published
Strapi 5 plugin that auto-extracts a thumbnail from uploaded videos and sets it on a configurable preview image field
Maintainers
Readme
@devx-labs/strapi-plugin-video-thumbnail
Strapi 5 plugin that automatically extracts a thumbnail from an uploaded video and sets it on a configurable preview image field — all client-side, no FFmpeg required.
How it works
When an editor opens a content entry that has a video field, the plugin:
- Seeks to 0.1 s into the video to skip potential black frames
- Draws the frame onto a canvas, resizes it to max 240 px wide
- Exports it as WebP at 70% quality
- Checks the media library for an existing thumbnail with the same name (avoids duplicates)
- Uploads it to the same folder as the original video
- Sets the result on the configured preview image field automatically
The editor just has to save the entry.
Install
npm install @devx-labs/strapi-plugin-video-thumbnail
# or
yarn add @devx-labs/strapi-plugin-video-thumbnailConfigure
In config/plugins.ts (or config/plugins.js):
export default {
'video-thumbnail': {
enabled: true,
config: {
contentTypes: [
{
uid: 'api::reel.reel',
// optional: only activate when a field equals a value
condition: { field: 'type', value: 'VIDEO' },
// dot-path to the video media field
videoField: 'video.video',
// dot-path to the preview image field
previewField: 'video.preview_image',
},
],
},
},
};Config options
| Key | Type | Required | Description |
|---|---|---|---|
| uid | string | ✅ | Content type UID |
| videoField | string | ✅ | Dot-path to the video media field |
| previewField | string | ✅ | Dot-path to the preview image field |
| condition.field | string | — | Only activate when this field… |
| condition.value | any | — | …equals this value |
Multiple content types
contentTypes: [
{
uid: 'api::reel.reel',
condition: { field: 'type', value: 'VIDEO' },
videoField: 'video.video',
previewField: 'video.preview_image',
},
{
uid: 'api::course.course',
videoField: 'introVideo',
previewField: 'coverImage',
},
],Requirements
- Strapi 5
- The video must be publicly accessible from the browser (same origin or CORS-enabled CDN). If the CDN blocks cross-origin requests the frame extraction will fail with a CORS error.
License
MIT
