解决方法
是的,可以使用ThumbnailUtils获取视频的缩略图.
- FileOutputStream out;
- File land=new File(Environment.getExternalStorageDirectory().getAbsoluteFile()
- +"/portland.jpg");// image file use to create image u can give any path.
- Bitmap bitmap=ThumbnailUtils.createVideoThumbnail(filePath,MediaStore.Video.Thumbnails.FULL_SCREEN_KIND);//filePath is your video file path.
- ByteArrayOutputStream stream = new ByteArrayOutputStream();
- bitmap.compress(Bitmap.CompressFormat.JPEG,100,stream);
- byte[] byteArray = stream.toByteArray();
- out=new FileOutputStream(land.getPath());
- out.write(byteArray);
- out.close();