3

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.

jsc
  • 168
  • 1
  • 8
  • If you really want to use the JW Player inside of a WebView, the better way to do this would be to use our SDK, which is still in beta. If you want to try it out, email sales jwplayer com. – emaxsaun Aug 29 '14 at 14:48
  • How will the sdk allow me to play the videos? I am provided with a page that should work across platforms. I receive the page's HTML and associated styles, scripts, videos, etc, which I host in a local server (so that the content might be available offline). Is there some kind of configuration that I might be missing? – jsc Aug 29 '14 at 14:55
  • I would not know. The player has never been tested inside of a WebView before, as it is really meant for mobile web only, not in app. The SDK is for building the player into native Android apps, though. – emaxsaun Aug 29 '14 at 16:50
  • Oh thanks, but what I need is the player to be inside the WebView, so that the content of the page can be shared by multiple platforms (i.e. iOS's webview) – jsc Aug 31 '14 at 22:18
  • We are going to be working on an iOS SDK as well. At this point, we have never tested the player with anything other than mobile web (and desktop browsers). – emaxsaun Sep 01 '14 at 02:07

0 Answers0