I query all videos on device using cursor and get the video paths from the MediaStore.Video.VideoColumns.DATA
column.
In another fragment, I use MediaMetaDataRetriever
to get more information about a video and pass the file path that I got from the DATA
column to MediaMetaDataRetriever.setDataSource(String)
method.
I have around 4k daily active users, and the code works on 99%, but crashlytics shows a few IllegalArgumentException
saying the given file does not exists.
The issue is seen on Android 9, 10, 11, 12, 13 and mostly on Samsung and Redmi devices.
I have WRITE_EXTERNAL_STORAGE
permission, and READ_MEDIA_VIDEOS
permission in case of Android 13.
What can be the probable cause of this issue on only some devices?
Below is a part of the exception recorded in crashlytics:
Non-fatal Exception: java.lang.IllegalArgumentException: /storage/emulated/0/DCIM/Camera/lv_0_20220219202543.mp4 does not exist
at android.media.MediaMetadataRetriever.setDataSource(MediaMetadataRetriever.java:262)