private static final int SELECT_VIDEO = 2346;
public void chooseVideo(View view) {
Intent videoPickerIntent = new Intent(Intent.ACTION_PICK);
videoPickerIntent.setType("video/*");
startActivityForResult(videoPickerIntent, SELECT_VIDEO);
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == SELECT_VIDEO && resultCode == RESULT_OK) {
Uri video = data.getData();
}
}
The uriString
of video
is content://com.google.android.apps.photos.contentprovider/-1/2/content%3A%2F%2Fmedia%2Fexternal%2Fvideo%2Fmedia%2F141694/ACTUAL/1441715445
Path: /-1/2/content%3A%2F%2Fmedia%2Fexternal%2Fvideo%2Fmedia%2F141694/ACTUAL/1441715445
ContentUris.parseId(video)
gives 1441715445
where as I believe I'm looking to get 141694
It's kind of double encoded it seems with this /ACTUAL/...
on the end confusing matters.
Is the fault in my understanding or code or with the gallery activity?
Related, but no clean solution given: Choosing photo using new Google Photos app is broken
What I need the id for:
I want the id
just so I can get the thumbnail:
long id = ContentUris.parseId(video);
Bitmap thumb = MediaStore.Video.Thumbnails.getThumbnail(getContentResolver(), id,
MediaStore.Video.Thumbnails.MICRO_KIND, null);