justsoft / video_thumbnail

This plugin generates thumbnail from video file or URL. It returns image in memory or writes into a file. It offers rich options to control the image format, resolution and quality. Supports iOS and Android.
MIT License
183 stars 238 forks source link

Unable to load asset: /data/user/0/com.example.flutter_editor/cache/butterfly.png #67

Closed indjec closed 3 years ago

indjec commented 3 years ago

this is my code:

Scaffold( appBar: AppBar( title: Text("Video player"), ), body: Column( mainAxisAlignment: MainAxisAlignment.start, mainAxisSize: MainAxisSize.min, children: [ filePath != null ? Image(image: AssetImage(filePath)) : Text('No Floatting Button Click') ], ), floatingActionButton: Row( mainAxisAlignment: MainAxisAlignment.end, mainAxisSize: MainAxisSize.min, children: [ FloatingActionButton( tooltip: "Generate a file of thumbnail", onPressed: () async { final fileName = await VideoThumbnail.thumbnailFile( video: "https://flutter.github.io/assets-for-api-docs/assets/videos/butterfly.mp4", thumbnailPath: (await getTemporaryDirectory()).path, imageFormat: ImageFormat.PNG, maxHeight: 64, // specify the height of the thumbnail, let the width auto-scaled to keep the source aspect ratio quality: 75, ); setState(() { final file = File(fileName); filePath = file.path; }); }, child: Text('Click'), ), ], ));

indjec commented 3 years ago

this is my code:

Scaffold( appBar: AppBar( title: Text("Video player"), ), body: Column( mainAxisAlignment: MainAxisAlignment.start, mainAxisSize: MainAxisSize.min, children: [ filePath != null ? Image(image: AssetImage(filePath)) : Text('No Floatting Button Click') ], ), floatingActionButton: Row( mainAxisAlignment: MainAxisAlignment.end, mainAxisSize: MainAxisSize.min, children: [ FloatingActionButton( tooltip: "Generate a file of thumbnail", onPressed: () async { final fileName = await VideoThumbnail.thumbnailFile( video: "https://flutter.github.io/assets-for-api-docs/assets/videos/butterfly.mp4", thumbnailPath: (await getTemporaryDirectory()).path, imageFormat: ImageFormat.PNG, maxHeight: 64, // specify the height of the thumbnail, let the width auto-scaled to keep the source aspect ratio quality: 75, ); setState(() { final file = File(fileName); filePath = file.path; }); }, child: Text('Click'), ), ], ));