UMAR-MOBITSOLUTIONS
UMAR-MOBITSOLUTIONS

Reputation: 78004

Cannot play video inside WebView using iframe tag?

I am using the following data to display in a WebView. These are the HTML tags along with the iframe which is referring to a video.

Now the problem is when I click on it, it shows the play button but cannot play the video.

Can I play this video inside WebView or not?

<p></p><P> because of Jon’s pro-growth, business-friendly policies, Utah's economy expanded at more than triple the national rate and was named the best state for business by <EM>Forbes.</em><BR /><BR /><IFRAME height=241 src="http://player.vimeo.com/video/25349114" frameBorder=0 width=425></iframe></p><br />

<P>America needs a dose of the same medicine. Today, our nation has the second highest corporate tax rate in the developed world. We have convoluted and confusing regulations. 
<!--break--><!--break--><p></p>

when I try to run this url in the android browser it opens videoview and plays that file perfectly but why not in iframe? http://player.vimeo.com/video/25349114

Upvotes: 5

Views: 4593

Answers (2)

scottyab
scottyab

Reputation: 24039

The key thing is to enable browser plugins.

// how to enable the webview plugin changed in API 8
if (Build.VERSION.SDK_INT < 8) {
    mWebView.getSettings().setPluginsEnabled(true);
} else {
    mWebView.getSettings().setPluginState(PluginState.ON);
}

Also worth checking flash player is installed

Upvotes: 3

Dhrumil Shah - dhuma1981
Dhrumil Shah - dhuma1981

Reputation: 15799

WebView wv;
wv = (WebView) findViewById(R.id.mywebview);

wv.getSettings().setJavaScriptEnabled(true);
wv.getSettings().setBuiltInZoomControls(true);
wv.getSettings().setPluginsEnabled(true);

Use this code to load your video and also update the flashplayer of your device...

Upvotes: 2

Related Questions