Y
Y
YuriHx2016-04-26 22:12:40
Java
YuriHx, 2016-04-26 22:12:40

How to make MediaStore find more videos in different formats on the device?

To play local videos with non-standard encoding, I added MXPlayer support to the application. But the problem is that I first need to show the list of videos on the device to the user in my UI.
Now the program takes a list of videos on the device like this:

String[] projection = new String[]{MediaStore.Video.Media._ID, MediaStore.Video.Media.DATA, MediaStore.Video.Media.TITLE};
Cursor cursor = activity.getContentResolver().query(MediaStore.Video.Media.EXTERNAL_CONTENT_URI, projection, null, null, null);
while (cursor.moveToNext()) {
    if (MediaStore.Video.Thumbnails.getThumbnail(activity.getContentResolver(), cursor.getLong(0), MediaStore.Video.Thumbnails.MINI_KIND, null) != null) {
         publishProgress(new Pair<>(cursor.getLong(0), cursor.getString(2)));
    }
}
cursor.close();

and there are users who complain that the application simply does not see video files with non-standard encoding (for example, some MKV) and does not show them in the list.
Are there any ways to expand the list of videos that MediaScanner sees or somehow detect them and show them to the user?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
Y
YuriHx, 2016-04-27
@YuriHx

So far, I can't find any other way but to manually feed each needed file to MediaStore. Approximately as described here: stackoverflow.com/a/36791711

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question