从youtube api,我得到这三个视频播放的url,但没有一个提供我良好的视频输出质量在手机上。我正在从用户上传的信息中获取这些信息。
<entry>
<id>http://gdata.youtube.com/feeds/api/videos/tLEpHDsQhCw</id>
<published>2011-07-16T20:35:17.000Z</published>
<updated>2011-10-17T12:25:11.000Z</updated>
<category scheme='http://schemas.google.com/g/2005#kind'
term='http://gdata.youtube.com/schemas/2007#video' />
<category scheme='http://gdata.youtube.com/schemas/2007/categories.cat'
term='Music' label='Music' />
<category scheme='http://gdata.youtube.com/schemas/2007/keywords.cat'
term='Attaullah Khan Esakhelvi' />
<category scheme='http://gdata.youtube.com/schemas/2007/keywords.cat'
term='Coke Studio' />
<category scheme='http://gdata.youtube.com/schemas/2007/keywords.cat'
term='Season 4' />
<title type='text'>Attaullah Khan Esakhelvi, Coke Studio, Season 4
</title>
<content type='text'>Coke Studio Sessions. Produced by Rohail Hyatt.
</content>
<link rel='alternate' type='text/html'
href='https://www.youtube.com/watch?v=tLEpHDsQhCw&feature=youtube_gdata' />
<link rel='http://gdata.youtube.com/schemas/2007#video.responses'
type='application/atom+xml'
href='https://gdata.youtube.com/feeds/api/videos/tLEpHDsQhCw/responses' />
<link rel='http://gdata.youtube.com/schemas/2007#video.related'
type='application/atom+xml' href='https://gdata.youtube.com/feeds/api/videos/tLEpHDsQhCw/related' />
<link rel='http://gdata.youtube.com/schemas/2007#mobile' type='text/html'
href='https://m.youtube.com/details?v=tLEpHDsQhCw' />
<link rel='self' type='application/atom+xml'
href='https://gdata.youtube.com/feeds/api/users/cokestudio/uploads/tLEpHDsQhCw' />
<author>
<name>cokestudio</name>
<uri>https://gdata.youtube.com/feeds/api/users/cokestudio</uri>
</author>
<gd:comments>
<gd:feedLink
href='https://gdata.youtube.com/feeds/api/videos/tLEpHDsQhCw/comments'
countHint='6' />
</gd:comments>
<yt:hd />
<yt:location>Karachi</yt:location>
<media:group>
<media:category label='Music'
scheme='http://gdata.youtube.com/schemas/2007/categories.cat'>Music</media:category>
<media:content
url='https://www.youtube.com/v/tLEpHDsQhCw?version=3&f=user_uploads&app=youtube_gdata'
type='application/x-shockwave-flash' medium='video' isDefault='true'
expression='full' duration='226' yt:format='5' />
<media:content
url='rtsp://v3.cache5.c.youtube.com/CigLENy73wIaHwkshBA7HCmxtBMYDSANFEgGUgx1c2VyX3VwbG9hZHMM/0/0/0/video.3gp'
type='video/3gpp' medium='video' expression='full' duration='226'
yt:format='1' />
<media:content
url='rtsp://v1.cache5.c.youtube.com/CigLENy73wIaHwkshBA7HCmxtBMYESARFEgGUgx1c2VyX3VwbG9hZHMM/0/0/0/video.3gp'
type='video/3gpp' medium='video' expression='full' duration='226'
yt:format='6' />
<media:description type='plain'>Coke Studio Sessions.
Produced by Rohail Hyatt.</media:description>
<media:keywords>Attaullah Khan Esakhelvi, Coke Studio, Season 4
</media:keywords>
<media:player
url='https://www.youtube.com/watch?v=tLEpHDsQhCw&feature=youtube_gdata_player' />
<media:thumbnail url='http://i.ytimg.com/vi/tLEpHDsQhCw/0.jpg'
height='360' width='480' time='00:01:53' />
<media:thumbnail url='http://i.ytimg.com/vi/tLEpHDsQhCw/1.jpg'
height='90' width='120' time='00:00:56.500' />
<media:thumbnail url='http://i.ytimg.com/vi/tLEpHDsQhCw/2.jpg'
height='90' width='120' time='00:01:53' />
<media:thumbnail url='http://i.ytimg.com/vi/tLEpHDsQhCw/3.jpg'
height='90' width='120' time='00:02:49.500' />
<media:title type='plain'>Attaullah Khan Esakhelvi, Coke Studio,
Season 4</media:title>
<yt:duration seconds='226' />
</media:group>
<gd:rating average='4.928571' max='5' min='1' numRaters='56'
rel='http://schemas.google.com/g/2005#overall' />
<yt:recorded>2011-07-17</yt:recorded>
<yt:statistics favoriteCount='34' viewCount='13122' />
</entry>
VideoView vv = (VideoView) findViewById(R.id.vv);
MediaController mc = new MediaController(this);
mc.setEnabled(true);
mc.show(0);
vv.setMediaController(mc);
vv.setVideoURI(Uri.parse("rtsp://v1.cache5.c.youtube.com/CigLENy73wIaHwkshBA7HCmxtBMYESARFEgGUgx1c2VyX3VwbG9hZHMM/0/0/0/video.3gp"));
vv.requestFocus();
vv.start();
我正在使用这个java代码访问和播放视频请建议一些解决方案,以便我为我的应用程序提供高质量的视频播放。
Thanks in advance
目前的建议是在应用程序的WebView中使用Player。
在未来的某个时候,我们计划发布一个可以处理YouTube播放的原生Android视图,正如在Google I/O 2012会议上所描述的:https://developers.google.com/events/io/sessions/gooio2012/120/