AbedElazizShe / LightCompressor

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

Android 12 with app crash #142

Closed SaritaDevAndroid closed 1 year ago

SaritaDevAndroid commented 1 year ago

Error : java.io.FileNotFoundException: : open failed: ENOENT (No such file or directory)

Code : VideoCompressor.start( context = applicationContext, // => This is required uris = toUri, // => Source can be provided as content uris isStreamable = true, storageConfiguration = StorageConfiguration( saveAt = Environment.DIRECTORY_MOVIES, // => the directory to save the compressed video(s). Will be ignored if isExternal = false. isExternal = true, // => false means save at app-specific file directory. Default is true. ), configureWith = Configuration( quality = VideoQuality.HIGH, isMinBitrateCheckEnabled = true, videoBitrate = 3677198, /Int, ignore, or null/ disableAudio = false, /Boolean, or ignore/ keepOriginalResolution = false, /Boolean, or ignore/ videoWidth = 360.0, /Double, ignore, or null/ videoHeight = 480.0 /Double, ignore, or null/ ),

imammufiid commented 1 year ago

try set isExternal to false

AbedElazizShe commented 1 year ago

Hi, @SaritaDevAndroid , sorry for the late reply. Can you confirm if you have WRITE_EXTERNAL_STORAGE and is requested at run time?

charlesgles9 commented 1 year ago

@AbedElazizShe there's a crash in API >=30 because of the saveVideoInExternal function in the VideoCompresssor.kt class. Due to the scoped storage in android 11 and above it returns an illegalArgument Exception

AbedElazizShe commented 1 year ago

Hi @charlesgles9 could you confirm this issue happens in the last release? My phones are runnign android 11, 12, and 13, and I have no issues now. Please share the error log to understand what I might have missed and try to fix it as soon as posible.

Thanks a lot