I'm using an http server inside my application (using nanohttpd) which serves a page that has a video element which plays video using JwPlayer. The video type is .mp4.
The problem is that I am not able to correctly reproduce the video in my Samsung galaxy S3 Mini with a custom ROM. The audio is fine but inside the video area everything is black except for the lower right corner, which displays part of the webview (glitches). I tried enabling hardware acceleration but it still isn't working.
The video correctly plays in the android chrome browser (accessible through the app's server), so maybe it is an error with the configuration of the WebView or chromium? It also plays correctly in some other devices (Samsung galaxy S3).
This is the code I use to setup the WebView:
webView = (WebView) findViewById(R.id.webview);
webView.setBackgroundColor(Color.TRANSPARENT);
if (Build.VERSION.SDK_INT >= 11)
webView.setLayerType(View.LAYER_TYPE_HARDWARE, null);
webView.getSettings().setJavaScriptEnabled(true);
webView.getSettings().setLoadsImagesAutomatically(true);
webView.getSettings().setPluginState(PluginState.ON);
webView.getSettings().setJavaScriptCanOpenWindowsAutomatically(true);
webView.getSettings().setAllowFileAccess(true);
getWindow().addFlags(128);
webView.setWebChromeClient(new WebChromeClient() {
@Override
public boolean onJsAlert(WebView view, String url, String message, final android.webkit.JsResult result)
{
Log.d(LOGTAG, message);
new AlertDialog.Builder(view.getContext()).setMessage(message).setCancelable(true).show();
result.confirm();
return true;
}
});
webView.getSettings().setUserAgentString("Mozilla/5.0 (Windows; U; Windows NT 6.1; en-GB; rv:1.9.1.2) Gecko/20090729 Firefox/3.5.2 (.NET CLR 3.5.30729)");
This errors are logged by the device when the playback starts:
08-29 10:26:31.359: E/chromium(6191): [ERROR:gles2_cmd_decoder.cc(5942)] [.Compositor-Onscreen-0x1490ca0]GL ERROR :GL_INVALID_OPERATION : glUseProgram: program not linked
08-29 10:26:31.359: E/chromium(6191): [ERROR:gles2_cmd_decoder.cc(5718)] [.Compositor-Onscreen-0x1490ca0]GL ERROR :GL_INVALID_OPERATION : glUniformMatrix4fv: wrong uniform function for type
Thank you in advance.