Closed VincentJoshuaET closed 11 months ago
Hi @VincentJoshuaET . Thank you for opening this issue. In the documentation: "- saveAt: the directory where the video should be saved in. The value will be ignored if isExternal is false."
So if isExternal is false, the library saves in internal storage. Do you want to create a nested folder?
@AbedElazizShe
In your saveVideoFile function in your library you used the context.getExternalFilesDir
function to fetch the storage path but you have to split the string first so the saveAt argument won't work even when the isExternal boolean flag is set to true. Took me a while to realize it was actually saving to the application cache folder rather than the internal public directories.
getExternalFilesDir(null)
returns a path to the cache folder /android/emulated/0/Android/data/my.application.app/
so we need to split the string and get the substring from index 0 till the last indexOf("Android")
This is a function I've come up with that returns the correct path of the sd card
Version 1.3.0 is handling this in a clearer way.
This is how I compress my video URIs
where
Environment.DIRECTORY_PICTURES
="Pictures"
With above, the file gets saved at
/data/data/PACKAGE_NAME/files/FILE_NAME.mp4
instead of/data/data/PACKAGE_NAME/files/Pictures/FILE_NAME.mp4
The corresponding source code:
I think
context.filesDir
should be changed tocontext.getExternalFilesDir(Environment.DIRECTORY_PICTURES)
whereEnvironment.DIRECTORY_PICTURES
is the specifiedsaveAt
property