-
Notifications
You must be signed in to change notification settings - Fork 301
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
generating video thumbnail doesn't work #19
Comments
I am also not able to generate a video thumbnail here is my code, final thumnbnailString = await VideoThumbnail.thumbnailFile( My Console : ════════ Exception caught by image resource service ════════════════════════════ When the exception was thrown, this was the stack Thanks in advance @justsoft @tairrzayev-chi |
@Loopex2019 @ThalapathySiva @tairrzayev-chi |
Hi i checked the permissions and they are alright , but it still shows me that error. |
@justsoft Yeah I too checked the permission they are alright. |
@Loopex2019 Try to give an integer value for the 'maxWidth'. |
@ThalapathySiva Looks like the thumbnail file was treated as a network resource. Try to remove or add the prefix 'file://' for the returned thumbnail file path, or just create the thumbnail as binary data, then save it to file as what I demonstrated in the example. |
Nope it didn't work . Here is my code : |
Try to generate the thumbnail in memory to see any different. |
No it still the same thing |
@Loopex2019 Try my example or upload your test code I will find a time to try. |
I solved this Problem. Sorry the problem was not in the plugin. It was caused by another plugin which I forgot to dispose its object . But thanks for help!! |
Hi . I am trying to use the plugin but it doesn't work . Here is my code :
` String bytes;
@OverRide
void initState() {
super.initState();
getThumb();
}
void getThumb() async {
final Directory _dir = await getTemporaryDirectory();
bytes = await VideoThumbnail.thumbnailFile(
video:
'/storage/emulated/0/WhatsApp/Media/WhatsApp Video/VID-20200405-WA0024.mp4', //'https://youtu.be/jnzOMiMsmdI',
thumbnailPath: _dir.path,
imageFormat: ImageFormat.PNG,
);
}
@OverRide
Widget build(BuildContext context) {
return GestureDetector(
onTap: () {},
child: Card(
elevation: 2.2,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(16),
),
child: ClipRRect(
borderRadius: BorderRadius.circular(16),
child: Image.memory(
File(bytes).readAsBytesSync(),
fit: BoxFit.cover,
),
),
),
);
}
And here is the error :
Exception: Could not instantiate image codec.════════════════════════════════════════════════════════════════════════════════
E/MethodChannel#video_thumbnail(28455): Failed to handle method call
E/MethodChannel#video_thumbnail(28455): java.lang.NullPointerException: Attempt to invoke virtual method 'int java.lang.Integer.intValue()' on a null object reference
E/MethodChannel#video_thumbnail(28455): at xyz.justsoft.video_thumbnail.VideoThumbnailPlugin.onMethodCall(VideoThumbnailPlugin.java:60)
E/MethodChannel#video_thumbnail(28455): at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:231)
E/MethodChannel#video_thumbnail(28455): at io.flutter.embedding.engine.dart.DartMessenger.handleMessageFromDart(DartMessenger.java:93)
E/MethodChannel#video_thumbnail(28455): at io.flutter.embedding.engine.FlutterJNI.handlePlatformMessage(FlutterJNI.java:642)
E/MethodChannel#video_thumbnail(28455): at android.os.MessageQueue.nativePollOnce(Native Method)
E/MethodChannel#video_thumbnail(28455): at android.os.MessageQueue.next(MessageQueue.java:326)
E/MethodChannel#video_thumbnail(28455): at android.os.Looper.loop(Looper.java:181)
E/MethodChannel#video_thumbnail(28455): at android.app.ActivityThread.main(ActivityThread.java:7156)
E/MethodChannel#video_thumbnail(28455): at java.lang.reflect.Method.invoke(Native Method)
E/MethodChannel#video_thumbnail(28455): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:494)
E/MethodChannel#video_thumbnail(28455): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:975)
E/flutter (28455): [ERROR:flutter/lib/ui/ui_dart_state.cc(157)] Unhandled Exception: PlatformException(error, Attempt to invoke virtual method 'int java.lang.Integer.intValue()' on a null object reference, null)
E/flutter (28455): #0 StandardMethodCodec.decodeEnvelope
package:flutter/…/services/message_codecs.dart:569
E/flutter (28455): #1 MethodChannel.invokeMethod
package:flutter/…/services/platform_channel.dart:321
E/flutter (28455):
E/flutter (28455): #2 VideoThumbnail.thumbnailFile
package:video_thumbnail/video_thumbnail.dart:44
E/flutter (28455): #3 _VideoThumbWidgetState.getThumb
package:looper/creation/post-create.dart:908
E/flutter (28455):
E/flutter (28455): #4 _VideoThumbWidgetState.initState
package:looper/creation/post-create.dart:902
E/flutter (28455): #5 StatefulElement._firstBuild
package:flutter/…/widgets/framework.dart:4355
E/flutter (28455): #6 ComponentElement.mount
package:flutter/…/widgets/framework.dart:4201
E/flutter (28455): #7 Element.inflateWidget
package:flutter/…/widgets/framework.dart:3194
E/flutter (28455): #8 Element.updateChild
package:flutter/…/widgets/framework.dart:2988
E/flutter (28455): #9 SingleChildRenderObjectElement.mount
package:flutter/…/widgets/framework.dart:5445
E/flutter (28455): #10 Element.inflateWidget
package:flutter/…/widgets/framework.dart:3194
E/flutter (28455): #11 Element.updateChild
package:flutter/…/widgets/framework.dart:2988
E/flutter (28455): #12 SingleChildRenderObjectElement.mount
package:flutter/…/widgets/framework.dart:5445
E/flutter (28455): #13 Element.inflateWidget
package:flutter/…/widgets/framework.dart:3194
E/flutter (28455): #14 Element.updateChild
package:flutter/…/widgets/framework.dart:2988
E/flutter (28455): #15 ComponentElement.performRebuild
package:flutter/…/widgets/framework.dart:4243
E/flutter (28455): #16 Element.rebuild
package:flutter/…/widgets/framework.dart:3947
E/flutter (28455): #17 StatefulElement.update
package:flutter/…/widgets/framework.dart:4413
E/flutter (28455): #18 Element.updateChild
package:flutter/…/widgets/framework.dart:2977
E/flutter (28455): #19 SingleChildRenderObjectElement.update
package:flutter/…/widgets/framework.dart:5452
E/flutter (28455): #20 Element.updateChild
package:flutter/…/widgets/framework.dart:2977
E/flutter (28455): #21 SingleChildRenderObjectElement.update
package:flutter/…/widgets/framework.dart:5452
E/flutter (28455): #22 Element.updateChild
package:flutter/…/widgets/framework.dart:2977
E/flutter (28455): #23 ComponentElement.performRebuild
package:flutter/…/widgets/framework.dart:4243
E/flutter (28455): #24 Element.rebuild
package:flutter/…/widgets/framework.dart:3947
E/flutter (28455): #25 StatelessElement.update
package:flutter/…/widgets/framework.dart:4298
E/flutter (28455): #26 Element.updateChild
package:flutter/…/widgets/framework.dart:2977
E/flutter (28455): #27 ComponentElement.performRebuild
package:flutter/…/widgets/framework.dart:4243
E/flutter (28455): #28 Element.rebuild
package:flutter/…/widgets/framework.dart:3947
E/flutter (28455): #29 ProxyElement.update
package:flutter/…/widgets/framework.dart:4557
E/flutter (28455): #30 Element.updateChild
package:flutter/…/widgets/framework.dart:2977
E/flutter (28455): #31 ComponentElement.performRebuild
package:flutter/…/widgets/framework.dart:4243 E/flutter (28455): #31 ComponentElement.performRebuild
package:flutter/…/widgets/framework.dart:4243
E/flutter (28455): #32 Element.rebuild
package:flutter/…/widgets/framework.dart:3947
E/flutter (28455): #33 StatefulElement.update
package:flutter/…/widgets/framework.dart:4413
E/flutter (28455): #34 Element.updateChild
package:flutter/…/widgets/framework.dart:2977
E/flutter (28455): #35 ComponentElement.performRebuild
package:flutter/…/widgets/framework.dart:4243
E/flutter (28455): #36 Element.rebuild
package:flutter/…/widgets/framework.dart:3947
E/flutter (28455): #37 StatelessElement.update
package:flutter/…/widgets/framework.dart:4298
E/flutter (28455): #38 Element.updateChild
package:flutter/…/widgets/framework.dart:2977
E/flutter (28455): #39 SliverMultiBoxAdaptorElement.updateChild
package:flutter/…/widgets/sliver.dart:1288
E/flutter (28455): #40 SliverMultiBoxAdaptorElement.performRebuild.processElement
package:flutter/…/widgets/sliver.dart:1220
E/flutter (28455): #41 Iterable.forEach (dart:core/iterable.dart:279:30)
E/flutter (28455): #42 SliverMultiBoxAdaptorElement.performRebuild
package:flutter/…/widgets/sliver.dart:1246
E/flutter (28455): #43 SliverMultiBoxAdaptorElement.update (package:flutter/src/widgets/sliver.dart:119`
The text was updated successfully, but these errors were encountered: