问题
I want to play YouTube video in WebView or
When user click on youtube video I have to forward it to real YouTube app because in WebView I am not able to play YouTube video.
Is there any way to play a YouTube video in our WebView?
回答1:
you can play video in video view(the videos those are stored in local storage)...
refer 2 this.....
but if you want 2 stream it from server you have 2 go for rtsp video streaming....
look at this...
回答2:
This is very usefull link for playing you tube video without webview -http://www.androidhive.info/2014/12/how-to-play-youtube-video-in-android-app/
For getting video id use link - https://www.youtube.com/watch?v=EKyirtVHsK0
回答3:
As long as the video and device supports HTML5 you can do it through that, and if it has any flash elements you can run it as a flash application and it will treat it like a web page.
回答4:
There are many things to ensure that you are able to view a YouTube video in your application.
1) Enable hardware acceleration in your application using android:hardwareAccelerated="true"
2)Ensure that your WebView has plugins enabled
webSettings.setPluginState(PluginState.ON);
If it still does not work, try loading the webpage a few times, or pass an Intent with the video link to YouTube.
来源:https://stackoverflow.com/questions/4956559/android-play-youtube-video-in-webview