0

From last one week i try to find how to play a html5 video in android webview i read so many blog and questions in the stack overflow but my problem is solve.i am using .mp4 , .wevm ,ogv and also .3gp format but noon of format is running.
i run these videos in the two different device one is micro-max funbook with android 4.0 and the another device is a Samsung device with 2.3.3 android os.

this is my code.

  url="file://"+Environment.getExternalStorageDirectory()+"/unzipped/HTML5/res/test1.html";


    webview = (WebView) findViewById(R.id.webview);
    webview.setWebChromeClient(new WebChromeClient());
    webview.getSettings().setPluginsEnabled(true);
    webview.getSettings().setPluginState(PluginState.ON);
    webview.getSettings().setJavaScriptEnabled(true);

    webview.getSettings().setDomStorageEnabled(true);
    webview.setWebViewClient(new WebViewClient() {
    @Override
    public boolean shouldOverrideUrlLoading(WebView view, String url) {
         view.loadUrl(url);
         return true;
       }    
           });

   webview.loadUrl(url);
Naveen Kumar
  • 3,738
  • 4
  • 29
  • 50

1 Answers1

0

For API level 11+ it should suffice that you add the attribute android:hardwareAccelerated="true" to the <application> tag in your Android manifest file.

For older APIs you need to implement the methods onShowCustomView and onHideCustomView in your your own WebChromeClient.

Or you can check out the html5webview

Mokus
  • 3,339
  • 1
  • 24
  • 30