asapj / flutter_thumbnails Goto Github PK
View Code? Open in Web Editor NEWA Flutter Plugin to generate video thumbnails on Local Storage
License: MIT License
A Flutter Plugin to generate video thumbnails on Local Storage
License: MIT License
Any plans on adding iOS support?
Flutter is a cross-platform dev tool, would only hope it's packages are too 😢
I've been running the example in this repo but when I press either buttons, this is the log I get. I suspect this is something to do with the location of the source video file but don't know what to do about it. Could you please add more detail to your example so it's clear how to get it working for a noob like me 🙇 ?
W/System.err(10797): java.io.FileNotFoundException: /storage/emulated/0/Videos/Thumbnails/Testvideo.png (No such file or directory)
W/System.err(10797): at java.io.FileOutputStream.open0(Native Method)
W/System.err(10797): at java.io.FileOutputStream.open(FileOutputStream.java:308)
W/System.err(10797): at java.io.FileOutputStream.<init>(FileOutputStream.java:238)
W/System.err(10797): at java.io.FileOutputStream.<init>(FileOutputStream.java:180)
W/System.err(10797): at com.asapjay.thumbnails.ThumbnailsPlugin.userDirectory(ThumbnailsPlugin.java:137)
W/System.err(10797): at com.asapjay.thumbnails.ThumbnailsPlugin.buildThumbnail(ThumbnailsPlugin.java:64)
W/System.err(10797): at com.asapjay.thumbnails.ThumbnailsPlugin.onMethodCall(ThumbnailsPlugin.java:49)
W/System.err(10797): at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:200)
W/System.err(10797): at io.flutter.view.FlutterNativeView.handlePlatformMessage(FlutterNativeView.java:163)
W/System.err(10797): at android.os.MessageQueue.nativePollOnce(Native Method)
W/System.err(10797): at android.os.MessageQueue.next(MessageQueue.java:326)
W/System.err(10797): at android.os.Looper.loop(Looper.java:160)
W/System.err(10797): at android.app.ActivityThread.main(ActivityThread.java:6669)
W/System.err(10797): at java.lang.reflect.Method.invoke(Native Method)
W/System.err(10797): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
W/System.err(10797): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
I/flutter (10797): path to File:
W/System.err(10797): java.lang.NullPointerException: Attempt to invoke virtual method 'boolean android.graphics.Bitmap.compress(android.graphics.Bitmap$CompressFormat, int, java.io.OutputStream)' on a null object reference
W/System.err(10797): at com.asapjay.thumbnails.ThumbnailsPlugin.cacheDirectory(ThumbnailsPlugin.java:82)
W/System.err(10797): at com.asapjay.thumbnails.ThumbnailsPlugin.buildThumbnail(ThumbnailsPlugin.java:64)
W/System.err(10797): at com.asapjay.thumbnails.ThumbnailsPlugin.onMethodCall(ThumbnailsPlugin.java:49)
W/System.err(10797): at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:200)
W/System.err(10797): at io.flutter.view.FlutterNativeView.handlePlatformMessage(FlutterNativeView.java:163)
W/System.err(10797): at android.os.MessageQueue.nativePollOnce(Native Method)
W/System.err(10797): at android.os.MessageQueue.next(MessageQueue.java:326)
W/System.err(10797): at android.os.Looper.loop(Looper.java:160)
W/System.err(10797): at android.app.ActivityThread.main(ActivityThread.java:6669)
W/System.err(10797): at java.lang.reflect.Method.invoke(Native Method)
W/System.err(10797): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
W/System.err(10797): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
Method Channel is throwing an error which is not passed to the result.
So, if it fails to create a thumbnail we can't catch the error on flutter side, below is an example
Future buildThumbnail() async {
this.isLoading = true;
print('Building thumbnail');
try {
this.thumbnailPath = await generateThumbnail(path);
} catch (e) {
print('[ERROR] StatusItem => Failed to generate thumbnail $e');
} finally {
this.isLoading = false;
}
}
/// Generates thumbnail for video statuses
Future generateThumbnail(String video) {
return Thumbnails.getThumbnail(
videoFile: video,
imageType: ThumbFormat.PNG,
quality: 50,
);
}
Unhandled Exception: MissingPluginException(No implementation found for method getThumbnail on channel thumbnails
W/System.err(25430): java.lang.NullPointerException: Attempt to invoke interface method 'int java.lang.CharSequence.length()' on a null object reference
W/System.err(25430): at java.util.regex.Matcher.reset(Matcher.java:280)
W/System.err(25430): at java.util.regex.Matcher.(Matcher.java:186)
W/System.err(25430): at java.util.regex.Pattern.matcher(Pattern.java:1034)
W/System.err(25430): at com.asapjay.thumbnails.ThumbnailsPlugin.getFileName(ThumbnailsPlugin.java:176)
W/System.err(25430): at com.asapjay.thumbnails.ThumbnailsPlugin.cacheDirectory(ThumbnailsPlugin.java:70)
W/System.err(25430): at com.asapjay.thumbnails.ThumbnailsPlugin.buildThumbnail(ThumbnailsPlugin.java:64)
W/System.err(25430): at com.asapjay.thumbnails.ThumbnailsPlugin.onMethodCall(ThumbnailsPlugin.java:49)
W/System.err(25430): at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:231)
W/System.err(25430): at io.flutter.embedding.engine.dart.DartMessenger.handleMessageFromDart(DartMessenger.java:93)
W/System.err(25430): at io.flutter.embedding.engine.FlutterJNI.handlePlatformMessage(FlutterJNI.java:642)
W/System.err(25430): at android.os.MessageQueue.nativePollOnce(Native Method)
W/System.err(25430): at android.os.MessageQueue.next(MessageQueue.java:336)
W/System.err(25430): at android.os.Looper.loop(Looper.java:174)
W/System.err(25430): at android.app.ActivityThread.main(ActivityThread.java:7356)
W/System.err(25430): at java.lang.reflect.Method.invoke(Native Method)
W/System.err(25430): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
W/System.err(25430): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930)
I'm also facing the same issue when I run flutter build apk.
A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
Android resource linking failed
.gradle\caches\transforms-2\files-2.1\0a271e99b6771ad4a84318244d532fb7\core-1.0.0\res\values\values.xml:57:5-88:25: AAPT: error: resource android:attr/fontVariationSettings not found.
\.gradle\caches\transforms-2\files-2.1\0a271e99b6771ad4a84318244d532fb7\core-1.0.0\res\values\values.xml:57:5-88:25: AAPT: error: resource android:attr/ttcIndex not found.
Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
Get more help at https://help.gradle.org
BUILD FAILED in 45s
Flutter can't identify the extension when file name has multiple . in it.
Maybe you can property which takes the file name instead of automatically generating the thumbnail name from the file. Or generate random number like an id.
running ios app gives this error,
earlier it was running fine
this is the error
ndefined symbols for architecture i386:
"_FlutterMethodNotImplemented", referenced from:
-[ThumbnailsPlugin handleMethodCall:result:] in ThumbnailsPlugin.o
"OBJC_CLASS$_FlutterMethodChannel", referenced from:
objc-class-ref in ThumbnailsPlugin.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
the author has written in the title that it is for "ANDROID/IOS/WEB"
and just below that in the ReadME file, they have written its compatible for android only!!
what is the meaning of misleading people?
if you are not providing support for IOS then you shouldn't have mention "IOS" in the title!!
why is this package not null safety?
Kindly make this package null safety and update it on pub.dev. Thank you.
When calling
Thumbnails.getThumbnail(
thumbnailFolder: tempDir,
// creates the specified path if it doesnt exist
videoFile: postVideo.path,
imageType: ThumbFormat.JPEG,
quality: 30)
I get
I/FilePicker(15864): Absolute file path:/storage/emulated/0/DCIM/Camera/VID_20190828_120040.mp4
D/EGL_emulation(15864): eglCreateContext: 0xdd073820: maj 3 min 0 rcv 3
D/EGL_emulation(15864): eglMakeCurrent: 0xdd073820: ver 3 0 (tinfo 0xe4852ee0)
D/EGL_emulation(15864): eglMakeCurrent: 0xdea85a20: ver 3 0 (tinfo 0xc5535e60)
D/EGL_emulation(15864): eglMakeCurrent: 0xdd073820: ver 3 0 (tinfo 0xe4852ee0)
W/System.err(15864): java.lang.NullPointerException: Attempt to invoke virtual method 'boolean android.graphics.Bitmap.compress(android.graphics.Bitmap$CompressFormat, int, java.io.OutputStream)' on a null object reference
W/System.err(15864): at com.asapjay.thumbnails.ThumbnailsPlugin.userDirectory(ThumbnailsPlugin.java:126)
W/System.err(15864): at com.asapjay.thumbnails.ThumbnailsPlugin.buildThumbnail(ThumbnailsPlugin.java:64)
W/System.err(15864): at com.asapjay.thumbnails.ThumbnailsPlugin.onMethodCall(ThumbnailsPlugin.java:49)
W/System.err(15864): at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:222)
W/System.err(15864): at io.flutter.embedding.engine.dart.DartMessenger.handleMessageFromDart(DartMessenger.java:96)
W/System.err(15864): at io.flutter.embedding.engine.FlutterJNI.handlePlatformMessage(FlutterJNI.java:643)
W/System.err(15864): at android.os.MessageQueue.nativePollOnce(Native Method)
W/System.err(15864): at android.os.MessageQueue.next(MessageQueue.java:326)
W/System.err(15864): at android.os.Looper.loop(Looper.java:160)
W/System.err(15864): at android.app.ActivityThread.main(ActivityThread.java:6669)
W/System.err(15864): at java.lang.reflect.Method.invoke(Native Method)
W/System.err(15864): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
W/System.err(15864): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
请问下有空可以更新一个ios版吗?感激不尽
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.