Skip to content
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

Doesn't work on Android 11. #57

Closed
hectorAguero opened this issue Oct 19, 2020 · 2 comments
Closed

Doesn't work on Android 11. #57

hectorAguero opened this issue Oct 19, 2020 · 2 comments

Comments

@hectorAguero
Copy link

hectorAguero commented Oct 19, 2020

Hi, I'm use this package, and with a Pixel 2 XL physical device with Android 11, the package doesn't work, I'm test in Android 10 emulator, and iOS 14 and works fine, but Android 11 is the problem.

i'm try to compress video with all settings in default, with Image_Picker package and File_Picker to select the file from gallery or camera, the error is on both.

final info = await VideoCompress.compressVideo(path );`

The log

D/MediaScannerConnection( 5017): Scanned /storage/emulated/0/Android/data/MYAPPP/files/Pictures/0cec8741-c89d-4c75-97e8-d056d9d860e13536652757187323447.mp4 to null
I/flutter ( 5017): VideoCompress: You can try to subscribe to the
I/flutter ( 5017):       compressProgress$ stream to know the compressing state.
E/MethodChannel#video_compress( 5017): Failed to handle method call
E/MethodChannel#video_compress( 5017): kotlin.KotlinNullPointerException
E/MethodChannel#video_compress( 5017): 	at com.example.video_compress.VideoCompressPlugin.onMethodCall(VideoCompressPlugin.kt:83)
E/MethodChannel#video_compress( 5017): 	at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:233)
E/MethodChannel#video_compress( 5017): 	at io.flutter.embedding.engine.dart.DartMessenger.handleMessageFromDart(DartMessenger.java:85)
E/MethodChannel#video_compress( 5017): 	at io.flutter.embedding.engine.FlutterJNI.handlePlatformMessage(FlutterJNI.java:692)
E/MethodChannel#video_compress( 5017): 	at android.os.MessageQueue.nativePollOnce(Native Method)
E/MethodChannel#video_compress( 5017): 	at android.os.MessageQueue.next(MessageQueue.java:335)
E/MethodChannel#video_compress( 5017): 	at android.os.Looper.loop(Looper.java:183)
E/MethodChannel#video_compress( 5017): 	at android.app.ActivityThread.main(ActivityThread.java:7656)
/MethodChannel#video_compress( 5017): 	at java.lang.reflect.Method.invoke(Native Method)
E/MethodChannel#video_compress( 5017): 	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
E/MethodChannel#video_compress( 5017): 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)
I/flutter ( 5017): Error from VideoCompress:
I/flutter ( 5017):       Method: compressVideo
I/flutter ( 5017):       PlatformException(error, null, null, kotlin.KotlinNullPointerException
I/flutter ( 5017): 	at com.example.video_compress.VideoCompressPlugin.onMethodCall(VideoCompressPlugin.kt:83)
I/flutter ( 5017): 	at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:233)
I/flutter ( 5017): 	at android.os.MessageQueue.nativePollOnce(Native Method)
I/flutter ( 5017): 	at android.app.ActivityThread.main(ActivityThread.java:7656)
I/flutter ( 5017): 	at java.lang.reflect.Method.invoke(Native Method)
I/flutter ( 5017): 	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
I/flutter ( 5017): 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)

@assansh
Copy link

assansh commented Oct 20, 2020

Not sure about Android 11, but the error in the stack trace is happening due to the missing includeAudio parameter, which for some reason does not have a default value and is not required on the Dart side, but is required in Android platform code.

So, calling the function like this should fix the issue:

final info = await VideoCompress.compressVideo(path, includeAudio: true);

@hectorAguero
Copy link
Author

Thanks for the fix, I'm closing the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants