Generally a video is chosen from the gallery and cut with a library, the problem is that I need to convert that cut video (that it is stored in the external memory: /storage/emulated/0/test_video.mp4) to base64 and that's where it fails. How can I solve it? I already put the permissions on the manifest and request for them programmatically.
//Getting video from previous activity
Uri selectedVideo = Uri.parse(intent.getStringExtra("trimmedVideo"));
Log.d(Global.getTag(), "path: "+selectedVideo.toString());
//Converting Selected video to base64
try {
InputStream in = getContentResolver().openInputStream(selectedVideo); <---This line fails
byte[] bytes = Global.getBytes(in);
Log.d(Global.getTag(), "bytes size= "+bytes.length);
video_base64 = Base64.encodeToString(bytes,Base64.DEFAULT);
Log.d(Global.getTag(), "Base64string= "+ video_base64);
} catch (Exception e) {
e.printStackTrace();
}
And all I get in logcast is: