I am trying to upload a video on server. This is how i get the video
intent = new Intent(Intent.ACTION_OPEN_DOCUMENT);
intent.addCategory(Intent.CATEGORY_OPENABLE);
intent.setType("video/*");
startActivityForResult(intent, SELECT_VIDEO);
i get the file uri this way
Uri uri = data.getData();
this is what i recieve
content://com.android.providers.media.documents/document/video%3A165191
i show the video preview this way
mVideoView.setVideoURI(uri);
mVideoView.requestFocus();
mVideoView.start();
Preview plays perfectly. then i need to make a file to upload it to server . i make this file this way
file = new File(uri.getPath());
but when i reach the line below, it gives error
FileInputStream fileInputStream = new FileInputStream(file);
i also tried uri.toString(); but still error. The error i recieve is below:
2 error: /document/video:165191: open failed: ENOENT (No such file or directory) java.io.FileNotFoundException: /document/video:165191: open failed: ENOENT (No such file or directory)
Please someone help me ... it is really making me frustrated ..