AbedElazizShe / LightCompressor

A powerful and easy-to-use video compression library for android uses MediaCodec API.
Apache License 2.0
533 stars 116 forks source link

ANR is happening while compressing video starts #172

Closed amrreda1995 closed 1 year ago

amrreda1995 commented 1 year ago

Firebase crashlytics reported that there's some ANR happens because of some block of code running in the main thread. After Investigation, I found that the compressing library code uses EmptyCoroutineContext which is considered the app main thread. I made a small Pull Request with a fix for this issue by providing the IO context for kotlin coroutines to force code to be run in the IO thread.

Below, you can find attachments for the ANR in firebase crashlytics Screenshot from 2023-09-25 13-42-24 Screenshot from 2023-09-25 13-42-42

Also, here are you a Pull Request for a small fix for this small issue https://github.com/AbedElazizShe/LightCompressor/pull/171

AbedElazizShe commented 1 year ago

Thanks a lot for your contribution. I have merged your PR and will release a new version soon. i am testing on samsung A51 to try to find the potential issue.

amrreda1995 commented 1 year ago

Great. Thanks for the approval. In order to reproduce the issue; try to compress a video with large size. For me, I was trying to compress 1.5 GB video (UHD quality).