2
30 초까지 비디오를 제어하려면 어떻게해야합니까? 그렇지 않으면 토스트/팝업을 표시하십시오. onActivityResult
에 비디오 경로를 가져올 수 있으며 비디오를 실행할 수는 있지만 재생 시간을 가져올 수 없습니다.갤러리에서 비디오 선택 : 최대 30 초까지만 비디오를 선택해야합니다.
case Utils.REQUEST_CODE_GALLERY_VIDEO:
if (resultCode == Activity.RESULT_OK) {
Uri selectedVieo = data.getData();
String[] filePathColumn = { MediaStore.Video.Media.DATA };
Cursor cursor = getContentResolver().query(selectedVieo,
filePathColumn, null, null, null);
cursor.moveToFirst();
int columnIndex = cursor.getColumnIndex(filePathColumn[0]);
String filePath = cursor.getString(columnIndex);
cursor.close();
try {
if (filePath != null) {
runVideo(filePath);
}
} catch (Exception e) {
e.printStackTrace();
}
}