在android中的应用程序中播放youtube视频 [英] Play youtube video In App in android
问题描述
在我的 android 应用程序中,我想在应用程序中播放 youtube 视频,而不是在默认浏览器中.我最近几天都在尝试这个.以前我使用以下代码播放 youtube 视频:http://code.google.com/p/android-youtube-player/下载/列表
In my android application I want to play youtube video in App, not in the default browser. I am trying this for the last some days. Previously I played the youtube video using the following code : http://code.google.com/p/android-youtube-player/downloads/list
但是现在这段代码不起作用了.显示抱歉,无法播放此视频".对于此错误,我已经尝试了不同论坛中提到的所有可能的解决方案.但是无法播放视频.这就是为什么我试图找到另一种在应用程序中播放视频的方法.我试过 youtube 视频的 RTSP 链接,它正在播放 3gp 视频文件,但视频质量很差.这是不可接受的.我真的很想找到在应用程序中播放 YouTube 视频的好方法.请帮忙.任何好的建议总是受欢迎的.桑塔努
But now this code is not working. It shows "Sorry, this video cannot be played." I have tried all the possible solution mentioned in the different forum for this error. But could not be able to play the video. That's why I am trying to find out another way to play the video in app. I have tried the RTSP link of a youtube video , it is playing the 3gp video file, but video quality is very poor. This is not acceptable. I am really fade up to find out good solution to play youtube video in app. Please help. Any good suggestion is always welcome. Santanu
推荐答案
随着这个库的发布,在 Android 中播放 YouTube 视频变得非常简单:https://developers.google.com/youtube/android/player/.该页面上的开发人员指南是有关如何使用此库的很好的资源.他们还提供了有关如何使用库提供的功能的示例代码.步骤基本上是:
Playing YouTube videos in Android was made very simple with the release of this library: https://developers.google.com/youtube/android/player/. The Developer Guide on that page is a good resource on how to use this library. They also provide sample code on how to use the functionality provided by the library. The steps are basically:
- 获取开发者密钥
- 下载库并将其包含在您的项目中
- 使用库播放视频(提示,第一步使用 YouTubePlayerView)
如果您有任何问题或需要任何代码示例,请再次发帖.
Please post again if you have any questions or need any code examples.
这篇关于在android中的应用程序中播放youtube视频的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!