how to get video thumbnail of youtube video in android list in android [duplicate]

只愿长相守 提交于 2020-01-12 01:45:16

问题


I am developing an application where I want to show a list which contains urls of youtube video. I am succeeded in showing list but problem is I am unable to show video thumbnail.

How to create youtube video thumbnail programatically.

Thank You

Edited:-- Hiren Dabhi give solution which I am using now & it solved problem

Thank You


回答1:


It is not possible to get a direct thumbnail of YouTube video, because actually it redirects the URL. If your URL is direct video URL then only you can get the thumbnail of that video.

You can get a thumbnail of your YouTube video using http://img.youtube.com/vi/VIDEO_ID/default.jpg by replacing VIDEO_ID with your own video's ID. This is fixed link for any YouTube video.

Hope this helps.... :)




回答2:


How are you getting the list of URLs ?

Read the Google Data API reference : http://code.google.com/apis/youtube/2.0/reference.html#Overview

You can post further queries with the video-id to get the thumbnail image directly which you could display. thumbnail metadata looks like this : [media:thumbnail url='http://img.youtube.com/vi/8aYQ_wjmriQ/2.jpg' height='90' width='120' time='00:01:23' yt:name='default'/]



来源:https://stackoverflow.com/questions/8655541/how-to-get-video-thumbnail-of-youtube-video-in-android-list-in-android

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!