gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-11-30 03:57:10 25 4
gpt4 key购买 nike

您好,在我的应用程序中,我正在从服务中获取图像 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/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com