如何在 Android 中播放 YouTube 视频?
我正在使用以下类来播放 YouTube 视频:
http://keyeslabs.com/joomla/samplecode/introvideoactivity/IntroVideoActivity.java
main Activity contain code:
Intent lVideoIntent = new Intent(null, Uri.parse("ytv:jRB8dQ5kiLg"), youtube1.this, IntroVideoActivity.class);
startActivity(lVideoIntent);
它加载视频,但一段时间后给出错误“抱歉,该视频无法播放”
,并在日志中给出如下错误。
-> http://www.youtube.com/get_video?video_id=jRB8dQ5kiLg&t=vjVQa1PpcFPMdWwPOC2JchyOxvrnNsRs1UyVc7gGd5I%3D&fmt=18
-> ERROR/HTTPDataSource(34): HTTP request failed w/ http status 404
-> INFO/AwesomePlayer(34): mConnectingDataSource->connect() returned -1004
-> ERROR/MediaPlayer(541): error (1, -1004)
我不明白我的错误在哪里。有人可以帮助我吗?
I'm using the following class to play YouTube video:
http://keyeslabs.com/joomla/samplecode/introvideoactivity/IntroVideoActivity.java
main Activity contain code:
Intent lVideoIntent = new Intent(null, Uri.parse("ytv:jRB8dQ5kiLg"), youtube1.this, IntroVideoActivity.class);
startActivity(lVideoIntent);
It loads the video, but after some time gives an error "Sorry,this video can't be played"
and in log gives an error like below.
-> http://www.youtube.com/get_video?video_id=jRB8dQ5kiLg&t=vjVQa1PpcFPMdWwPOC2JchyOxvrnNsRs1UyVc7gGd5I%3D&fmt=18
-> ERROR/HTTPDataSource(34): HTTP request failed w/ http status 404
-> INFO/AwesomePlayer(34): mConnectingDataSource->connect() returned -1004
-> ERROR/MediaPlayer(541): error (1, -1004)
I don't understand where what my mistake is. Can any one help me?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
尝试这样的事情:
Try Something like this:
HTTP request failed w/ http status 404
是一个页面未找到错误,因此我建议 URL 错误。我尝试了错误中的链接,它是一个空白页。HTTP request failed w/ http status 404
is a page not found error so I would suggest the URL is wrong. I tried the link in the error and it is a blank page.使用嵌入链接我可以播放 YouTube 视频。
using embed link i can played the youtube video.