如何使YouTube的视频缩略图的Android?
在我的Android活动我想通过YouTube应用程序或其他一些来自YouTube播放视频。为此,我要加载视频的缩略图,在我的活动。
In my android Activity I want to play video from YouTube through YouTube application or some other. For that I want to load thumbnails of the video in my activity.
这可能吗?如果是这样,怎么样?
Is this possible? If so, how?
YouTube上放视频的缩略图,在特定,predictable URL。这将是一个有点痛,但我相信你能找到一个方法来从URL显示图像,或下载它们,然后显示出来。
YouTube puts the thumbnails of the video at a specific, predictable URL. It would be a bit of a pain, but I'm sure you could find a way to display the images from the URL, or to download them and then display them.
下面是在我的博客上的那些东西缩略图网址的信息: http://alamoxie.com/blog/web-design/add-youtube-thumbnails/
Here's information on my blog on what those thumbnail URLs are: http://alamoxie.com/blog/web-design/add-youtube-thumbnails/
我会复制和粘贴什么,我在博客中写道:
I'll copy and paste what I wrote in the blog post:
看的链接的视频 - 例如, http://www.youtube.com/watch?v= GDFUdMvacI0 采取视频ID ......部分后V =。如果URL是长于,只有去,直到下一个符号。例如,http://www.youtube.com/watch?v=GDFUdMvacI0&feature=youtu.be是同样的视频的ID。 然后,只需替换您的视频ID在这些缩略图以下网址的视频ID: http://img.youtube.com/vi/GDFUdMvacI0/0.jpg http://img.youtube.com/vi/GDFUdMvacI0/1.jpg http://img.youtube.com/vi/GDFUdMvacI0/2.jpg http://img.youtube.com/vi/GDFUdMvacI0/3.jpg 0.jpg是一个全尺寸的图像。另外三个是非常小的(120×90),并自动由YouTube从三个某些点在视频拍摄。
Look at the link for the video–for example, http://www.youtube.com/watch?v=GDFUdMvacI0 Take the video ID… the portion after "v=". If the URL is longer than that, only go until the next ampersand. For example, http://www.youtube.com/watch?v=GDFUdMvacI0&feature=youtu.be is the same video ID. Then just substitute your video ID for the video ID in the following URLs to these thumbnail images: http://img.youtube.com/vi/GDFUdMvacI0/0.jpg http://img.youtube.com/vi/GDFUdMvacI0/1.jpg http://img.youtube.com/vi/GDFUdMvacI0/2.jpg http://img.youtube.com/vi/GDFUdMvacI0/3.jpg 0.jpg is a full-sized image. The other three are very small (120×90) and are taken automatically by YouTube from three certain points in the video.