Android-FilePicker
Android-FilePicker copied to clipboard
Pick only mp4 videos
how can i display only mp4 videos. is it possible on this version ?
To achieve this you'll have to clone the project and import it as a module. Then make minor change to VMDocPicker.kt file (you can find it inside viewmodels directory). Locate the method QueryDocs and replace;
val selection = (MediaStore.Files.FileColumns.MEDIA_TYPE
+ "!="
+ MediaStore.Files.FileColumns.MEDIA_TYPE_IMAGE
+ " AND "
+ MediaStore.Files.FileColumns.MEDIA_TYPE
+ "!="
+ MediaStore.Files.FileColumns.MEDIA_TYPE_VIDEO)
with...
val selection = (MediaStore.Files.FileColumns.MEDIA_TYPE + "!=" + MediaStore.Files.FileColumns.MEDIA_TYPE_IMAGE)
You need to have the following logic somewhere in you project.
FilePickerBuilder.getInstance()
.setMaxCount(1)
.setActivityTheme(R.style.FilePickerTheme)
.addFileSupport("MP4", new String[]{"mp4"})
.enableDocSupport(false)
.setActivityTitle(context.getString(R.string.select_video))
.pickFile((Activity) context, REQUEST_CODE_VIDEO);
Note:
You'll be forced to use addFileSupport whenever you want to pick docs.