从视频网址拇指返回在Android 4.0及以上空 [英] Thumb from video url returns null on android 4.0 and above
问题描述
在我的应用程序必须显示的视频列表,我已经从视频中创建的映像(拇指),并在列表中显示该图像。
In my application i have to show list of videos,i have created image(thumb) from video and show that image in list.
我添加code,我被用于创建拇指 -
I added code that i was used for create thumb-
Bitmap bitmap=ThumbnailUtils.createVideoThumbnail(filePath, MediaStore.Video.Thumbnails.FULL_SCREEN_KIND);
ByteArrayOutputStream stream = new ByteArrayOutputStream();
bitmap.compress(Bitmap.CompressFormat.JPEG, 100, stream);
我的问题是,当我运行在Android API级应用低于4.0大拇指产生,但是当我在Android 4.0及以上ThumbnailUtils.createVideoThumbnail运行相同的应用程序()方法返回null。
请帮助我如何解决这个问题。
My problem is that when i run app on android api level below 4.0 thumb is generate but when i run same application on android 4.0 and above ThumbnailUtils.createVideoThumbnail() method returns null. Please help me how to fix this issue.
从昨天的工作,但仍然没有得到solution.I曾尝试 -
Working from yesterday but still not getting solution.I have tried -
Bitmap bitmap=ThumbnailUtils.createVideoThumbnail(filePath, MediaStore.Video.Thumbnails.MINI_KIND);
and
Bitmap bitmap=ThumbnailUtils.createVideoThumbnail(filePath, MediaStore.Video.Thumbnails.MICRO_KIND);
但仍然返回null。
but still returning null.
先谢谢了。
推荐答案
createVideoThumbnail(字符串文件路径,诠释的那种)
支持 MINI_KIND或MICRO_KIND
作为一种而已。
createVideoThumbnail(String filePath, int kind)
supports MINI_KIND or MICRO_KIND
as kind only.
请参见 http://developer.android.com/reference/android/media /ThumbnailUtils.html 。
尝尝其中...
问候
try one of those... regards
请注意:可能返回null如果视频损坏或不支持的格式
这篇关于从视频网址拇指返回在Android 4.0及以上空的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!