3

In my project I have a WebView which loads dynamically generated webpage with embedded youtube video like this:

<iframe type="text/html" width="640" height="385" frameborder="0" 
src="http://www.youtube.com/embed/6nQCcgpDpXQ?autoplay=1&&playlist=6nQCcgpDpXQ&loop=1">
</iframe>

If I check this web the video plays ok and loops ok as well.

In the Android App I have the following code:

    WebView engine = (WebView) findViewById(R.id.web_engine);
    engine.setWebChromeClient(new WebChromeClient());
    engine.getSettings().setPluginState(PluginState.ON);
    engine.getSettings().setJavaScriptEnabled(true);
    engine.setInitialScale(100);
    engine.getSettings().setBuiltInZoomControls(true);
    engine.getSettings().setAllowFileAccess(true);
    engine.getSettings().setPluginsEnabled(true);
    engine.loadUrl(miUrl);

And it works, but

  1. Autoplay does not work I have to play it by hand
  2. Autoloop does not work, after the video finish it becomes all black, there is no menu, there is no play/pause/stop video. It is useless and if I want to play again I have to reload the entire page.

One more thing, in this line:

engine.getSettings().setPluginsEnabled(true);

It says that it is deprecated.

In the manifest I give Internet permission access to the application and I have Hardware acceleration to true.

Can someone help me with this?

D. Wonnink
  • 306
  • 4
  • 19
Kioko Kiaza
  • 1,378
  • 8
  • 28
  • 57
  • 1
    I have encountered similar behavior myself. My understanding of the issue is that this is not a problem with the youtube functionality, but a problem with query string parameters on a URL being set in a webview. Various posts on SO and around the web suggest that this is a problem in earlier versions of the API, but it is not a problem now, however, I have not yet seen a resolution to this problem and am also eager to see a resolution or at least a well understood workaround. – Philip Rich Nov 11 '13 at 10:28

0 Answers0