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
- Autoplay does not work I have to play it by hand
- 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?