How to play YouTube video inside Android WebView? -


i making rss reader application, , rss data url, , rss data can contain link youtube video.

here example how link youtube vide looks like:

div class="video-shortcode"><iframe title="youtube video player" width="600"  height="350" src="http://www.youtube.com/embed/hxrcuycva6c" frameborder="0" allowfullscreen></iframe></div> 

and when run application, there no video, black, , can't play it.

how can play video inside webview?

edit: here result:

enter image description here

here code:

 // set webview properties     websettings ws = desc.getsettings();     ws.setlayoutalgorithm(layoutalgorithm.single_column);     ws.getpluginstate();     ws.setpluginstate(pluginstate.on);     ws.setjavascriptenabled(true);     ws.setuseragent(0);     ws.setjavascriptcanopenwindowsautomatically(true);      desc.setwebchromeclient(new webchromeclient() {     });     desc.loaddatawithbaseurl("http://www.balkanandroid.com/", feed     .getitem(pos).getcontent(), "text/html", "utf-8", null); 

i have android:hardwareaccelerated="true" in androidmanifest.xml.

probably not of use, might handy future people (hey future people).

but remove line:

ws.setlayoutalgorithm(layoutalgorithm.single_column);

and make sure javascript enabled

ws.setjavascriptenabled(true);

these 2 lines caused me quite lot of trouble when starting out.


Comments

Popular posts from this blog

html5 - What is breaking my page when printing? -

c# - must be a non-abstract type with a public parameterless constructor in redis -

ajax - PHP/JSON Login script (Twitter style) not setting sessions -