如何在Android中显示YouTube视频的缩略图 [英] How to display thumbnail of YouTube Videos in Android
问题描述
我编写了一个要在其中显示YouTube视频列表的应用程序.但是我希望列表显示视频标题以及其他信息,并且还显示视频的缩略图,就像我们 www.youtube.com
I writing an app where i want to display a list of YouTube videos. But I want the list to display the video title with some other info but also show a thumbnail of the video like it does when we go www.youtube.com
有人可以帮助我了解如何显示视频URL的缩略图吗?
Can someone help me please on How to display the thumbnail for a video URL?
推荐答案
尝试一下:
-
从URL解析视频ID:这是URL中的"v"参数. IE. http://www.youtube.com/watch?v=xAiiwSXVRiw
通过Youtube Gdata URL获取视频元数据: http://gdata.youtube.com/feeds/api/videos/xAiiwSXVRiw
Get the video metadata via Youtube Gdata URL: http://gdata.youtube.com/feeds/api/videos/xAiiwSXVRiw
解析返回的XML,并查找<media:thumbnail url='..'>
. "url"属性包含缩略图网址.
Parse the XML that you get back and look for <media:thumbnail url='..'>
. The 'url' attribute contains to the thumbnail url.
这篇关于如何在Android中显示YouTube视频的缩略图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!