Closed yangiljae closed 1 year ago
You have to get required storage permission, then it works fine
Hi @yangiljae , please follow the usage part: https://github.com/AbedElazizShe/LightCompressor#usage, feel free to reopen the issue if adding the permissions does not work.
Thank you.
the same code is working fine in android 13 but when I'm running the app in the android version 10 the app has been crashed
2023-05-12 10:38:17.958 28981-2318 Compressor com.abedelazizshe.lightcompressor E /storage/emulated/0/Movies/compressed_video.mp4: open failed: EACCES (Permission denied) java.io.FileNotFoundException: /storage/emulated/0/Movies/compressed_video.mp4: open failed: EACCES (Permission denied) at libcore.io.IoBridge.open(IoBridge.java:496) at java.io.FileOutputStream.(FileOutputStream.java:235)
at java.io.FileOutputStream.(FileOutputStream.java:186)
at com.abedelazizshe.lightcompressorlibrary.video.MP4Builder.createMovie(MP4Builder.kt:28)
at com.abedelazizshe.lightcompressorlibrary.compressor.Compressor.start(Compressor.kt:177)
at com.abedelazizshe.lightcompressorlibrary.compressor.Compressor.access$start(Compressor.kt:30)
at com.abedelazizshe.lightcompressorlibrary.compressor.Compressor$compressVideo$2.invokeSuspend(Compressor.kt:134)
at com.abedelazizshe.lightcompressorlibrary.compressor.Compressor$compressVideo$2.invoke(Unknown Source:8)
at com.abedelazizshe.lightcompressorlibrary.compressor.Compressor$compressVideo$2.invoke(Unknown Source:4)
at kotlinx.coroutines.intrinsics.UndispatchedKt.startUndispatchedOrReturn(Undispatched.kt:89)
at kotlinx.coroutines.BuildersKt__Builders_commonKt.withContext(Builders.common.kt:166)
at kotlinx.coroutines.BuildersKt.withContext(Unknown Source:1)
at com.abedelazizshe.lightcompressorlibrary.compressor.Compressor.compressVideo(Compressor.kt:53)
at com.abedelazizshe.lightcompressorlibrary.VideoCompressor$startCompression$2.invokeSuspend(VideoCompressor.kt:157)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:570)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:749)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:677)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:664)
Caused by: android.system.ErrnoException: open failed: EACCES (Permission denied)
at libcore.io.Linux.open(Native Method)
at libcore.io.ForwardingOs.open(ForwardingOs.java:167)
at libcore.io.BlockGuardOs.open(BlockGuardOs.java:252)
at libcore.io.ForwardingOs.open(ForwardingOs.java:167)
at android.app.ActivityThread$AndroidOs.open(ActivityThread.java:8044)
at libcore.io.IoBridge.open(IoBridge.java:482)
at java.io.FileOutputStream.(FileOutputStream.java:235)
at java.io.FileOutputStream.(FileOutputStream.java:186)
at com.abedelazizshe.lightcompressorlibrary.video.MP4Builder.createMovie(MP4Builder.kt:28)
at com.abedelazizshe.lightcompressorlibrary.compressor.Compressor.start(Compressor.kt:177)
at com.abedelazizshe.lightcompressorlibrary.compressor.Compressor.access$start(Compressor.kt:30)
at com.abedelazizshe.lightcompressorlibrary.compressor.Compressor$compressVideo$2.invokeSuspend(Compressor.kt:134)
at com.abedelazizshe.lightcompressorlibrary.compressor.Compressor$compressVideo$2.invoke(Unknown Source:8)
at com.abedelazizshe.lightcompressorlibrary.compressor.Compressor$compressVideo$2.invoke(Unknown Source:4)
at kotlinx.coroutines.intrinsics.UndispatchedKt.startUndispatchedOrReturn(Undispatched.kt:89)
at kotlinx.coroutines.BuildersKt__Builders_commonKt.withContext(Builders.common.kt:166)
at kotlinx.coroutines.BuildersKt.withContext(Unknown Source:1)
at com.abedelazizshe.lightcompressorlibrary.compressor.Compressor.compressVideo(Compressor.kt:53)
at com.abedelazizshe.lightcompressorlibrary.VideoCompressor$startCompression$2.invokeSuspend(VideoCompressor.kt:157)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:570)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:749)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:677)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:664)