1

I have created a simple APK for Android that uses WebChromeClient

  mWebChromeClient = new myWebChromeClient();
    webView.setWebChromeClient(mWebChromeClient);
    webView.getSettings().setJavaScriptEnabled(true);


    webView.getSettings().setUseWideViewPort(true);
    webView.getSettings().setLoadWithOverviewMode(true); 
    webView.getSettings().setPluginState(WebSettings.PluginState.ON); 

    webView.getSettings().setAppCacheEnabled(true);
    webView.getSettings().setBuiltInZoomControls(true);
    webView.getSettings().setSaveFormData(true);
    webView.loadUrl("http://example.com/embed.php");

I have set the user agent to desktop browser

 String ua = "Mozilla/5.0 (Windows NT 6.1; rv:2.0.1) Gecko/20100101 Firefox/4.0.1";      
    webView.getSettings().setUserAgentString(ua);   

I added hardware=accelerated to the manifest

 android:hardwareAccelerated="true"

Still, I am unable to get the youtube autoplay to work.

One clue is when I go to this URL in my app https://www.youtube.com/html5 it states that "The default player is currently used"

How can I get the embedded youtube video to autoplay in my WebChromeClient?

I have control over both the APK and the html page where the youtube video is embeded, so a solution for either end would work for me!

  • I am able to get the result I want in Firefox for Android by installing an extension that enables me to change User-Agent. I changed it to blank and then restarted the browser and navigate to my phage and my embeded youtube video DOES autoplay! However, I am unable to get that result in my own APK with user-agent set to blank. – kristenjo11 Dec 30 '14 at 23:59

0 Answers0