video_thumbnail_gen 0.6.2
video_thumbnail_gen: ^0.6.2 copied to clipboard
A production-grade Flutter plugin to generate video thumbnails on Android and iOS. Supports JPEG, PNG, WebP, HEIC, batch extraction, metadata, and custom caching.
0.6.2 — 2026-06-03 #
- Shortened package description in pubspec.yaml to fit within the 60-180 character limit required by pub.dev guidelines.
0.6.1 — 2026-06-03 #
- Update README.md screenshot URLs to use absolute raw GitHub paths to resolve broken images on pub.dev.
0.6.0 — 2026-06-03 #
🎉 Initial Release of video_thumbnail_gen #
First public release of video_thumbnail_gen, a modern, production-grade replacement for video_thumbnail, maintained by Hadi.
Forked and significantly extended from the original video_thumbnail by justsoft.
🛠️ Fixed Issues & Optimizations
- iOS WebP Memory Leak: Fixed a critical memory leak in
VideoThumbnailPlugin.mwhere WebP data buffers were not freed. AddedWebPFree(output)to resolve it. - Android File Descriptor Leak: Wrapped
FileOutputStreamin a try-with-resources statement inbuildThumbnailFileto prevent unclosed file descriptors. - Android Bitmap Memory Leak: Fixed a memory leak where the original high-resolution bitmap was not recycled after calling
createScaledBitmap. Introduced ascaleAndRecycle()helper. - Example App Settings bug: Resolved duplicate settings widget instantiations in the UI by rebuilding settings dynamically from the Drawer rather than caching stale widgets.
- Example App UI Cleanliness: Cleared out the previous thumbnail when a new URL or source is selected, preventing the UI from showing outdated images.
- Example App Storage & Toast bug: Fixed storage write issues on Android by requesting appropriate permissions and saving to the correct external storage directory. The app now displays a success toast containing the full file path.
- Image Format Overflow: Corrected overflow issues in the format selection menu of the example app.
📣 Community & GitHub Notice
If you run into any issues, have feature requests, or want to contribute optimizations, please open an issue or pull request on our GitHub repository: github.com/Itsxhadi/video_thumbnail_gen. I will be regularly maintaining, updating, and reviewing contributions for this package!
Core Features
- Generate video thumbnails in memory (
thumbnailData) or as files (thumbnailFile) - Supports JPEG, PNG, WebP, and HEIC output formats
- Custom max width/height with aspect-ratio-preserving scaling
- Capture frame at any timestamp (
timeMs) - HTTP(S) remote video URL support with custom headers
- First-Class YouTube URL Support: Direct extraction and downloading of thumbnails from the YouTube CDN (uses robust
maxresdefault➜hqdefault➜0.jpgfallback strategy) - Custom output filename override (pass a full file path to
thumbnailPath) content://(SAF) URI support on Android
Performance
- Android:
LruCache— 1/8 of heap, keyed byvideo+params - iOS:
NSCache— 40 MB cap, thread-safe, auto-evicting - Batch extraction (
thumbnailDataList) — opens codec once, seeks N times - Thread pool capped to
min(4, availableProcessors)on Android
New APIs
VideoThumbnail.getVideoMetadata()— duration, dimensions, rotation, MIME typeVideoThumbnail.thumbnailDataList()— batch frame extractionVideoThumbnail.clearCache()— programmatic cache evictionThumbnailException+ThumbnailErrorCode— typed, machine-readable errorsVideoMetadata— strongly-typed metadata model
Native Quality
- iOS: all callbacks dispatched on main thread (no random crashes)
- iOS:
CGBitmapContextdraw approach — handles allCGImageAlphaInfocolorspaces - iOS:
WebPFree(output)— WebP buffer properly freed after encoding - Android:
FileOutputStreamin try-with-resources — no FD leaks - Android: original bitmap recycled immediately after
createScaledBitmap
Platform & Build
- Dart SDK
>=3.0.0 - Flutter
>=3.0.0 - Android: Gradle 8+, namespace
com.itsxhadi.video_thumbnail,mavenCentral() - iOS: deployment target iOS 11+, CocoaPods + Swift Package Manager support
- MethodChannel:
plugins.itsxhadi.com/video_thumbnail_gen