android - 如何从来自android服务的视频网址获取缩略图?

标签 android android-layout thumbnails

您好,在我的应用程序中,我正在从服务中获取图像 URL 和视频 URL。 从服务中获取这些后,我在 gridview 中显示图像,但对于 视频网址我无法获取缩略图。

如何获取此网址的缩略图.. 例子: http://www.pocketjourney.com/downloads/pj/video/famous.3gp

提前致谢。

最佳答案

    JSONObject jsonResponse = null;
    try {
         url="http://api.embed.ly/1/oembed?url="www.youtube.com/watch?v=XwGHJJYBs0Q"&maxwidth=500";
        DefaultHttpClient httpClient = new DefaultHttpClient();
        Log.v("URL request", "--->" + url);
        URI uri = new URI(url);
        HttpGet httpget = new HttpGet(uri);
        httpget.setHeader("Accept", "application/json");
        httpget.setHeader("Content-type", "application/json; charset=utf-8");
        HttpResponse response = httpClient.execute(httpget);
        HttpEntity responseEntity = response.getEntity();
        String changeTIDRec = EntityUtils.toString(responseEntity);
        System.out.println(changeTIDRec);
        jsonResponse = new JSONObject(changeTIDRec);
        Log.v("WebService", "Response : " + jsonResponse);
    } catch (Exception e) {
        e.printStackTrace();
    }
    return jsonResponse;





    JSONObject json = new WebService().RequestUrl(url);
            String thumbnail_url;
    if (json == null) {
        return null;
    } else {
        String provider_url = json.getString("provider_url");
        System.out.println("provider_url"+provider_url);
        String description = json.getString("description");
        System.out.println("description"+description);
        String title = json.getString("title");
        System.out.println("title"+title);
        String urls = json.getString("url");
        System.out.println("url"+urls);
        String thumbnail_width = json.getString("thumbnail_width");
        System.out.println("thumbnail_width"+thumbnail_width);
         thumbnail_url = json.getString("thumbnail_url");
        System.out.println("thumbnail_url"+thumbnail_url);
        String version = json.getString("version");
        System.out.println("version"+version);
        String provider_name = json.getString("provider_name");
        System.out.println("provider_name"+provider_name);
        String type = json.getString("type");
        System.out.println("type"+type);
        String thumbnail_height = json.getString("thumbnail_height");
        System.out.println("thumbnail_height"+thumbnail_height);
}
    return thumbnail_url;

关于android - 如何从来自android服务的视频网址获取缩略图?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13174027/

相关文章:

android - Gradle 控制台显示构建成功,但出现错误,并且应用程序未运行

android - 在android中从右上角、左下角、右下角旋转动画android?

android - 使用 ListView 自定义标题栏

android - CSS 媒体查询未按预期运行

java - Android 文本冒险应用程序 - 如何根据整数绘制不同的 XML 布局内容

android - 如何以相同的 Intent 从相机获取全尺寸图片和缩略图

php - Google Drive API 缩略图参数

iphone - 不能让 AVAssetImageGenerator 给我电影的所有帧

android - 如何使用 Maybe 运算符检查可空性

android - 如何禁用通知小图标?