how to get the videos(urls) in listview?

2019-03-04 05:55发布

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 ??

I have youtube videos urls in a array list. I want this array list of videos should show in listview(thumbnails) with text and if the user select the video it should play in next full screen..

How to implement this?? please help me..

I have went through google but still i didn't clear example.. Please any one help me..

Thanks a lot in advance...

2条回答
放我归山
2楼-- · 2019-03-04 06:40

take look at this example from github
and for more

I have used this code in my application and played videos into Webview using Html code iframe tag.

查看更多
小情绪 Triste *
3楼-- · 2019-03-04 06:53
    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

查看更多
登录 后发表回答