how to get the videos(urls) in listview?

后端 未结 2 964
面向向阳花
面向向阳花 2021-01-26 12:25

I\'m new to android domain..

I\'m working with small app.. In my app im using youtube videos to play in video view..

What i need is ??<

2条回答
  •  时光说笑
    2021-01-26 12:36

        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;
    

    Example

    http://api.embed.ly/1/oembed?url=http://www.youtube.com/watch?v=KFBdW9EQgVg&maxwidth=500

    thumbnail url :http://i4.ytimg.com/vi/KFBdW9EQgVg/hqdefault.jpg

提交回复
热议问题