I am working on an App that will upload videos to firebase, the issue is that I followed a certain tutorial to achieve that but the app cannot pick a video from my Android App even after giving all the necessary permissions. The videos file is open correctly but when I click on a particular video for upload, it's not picking the video. I don't know what is the issue. Here is what I did
private void openVideo(){
Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
intent.setType("video/*");
startActivityForResult(intent,101);
}
@Override
protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if ((requestCode==101) && (resultCode == RESULT_OK) && (data.getData() != null)){
videoUri = data.getData();
String path = null;
Cursor cursor;
int column_index_data;
String [] projection = {MediaStore.MediaColumns.DATA,MediaStore.Video.Media.BUCKET_DISPLAY_NAME,
MediaStore.Video.Media._ID,MediaStore.Video.Thumbnails.DATA};
final String orderBy = MediaStore.Video.Media.DEFAULT_SORT_ORDER;
cursor = MainActivity.this.getContentResolver().query(videoUri,projection,null,null,orderBy);
column_index_data = cursor.getColumnIndexOrThrow(MediaStore.MediaColumns.DATA);
while (cursor.moveToNext()){
path = cursor.getString(column_index_data);
videoTitle = FilenameUtils.getBaseName(path);
}
tvVideoSelected.setText(videoTitle);
}
}