it视频网站:获取视频,从视频网址缩略图(Get thumbnail image of video from video url)

  197110.6星座运势 it视频网站:获取视频,从视频网址缩略图(Get thumbnail image of video from video url)-U9SEO

  Is it possible to get the thumbnail image from a video Url? I 2020年星座的运势need to thumbnails of videos in a list view.

  解决方案

  Yes its possible to get the thumbnail of a video using ThumbnailUtils.

  FileOutputStream out;

  File land=new File(Environment.getExternalStorageDirectory().getAbsoluteFile()

  +"/portland.jpg");// 苏珊米勒2018十二星座运势详解 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, 今年的星座运势2015年 100, stream);

  byte[] byteArray=stream.toByteArray();

  out=new FileOutputStream(land.getPath());

  out.write(byteArray);

鐢峰悓蹇楃綉绔欒糠閫?

  out.close();