0

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.

seaplain
  • 773
  • 6
  • 25
Nikhil Virupakshi
  • 442
  • 1
  • 13
  • 26
  • Hey check this **[post][1]** regarding to your issue . [1]: http://stackoverflow.com/questions/1711078/html5-video-element-on-android – androidgeek Mar 02 '13 at 04:10

2 Answers2

1

I ran into the same issue, but was able to figure out by reviewing this project: http://code.google.com/p/html5webview/

Jeremey
  • 1,316
  • 2
  • 12
  • 19
0

get rid of all settings except webPage.getSettings().setJavaScriptEnabled(true); and make sure hardwareacceleration is on

Omid Aminiva
  • 669
  • 5
  • 14