rafidgotit / media_picker_widget

A widget that picks media files from storage and allows you to place anywhere in the widget tree.
MIT License
12 stars 14 forks source link

I get this error , pick video file #12

Open ITApexGroup opened 8 months ago

ITApexGroup commented 8 months ago

E/AndroidRuntime(19859): java.lang.OutOfMemoryError: Failed to allocate a 158366016 byte allocation with 25165824 free bytes and 76MB until OOM, target footprint 347121288, growth limit 402653184 E/AndroidRuntime(19859): at java.util.Arrays.copyOf(Arrays.java:3578) E/AndroidRuntime(19859): at java.io.ByteArrayOutputStream.toByteArray(ByteArrayOutputStream.java:211) E/AndroidRuntime(19859): at com.fluttercandies.photo_manager.core.utils.AndroidQDBUtils.getOriginBytes(AndroidQDBUtils.kt:319) E/AndroidRuntime(19859): at com.fluttercandies.photo_manager.core.PhotoManager.getOriginBytes(PhotoManager.kt:120) E/AndroidRuntime(19859): at com.fluttercandies.photo_manager.core.PhotoManagerPlugin.handleMethodResult(PhotoManagerPlugin.kt:332) E/AndroidRuntime(19859): at com.fluttercandies.photo_manager.core.PhotoManagerPlugin.access$handleMethodResult(PhotoManagerPlugin.kt:27) E/AndroidRuntime(19859): at com.fluttercandies.photo_manager.core.PhotoManagerPlugin$onHandlePermissionResult$1.invoke(PhotoManagerPlugin.kt:248) E/AndroidRuntime(19859): at com.fluttercandies.photo_manager.core.PhotoManagerPlugin$onHandlePermissionResult$1.invoke(PhotoManagerPlugin.kt:246) E/AndroidRuntime(19859): at com.fluttercandies.photo_manager.core.PhotoManagerPlugin$Companion.runOnBackground$lambda$0(PhotoManagerPlugin.kt:44) E/AndroidRuntime(19859): at com.fluttercandies.photo_manager.core.PhotoManagerPlugin$Companion.$r8$lambda$vWNc2g2BWEDWg6G41MFWJAaVd4g(Unknown Source:0) E/AndroidRuntime(19859): at com.fluttercandies.photo_manager.core.PhotoManagerPlugin$Companion$$ExternalSyntheticLambda0.run(Unknown Source:2) E/AndroidRuntime(19859): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) E/AndroidRuntime(19859): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:644) E/AndroidRuntime(19859): at java.lang.Thread.run(Thread.java:1012)

appach22 commented 5 months ago

@ITApexGroup this happens because the library is trying to read full content of the selected media file into memory. This is obviously a bug. @rafidgotit please, change this behavious either not to read the media content or to do it optionally. related file: media_conversion_service.dart line 21: mediaByte: await asset.originBytes

rafidgotit commented 5 months ago

@ITApexGroup & @appach22 Thank you so much for finding out the bug. I didn't keep this case in mind while developing the library. I focused on picking images primarily. I will fix this issue as soon as possible

appach22 commented 4 months ago

@rafidgotit please don't forget about this issue

rafidgotit commented 4 months ago

@appach22 I have this issue in mind bro, kindly give me some time, I'm a bit busy nowadays. I still can't understand why #13 is happening. Let me solve that first...