webview not showing you tube video on android 4.0 (ICS)
<p>I want to show you tube video on both android lower version and higher version.My code works fine upto android 3.0 but on 4.0 it is display you tube video screen but when click to play it shows only progress bar on you tube video.</p>

<p>here is my code-</p>

<pre><code> if(Build.VERSION.SDK_INT &lt; Build.VERSION_CODES.HONEYCOMB)
        {
            playVideoForBelowVersion();
        }

        else
        {

            playVideoForIcs();
        }
private void playVideoForBelowVersion() 
     {
        String url =  videoLinks[position] + "?autoplay=1";
        webView.getSettings().setJavaScriptEnabled(true);
        webView. getSettings().setJavaScriptCanOpenWindowsAutomatically (false);
        webView. getSettings().setPluginsEnabled (true);
        webView. getSettings().setSupportMultipleWindows (false);
        webView. getSettings().setSupportZoom (false);
        webView. setVerticalScrollBarEnabled (false);
        webView. setHorizontalScrollBarEnabled (false);
        webView.loadUrl(url);
        webView.setWebChromeClient(new WebChromeClient());
        webView.setWebViewClient(new WebViewClient()
        {


            @Override
            public void onPageFinished(WebView view, String url) {
                // TODO Auto-generated method stub
                super.onPageFinished(view, url);
//               progressDialog.dismiss();

            }

            @Override
            public void onPageStarted(WebView view, String url, Bitmap favicon) {
                // TODO Auto-generated method stub
                super.onPageStarted(view, url, favicon);
                 /*progressDialog.setMessage("Loading Video please wait...");
                 progressDialog.show();*/


            }

            @Override
            public void onReceivedError(WebView view, int errorCode,
                    String description, String failingUrl) {
                // TODO Auto-generated method stub
                super.onReceivedError(view, errorCode, description, failingUrl);
                Utilities.showToast(FullVideoAct.this, "Video Error...");
            }

            @Override
            public boolean shouldOverrideUrlLoading(WebView view, String url) {
                // TODO Auto-generated method stub
                view.loadUrl(url);
                return true;
            }

        });
        webView.requestFocus();
     }

    private void playVideoForIcs() 
     {
        getWindow().setFlags(WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED,  WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED);
        String strUrl = "http://m.youtube.com/index?&amp;desktop_uri=%2F#/watch?v="+videoLinksIds[position];
//      String strUrl =  videoLinks[position] + "?autoplay=1";
//      String strUrl ="http://www.youtube.com/v/"+videoLinksIds[position]+"?enablejsapi=1&amp;version=3&amp;playerapiid=ytplayer";
        webView.getSettings().setJavaScriptEnabled(true);
        webView. getSettings().setJavaScriptCanOpenWindowsAutomatically (false);
        webView. getSettings().setPluginsEnabled (true);
        webView. getSettings().setSupportMultipleWindows (false);
        webView. getSettings().setSupportZoom (false);
        webView. setVerticalScrollBarEnabled (false);
        webView. setHorizontalScrollBarEnabled (false);
        webView.loadUrl(strUrl);
        //wvVideo.loadData(htmlString, "text/html", "UTF-8");
        webView.setWebChromeClient(new WebChromeClient());

        webView.requestFocus();

     }
</code></pre>
