Youtube video does not play in android web browser from iframe

I am developing an Android application.

This is my XML feed tag:

<FullContent> <style> img {padding:2px;} p{color:#fff} </style> <p> Actor Hrithik Roshan has always nursed a</p> <br/><br/><br/><br/><br/> <p style=font-size:12px>@Notch 2013</p> <iframe src="http://www.youtube.com/embed/k8T3_JupGhI?fs=0" width="500" height="298" frameborder="0"></iframe> </FullContent> 

I am trying to play a video in android webview with the following code -

  content = (WebView) findViewById(R.id.fullcontent); content.setWebChromeClient(new WebChromeClient()); content.setScrollBarStyle(View.SCROLLBARS_INSIDE_OVERLAY); content.getSettings().setJavaScriptEnabled(true); content.getSettings().setDomStorageEnabled(true); content.getSettings().setPluginsEnabled(true); String fullcontent = in.getStringExtra("FullContent"); full_content=fullcontent.substring(1); content.loadDataWithBaseURL(null,full_content, "text/html", "UTF-8",null); 

But when I click on it, the video does not play.

What is wrong with my code?

EDIT:

  I have added below code on my android app web.getSettings().setPluginState(PluginState.ON_DEMAND); web.getSettings().setPluginState(PluginState.ON); web.getSettings().setPluginsEnabled(true); 

now also i am facing the same problem. The video opens. But when I click on it, the video does not play.

+4
source share
1 answer

Do not try to include an iframe, but just provide a thumbnail of a video that directly links to a YouTube page or h264 file.

Previous discussion with a possible solution .

0
source

All Articles