【问题标题】:android video thumbnails安卓视频缩略图
【发布时间】:2011-03-16 07:56:45
【问题描述】:

我知道谷歌没有官方 API 来获取 API 2.0 下的视频缩略图,但我如何访问画廊应用程序中显示的视频缩略图。它们存储在某个地方?

【问题讨论】:

    标签: android video thumbnails


    【解决方案1】:

    使用视频的路径可以得到缩略图这样,

    String tmppath = "/sdcard/temp.png";
    String[] proj = { MediaStore.Video.Media._ID,
            MediaStore.Video.Media.DISPLAY_NAME,
            MediaStore.Video.Media.DATA };
    
    Cursor cursor = managedQuery(
            MediaStore.Video.Media.EXTERNAL_CONTENT_URI, proj,
            MediaStore.Video.Media.DISPLAY_NAME + "=?",
            new String[] { tmppath.substring(tmppath.lastIndexOf("/")+1,
                    tmppath.length()) }, null);
    cursor.moveToFirst();
    long id1 = cursor.getLong(cursor
            .getColumnIndex(MediaStore.Video.Media._ID));
    
    ContentResolver crThumb = getContentResolver();
    BitmapFactory.Options options=new BitmapFactory.Options();
    options.inSampleSize = 1;
    bitmap = MediaStore.Video.Thumbnails.getThumbnail(crThumb,id1, MediaStore.Video.Thumbnails.MICRO_KIND, options);
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2010-12-01
      • 2013-06-15
      • 2023-04-05
      • 2010-12-13
      • 2012-02-23
      • 2018-12-21
      • 2015-03-26
      相关资源
      最近更新 更多