Android play youtube video in webview [closed]

蓝咒 提交于 2019-12-30 07:21:07

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!