简体   繁体   English

Android:从Video URI创建视频缩略图

[英]Android: Creating video thumbnails from Video URI

I'm budiling an application and it lists all the videos i recorded using the recorder in a list. 我正在开发一个应用程序,它在列表中列出了我使用录像机录制的所有视频。 Is it possible for me to create a thumbnail with the help of Uri instead of the string??? 我可以用Uri代替字符串来创建缩略图吗???

my current code goes as below but it no longer works as my input to the constructor is Uri not string. 我当前的代码如下,但由于我对构造函数的输入是Uri而不是字符串,因此它不再起作用。

bmThumbnail = ThumbnailUtils.createVideoThumbnail(
                    (db_results.get(position)), Thumbnails.MICRO_KIND);
            imageThumbnail.setImageBitmap(bmThumbnail);

I'm returned the error 我返回了错误

The method createVideoThumbnail(String, int) in the type ThumbnailUtils is not applicable for the arguments (Uri, int)

Thanks for your time in advance. 谢谢您的时间。

public String getRealPathFromURI(Uri contentUri) {
    String[] proj = { MediaStore.Images.Media.DATA };
    Cursor cursor = managedQuery(contentUri, proj, null, null, null);
    int column_index = cursor.getColumnIndexOrThrow(MediaStore.Images.Media.DATA);
    cursor.moveToFirst();
    return cursor.getString(column_index);
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM