video_thumbnail_generator 0.0.8 video_thumbnail_generator: ^0.0.8 copied to clipboard
A Flutter Plugin for creating a thumbnail from a Video URL. You can output the thumbnail as a Flutter Image Widget or Uint8List.
import 'package:flutter/material.dart';
import 'package:video_thumbnail_generator/video_thumbnail_generator.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
title: 'Video Thumbnail Generator',
theme: ThemeData(
// This is the theme of your application.
//
// Try running your application with "flutter run". You'll see the
// application has a blue toolbar. Then, without quitting the app, try
// changing the primarySwatch below to Colors.green and then invoke
// "hot reload" (press "r" in the console where you ran "flutter run",
// or simply save your changes to "hot reload" in a Flutter IDE).
// Notice that the counter didn't reset back to zero; the application
// is not restarted.
primarySwatch: Colors.blue,
),
home: HomePage(),
);
}
}
class HomePage extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
body: SafeArea(
child: Center(
child: ThumbnailImage(
videoUrl:
"https://file-examples-com.github.io/uploads/2017/04/file_example_MP4_480_1_5MG.mp4",
width: 400,
height: 400,
errorBuilder: (context, error, stack) {
return Container(
width: 400.0,
height: 400.0,
color: Colors.blue,
child: Center(
child: Text("error loading Image"),
),
);
},
)),
),
);
}
}