如何显示视频的缩略图?安卓 [英] How to display a thumbnail for a video? Android
问题描述
我正在尝试为我的视频视图显示缩略图,我有一个分层的图像视图,我想放置一个缩略图......我试过这个,但它不工作,不确定以字符串形式传递的 url问题是什么?没有错误,图像只是不显示占位符显示,所以这与我制作位图的方式有关,链接也正确显示了视频.
I am trying to display a thumbnail for my videoview, I have an imageview layered ontop that I want to place a thumbnail... I tried this but it is not working not sure if the url which is being passed as a string is the problem? No errors and the image just does not display the placeholder shows though, so it has to do with either the way I am doing the bitmap, the link also shows the video correctly.
String filePath = ""http://unknown.com/v3-1aox9d1.mp4"";
ImageView imageview_micro = (ImageView)findViewById(R.id.thumbnail_micro);
Bitmap bmThumbnail;
//MICRO_KIND, size: 96 x 96 thumbnail
bmThumbnail = ThumbnailUtils.createVideoThumbnail(filePath, Thumbnails.MICRO_KIND);
imageview_micro.setImageBitmap(bmThumbnail);
推荐答案
那不是使用 createVideoThumbnail
的方式.
That is not the way to use createVideoThumbnail
.
第一个参数应该是指向本地文件的文件路径.您正在使用网址.
The first parameter should be a file path which refers to a local file. You are using a web url.
您必须先下载视频或寻找其他解决方案.
You have to download the video first or have to search for an other solution.
这个答案可能对您有帮助:https://stackoverflow.com/a/23523205/5038873
This answer might help you: https://stackoverflow.com/a/23523205/5038873
这篇关于如何显示视频的缩略图?安卓的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!