stream_thumbnail 0.3.0
stream_thumbnail: ^0.3.0 copied to clipboard
A Flutter plugin for creating a thumbnail from a local video file or from a video URL.
0.3.0 #
✨ Features #
- Added
StreamThumbnailSource, which says whether a video is a network URL, a local file or an Android content URI.
💥 BREAKING CHANGES #
- Removed the
video,videosandheadersparameters;sourceandsourcesare now required. PassStreamThumbnailSource.network(url, headers: ...),StreamThumbnailSource.file(path)orStreamThumbnailSource.contentUri(uri)instead. - Only
httpandhttpsURLs are fetched; any other scheme fails with anUNSUPPORTED_SOURCEPlatformException. - On Windows, a file source must be an absolute path on a local drive.
- On Linux, videos are read only from single-file containers; playlists such as HLS and DASH are not supported.
🔄 Changed #
thumbnailFileandthumbnailFilesgive each thumbnail a generated file name instead of the video's file name. On web, the download name isthumbnail.<ext>.- A thumbnail is at most 4096 pixels on its longest side, including when
maxWidthandmaxHeightare left at0. A video more than 8192 pixels on a side fails with aTHUMBNAIL_ERRORPlatformException. - At most three thumbnails are generated at a time; further calls wait for one to finish. A thumbnail that takes
longer than a minute, or a minute per video for
thumbnailFiles, fails with aTHUMBNAIL_ERRORPlatformException. - A network video sent with headers that redirects to another scheme, host or port, including from
httptohttps, is fetched from there without theAuthorization,CookieandProxy-Authorizationheaders. On web, the browser follows redirects itself. - On Linux, reading a network video fails after 30 seconds without data.
🐞 Fixed #
- On Android 10 and later, a local video with
maxWidthormaxHeightleft at0now produces a thumbnail instead of failing. - On Android, running out of memory while generating a thumbnail fails with a
THUMBNAIL_ERRORPlatformExceptioninstead of crashing the app.
0.2.0 #
✨ Features #
- Added macOS, Windows and Linux support, alongside the existing Android, iOS and web.
macOS requires 10.15 or later. Linux needs FFmpeg and libwebp development packages
present at build time — on Debian/Ubuntu:
libavcodec-dev libavformat-dev libavutil-dev libswscale-dev libwebp-dev. - On Windows,
StreamThumbnailFormat.webpis not supported yet and fails with anUNSUPPORTED_FORMATerror, andheadersis ignored — a remote video needing authentication cannot be thumbnailed there.
💥 BREAKING CHANGES #
thumbnailFileandthumbnailFilesno longer take athumbnailPath, and no longer write next to the source video or into the cache directory. Each thumbnail goes to its own temporary directory and is returned as anXFile. UseXFile.saveToto copy it somewhere permanent, orXFile.readAsByteson web.thumbnailFilesnow throws if any video fails, instead of dropping it from the returned list. A shorter list no longer silently means some videos failed.
🐞 Fixed #
- Failures now surface as a
PlatformExceptionwith a code and message on every platform, rather than a genericException. On iOS, a failedthumbnailDataused to crash on a null cast instead of reporting the error. - On iOS, a percent-encoded
file://video now resolves to the right file:file:///tmp/a%20b.mp4used to look for a literala%20b.mp4. macOS behaves the same; Android, Linux and Windows read the path as given, so pass those an unencoded path. - On web, the returned
XFilenow carries a file name, soXFile.saveTosavesclip.pnginstead of an unnamed file.
0.1.0 #
- Initial release.