下面是我的代码,我从ThumbnailUtils.createVideoThumbnail获取null
Intent takePicture = new Intent(Intent.ACTION_PICK, MediaStore.Video.Media.EXTERNAL_CONTENT_URI);
takePicture.setType("video/*");
startActivityForResult(takePicture, 4);
我的OnResultActivity Code for Video File Pick Intent:
if(requestCode == 4) {
Uri selectedVideoUri = data.getData();
Bitmap bitmap = ThumbnailUtils.createVideoThumbnail(selectedVideoUri.getPath(), MediaStore.Video.Thumbnails.MINI_KIND);
Log.i("Video URI, ", String.valueOf(bitmap));
}
还请帮我如何从录制的视频意图中获取缩略图
Intent takeVideo = new Intent(MediaStore.ACTION_VIDEO_CAPTURE);
startActivityForResult(takeVideo, REQUEST_VIDEO_CAPTURE);
答案 0 :(得分:0)
你应该有这样的东西
element {
border:none;
background-image:none;
background-color:transparent;
-webkit-box-shadow: none;
-moz-box-shadow: none;
box-shadow: none;
}
然后创建一个方法
final String noturipath = getRealPathFromUri();
Bitmap bitmap = ThumbnailUtils.createVideoThumbnail(noturipath, MediaStore.Video.Thumbnails.MICRO_KIND);