1
我想要的與圖像相同。當用戶點擊一個按鈕(在我的情況下VideoView本身),我想讓他們打開圖庫並將視頻加載到VideoView中。將圖庫中的視頻加載到VideoView中
vv_video = (VideoView) findViewById(R.id.vv_video);
vv_video.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
Intent intent = new Intent();
intent.setType("video/*");
intent.setAction(Intent.ACTION_GET_CONTENT);
startActivityForResult(Intent.createChooser(intent, "Complete action using"), LOAD_VIDEO);
return false;
}
});
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
if (resultCode != RESULT_OK) return;
switch (requestCode) {
case LOAD_VIDEO:
Toast.makeText(NewBucketActivity.this, "test", Toast.LENGTH_SHORT).show(); //this appears!
Bundle video = data.getExtras();
mVideoCaptureUri = video.getParcelable("data");
vv_video.setVideoURI(mVideoCaptureUri);
break;
}
}
但是,當我在圖庫中選擇視頻時沒有任何反應。敬酒信息出現了,所以我搞砸了捆綁或Uri。它應該顯示在VideoView中,對嗎?