获取视频,从视频网址缩略图 [英] Get thumbnail image of video from video url
本文介绍了获取视频,从视频网址缩略图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
是否有可能从视频网址获得缩略图?我需要的视频缩略图列表视图。
Is it possible to get the thumbnail image from a video Url? I need to thumbnails of videos in a list view.
推荐答案
是其可能获得使用ThumbnailUtils视频的缩略图。
Yes its possible to get the thumbnail of a video using 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();
这篇关于获取视频,从视频网址缩略图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文