Closed EbelloImbox closed 1 year ago
I am watching that the problem is only happening in APi > 30 for this code:
if (Build.VERSION.SDK_INT >= 30) {
if (!storageConfiguration.isExternal) {
return saveVideoInInternal(context, videoFileName, videoFile)
} else {
return saveVideoInExternal(context, videoFileName, folderName, videoFile)
}
}
videoFile is always empty because of the cursor in the code above is null.
I dealt with the same issue today using API 31!
the problem is that you are using an uri like mine and you have to use an uri like a fileprovider: content://com.google.android.apps.photos.contentprovider/-1/2/content%3A%2F%2Fmedia%2Fexternal%2Fvideo%2Fmedia%2F1000000095/ORIGINAL/NONE/video%2Fmp4/1108575362
I am trying to parse to this kind of uri, if you know how to do it tell me it please.
the problem is that you are using an uri like mine and you have to use an uri like a fileprovider: content://com.google.android.apps.photos.contentprovider/-1/2/content%3A%2F%2Fmedia%2Fexternal%2Fvideo%2Fmedia%2F1000000095/ORIGINAL/NONE/video%2Fmp4/1108575362
I am trying to parse to this kind of uri, if you know how to do it tell me it please.
You are right. Now that i save my video to Enviroment.DIRECTORY_MOVIES i get a content:// uri. Temporarilly i will use this. But as soon as i figure it out (because this is not where i want to save my videos before compress) i will inform you!
The way to get this kind of URI is using this: FileProvider.getUriForFile(context, authority, file), but I am seeing to come back to version 1.0.1 because there are a lot of bugs in this new version in kotlin.
I'm also getting the same issue in API 33
hey @EbelloImbox
i've faced the same issue with this package and found the cause, with newer version of android their is scoped storage to access file outside of it's own directory. before API 30 we needed to add android:requestLegacyExternalStorage="true"
flag to access file in external storage but After Android 11, Android just ignores android:requestLegacyExternalStorage="true"
and android:requestLegacyExternalStorage="true""
flags
and i assume this package is not yet compatible with scoped storage for flutter
a workaround can be compressing the video in the internal directory then storing it in the external dir with other packages which does support scoped storage
I am watching that the problem is only happening in APi > 30 for this code:
if (Build.VERSION.SDK_INT >= 30) { if (!storageConfiguration.isExternal) { return saveVideoInInternal(context, videoFileName, videoFile) } else { return saveVideoInExternal(context, videoFileName, folderName, videoFile) } }
videoFile is always empty because of the cursor in the code above is null.
Any solution?
I am watching that the problem is only happening in APi > 30 for this code:
if (Build.VERSION.SDK_INT >= 30) { if (!storageConfiguration.isExternal) { return saveVideoInInternal(context, videoFileName, videoFile) } else { return saveVideoInExternal(context, videoFileName, folderName, videoFile) } }
videoFile is always empty because of the cursor in the code above is null.
Any solution?
a workaround can be compressing the file into the app's internal directory then use something like gallery_saver package to save the file in the external storage
gallery_saver package is available in kotlin/java?
Hi @EbelloImbox thank you for openning the issue and apolgies for the late reply. Was very busy the past 10 months.
This issue is happening due to permission issues as Google has been changing the behaviours a lot when it comes to privacy and media access.
I will release a new version later today with updated README. A new permission should be requested now for API >= 33;
Hello, I am having an issue when I try to compress a video in Android API 33, this is the logcat:
I am using a video saved in standar video directory from Android Emulator, uri: /storage/emulated/0/Movies/VID_20220830_180410.mp4, and in this part of the library code:
When this part of the code is executing:
cursor is always null, so it will return always "" and for this reason I am experimenting this error.
Any help?