android - How to load video thumbnails using square picasso library? -


currently i'm loading mediastore image thumbnails using picasso listview following snippet: (video.getdata() returns actual path of image such mnt/sdcard/...)

picasso.with(this.context)        .load(new file(photo.getdata()))        .resize(50, 50).config(config)        .centercrop()        .into(viewholder.imageviewitem); 

now i'm , unable load mediastore video thumbnails passing video.getdata() instead of photo.getdata()?

first need create videorequesthandler

public class videorequesthandler extends requesthandler{     public string scheme_video="video";     @override     public boolean canhandlerequest(request data)      {         string scheme = data.uri.getscheme();         return (scheme_video.equals(scheme));     }      @override     public result load(request data, int arg1) throws ioexception      {          bitmap bm = thumbnailutils.createvideothumbnail(data.uri.getpath(), mediastore.images.thumbnails.mini_kind);          return new result(bm,loadedfrom.disk);       } } 

after that

 videorequesthandler videorequesthandler;  picasso picassoinstance; 

build once

 videorequesthandler = new videorequesthandler();  picassoinstance = new picasso.builder(context.getapplicationcontext())   .addrequesthandler(videorequesthandler)   .build(); 

then load file path

 picassoinstance.load(videorequesthandler.scheme_video+":"+filepath).into(holder.videothumbnailview); 

Comments

Popular posts from this blog

php - Zend Framework / Skeleton-Application / Composer install issue -

c# - Better 64-bit byte array hash -

python - PyCharm Type error Message -