stream_thumbnail 0.1.0 copy "stream_thumbnail: ^0.1.0" to clipboard
stream_thumbnail: ^0.1.0 copied to clipboard

A Flutter plugin for creating a thumbnail from a local video file or from a video URL.

Stream Thumbnail #

Introduction #

A Flutter plugin for creating a thumbnail image from a video. Give it a local file path or a video URL and it returns the thumbnail as bytes or as a saved image file. Works on Android, iOS, and web.

Installation #

Add the following to your pubspec.yaml and replace [version] with the latest version:

dependencies:
  stream_thumbnail: ^[version]

Usage #

import 'package:stream_thumbnail/stream_thumbnail.dart';

Bytes #

Get the thumbnail as in-memory bytes — ideal for Image.memory:

final bytes = await StreamThumbnail.thumbnailData(
  video: 'https://example.com/video.mp4',
  imageFormat: StreamThumbnailFormat.jpeg,
  maxWidth: 128, // 0 keeps the source resolution
  quality: 25,
);

File #

Write the thumbnail to disk and get back an XFile. If thumbnailPath is omitted, the image is saved next to the video (or in the cache directory for remote videos):

final thumbnail = await StreamThumbnail.thumbnailFile(
  video: '/path/to/video.mp4',
  imageFormat: StreamThumbnailFormat.png,
  maxHeight: 200,
);

Multiple files #

Generate thumbnails for several videos in one call:

final thumbnails = await StreamThumbnail.thumbnailFiles(
  videos: ['/path/to/a.mp4', '/path/to/b.mp4'],
);

Options #

Every method accepts the same options:

Option Description
video(s) Path to a local video file or a video URL.
headers HTTP headers sent when fetching a remote video.
thumbnailPath Output path (file variants only). Defaults to the video's folder or cache dir.
imageFormat JPEG, PNG, or WEBP. Defaults to PNG. WebP on iOS is backed by libwebp.
maxHeight / maxWidth Max size in pixels, or 0 to keep the source resolution.
timeMs Capture position in milliseconds.
quality Output quality, 0100 (ignored for PNG).
0
likes
160
points
2.14k
downloads

Documentation

API reference

Publisher

verified publishergetstream.io

Weekly Downloads

A Flutter plugin for creating a thumbnail from a local video file or from a video URL.

Repository (GitHub)
View/report issues

License

MIT (license)

Dependencies

cross_file, flutter, flutter_web_plugins, plugin_platform_interface, web

More

Packages that depend on stream_thumbnail

Packages that implement stream_thumbnail