Reputation: 482
I have Video tag in Html5 which needs to play a local video from assets folder in android webview ,but i am not able to play the video when clicking on play button ,i am using a android 3.1 version have also added hardware acclerate in manifest ,i am sure missing something ,please help with a some ideas.Below is the code
webPage.setWebChromeClient(chromeClient);
WebViewClient webViewClient = new WebViewClient();
webPage.setWebViewClient(webViewClient);
webPage.getSettings().setAllowFileAccess(true);
webPage.getSettings().setDomStorageEnabled(true);
webPage.getSettings().setJavaScriptEnabled(true);
webPage.getSettings().setPluginState(WebSettings.PluginState.ON);
webPage.getSettings().setPluginsEnabled(true);
webPage.getSettings().setLoadWithOverviewMode(true);
webPage.getSettings().setUseWideViewPort(true);
webPage.getSettings().setPluginState(PluginState.ON);
webPage.loadUrl("file:///android_asset/layout/form.html");
public class chromeClient extends WebChromeClient {
@Override
public void onShowCustomView(View view, CustomViewCallback callback) {
// TODO Auto-generated method stub
super.onShowCustomView(view, callback);
if (view instanceof FrameLayout) {
FrameLayout frame = (FrameLayout) view;
if (frame.getFocusedChild() instanceof VideoView) {
VideoView video = (VideoView) frame.getFocusedChild();
// frame.removeView(video);
video.start();
}
}
}
}
Thanks in advance.
Upvotes: 0
Views: 3394
Reputation: 667
get rid of all settings except webPage.getSettings().setJavaScriptEnabled(true); and make sure hardwareacceleration is on
Upvotes: 0
Reputation: 1516
I ran into the same issue, but was able to figure out by reviewing this project: http://code.google.com/p/html5webview/
Upvotes: 1