flutter_video_thumbnail_plus 1.0.6 copy "flutter_video_thumbnail_plus: ^1.0.6" to clipboard
flutter_video_thumbnail_plus: ^1.0.6 copied to clipboard

A Flutter plugin for generating video thumbnails from video files, URLs, and byte arrays with support for multiple image formats and customization options.

Flutter Video Thumbnail Plus #

A Flutter plugin for generating thumbnails from video files and byte arrays.

pub package   license   Example

Overview #

This plugin provides a simple and efficient way to generate thumbnails from video files and byte arrays. It supports various image formats, including PNG, JPG, and WebP, and allows for customization of the thumbnail's size, quality, and timestamp.

Features #

  • Generate thumbnails from video files and byte arrays (Uint8List)
  • Support for PNG, JPG, and WebP image formats
  • Customizable thumbnail size, quality, and timestamp
  • Platform-specific implementations for optimal performance and compatibility
  • Get thumbnail as a file path or Uint8List.

Platform support #

Platform thumbnailFile thumbnailData thumbnailDataWeb
Android Yes Yes No
iOS Yes Yes No
macOS Yes Yes No
Windows Yes Yes No
Web No No Yes

Windows notes #

  • Uses a native MethodChannel implementation, same API contract as Android/iOS/macOS.
  • Thumbnail extraction uses Media Foundation and image encoding uses WIC.
  • ImageFormat.webp currently falls back to PNG on Windows for compatibility.
  • If thumbnailPath is not provided, output is written to the OS temp directory.

Usage #

Add the plugin to your Flutter project #

Add the following dependency to your pubspec.yaml file:

dependencies:
  flutter_video_thumbnail_plus: ^1.0.6

Then, run flutter pub get to install the plugin.

Generate a thumbnail from a video file #

import 'package:flutter_video_thumbnail_plus/flutter_video_thumbnail_plus.dart';

Future<void> main() async {
  final videoPath = 'path/to/video.mp4';
  final thumbnailPath = 'path/to/thumbnail.png';

  final result = await FlutterVideoThumbnailPlus.thumbnailFile(
    video: videoPath,
    thumbnailPath: thumbnailPath,
    imageFormat: ImageFormat.png,
    maxHeight: 100,
    maxWidth: 100,
    timeMs: 1000,
    quality: 10,
  );

  if (result != null) {
    print('Thumbnail generated successfully: $result');
  } else {
    print('Failed to generate thumbnail');
  }
}

Generate a thumbnail from a video byte array (Web only) #

import 'package:flutter_video_thumbnail_plus/flutter_video_thumbnail_plus.dart';

Future<void> main() async {
  final videoBytes = Uint8List.fromList([/* video byte array */]);

  final result = await FlutterVideoThumbnailPlus.thumbnailDataWeb(
    videoBytes: videoBytes,
    quality: 100,
  );

  if (result != null) {
    print('Thumbnail generated successfully: $result');
  } else {
    print('Failed to generate thumbnail');
  }
}

API Documentation #

  • FlutterVideoThumbnailPlus.thumbnailFile: Generates a thumbnail from a video file and saves it to a file.
  • FlutterVideoThumbnailPlus.thumbnailData: Generates a thumbnail from a video file and returns the thumbnail data as a Uint8List.
  • FlutterVideoThumbnailPlus.thumbnailDataWeb: Generates a thumbnail from a video byte array and returns the thumbnail data as a Uint8List (Web only).

Example Use Cases #

  • Generating thumbnails for video playback in a Flutter app
  • Creating a video gallery with thumbnails
  • Sharing video thumbnails on social media

Advanced usage #

See the example app for a complete usage example.

Author #

Rahul Saryam || Rajkumar Gahane

Support this project #

Please ⭐️ this repository if this project helped you!

If you find any bugs or issues while using the plugin, please register an issues on GitHub. You can also contact us at rahulsaryam285@gmail.com and rajkumargahane2001@gmail.com.

Contributing #

Contributions are welcome! If you'd like to contribute to this plugin, please fork the repository and submit a pull request.

12
likes
150
points
11.9k
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

A Flutter plugin for generating video thumbnails from video files, URLs, and byte arrays with support for multiple image formats and customization options.

Repository (GitHub)
View/report issues

Topics

#video #thumbnail #flutter-plugin #media #image-processing

License

MIT (license)

Dependencies

flutter, flutter_web_plugins, plugin_platform_interface, web

More

Packages that depend on flutter_video_thumbnail_plus

Packages that implement flutter_video_thumbnail_plus