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

A Flutter package for generating thumbnails from video files and byte arrays, supporting various 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.

Usage #

Add the plugin to your Flutter project #

Add the following dependency to your pubspec.yaml file:

dependencies:
  flutter_video_thumbnail_plus: ^1.0.1

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.

8
likes
160
points
2.53k
downloads

Publisher

unverified uploader

Weekly Downloads

A Flutter package for generating thumbnails from video files and byte arrays, supporting various image formats and customization options.

Repository (GitHub)

Documentation

API reference

License

MIT (license)

Dependencies

flutter, flutter_web_plugins, plugin_platform_interface

More

Packages that depend on flutter_video_thumbnail_plus