about use
mVideoAlbumLauncher.launch(
PickVisualMediaRequest(
ActivityResultContracts.PickVisualMedia.VideoOnly
)
)
method return uri similar to content://com.android.providers.media.documents/document/video%3A835951。
I think a fileName conversion should be done.You can refer to this example。https://github.com/iPaulPro/aFileChooser/blob/master/aFileChooser/src/com/ipaulpro/afilechooser/utils/FileUtils.java#L185 。
I used an extension function in the project.
fun Uri.parseFileName(context: Context): String? =
if (DocumentsContractCompat.isDocumentUri(context, this)) {
DocumentFile.fromSingleUri(context, this)?.name
} else {
pathSegments.last()
}
I think it can be more comprehensive, so please consider it, thank you.