
JWPlayer and fullscreen in Android Webview?
Hi, I'm trying out JWPlayer in webviews in android and while it works almost perfectly (poster loads, video plays, tracking works), for some reason fullscreen mode isn't working. The fullscreen button in the JWP controls doesn't do anything (and it feels as it it takes a couple of touches before it actually gets "pressed") - and I get nothing to console and nothing in LogCat. It just.. doesn't work, and I can't really find any info on why. I have tried this on both android 4.4x and 4.3, with the same result. 4.3 uses Chrome 24 internally, and 4.4 uses Chrome 30 (iirc). I've also tried this with both a cloudhosted and selfhosted JWP 6.8.4616.
Here's the simple HTML:
bc.. <html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>HTML5 Player Framework - Declarative Usage Example</title>
<script type="text/javascript" src="http://<url redacted>/jwplayer.js"></script>
<script type="text/javascript">jwplayer.key="<key redacted>";</script>
</head>
<body>
<h1>HTML5 Player Framework</h1>
<h2>Declarative Usage Example</h2>
<div id="myElement">Loading the player ...</div>
<script type="text/javascript">
jwplayer("myElement").setup({
file: "https://<url redacted>",
height: 360,
image: "https://<url redacted>",
width: 640
});
jwplayer().setFullscreen(true);
</script>
</body>
</html>
And the relevant android code:
bc.. MainActivity.java:
package com.semcon.android.jwvideotest;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.os.Bundle;
import android.webkit.WebChromeClient;
import android.webkit.WebSettings;
import android.webkit.WebSettings.PluginState;
import android.webkit.WebView;
import android.webkit.WebViewClient;
public class MainActivity extends Activity {
@SuppressLint({ "SetJavaScriptEnabled", "NewApi" })
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
WebView mWebView = (WebView) findViewById(R.id.webview);
mWebView.setWebChromeClient(new WebChromeClient());
mWebView.setWebViewClient(new WebViewClient());
mWebView.setWebViewClient(new WebViewClient());
mWebView.getSettings().setJavaScriptEnabled(true);
mWebView.getSettings().setDomStorageEnabled(true);
mWebView.getSettings().setLoadWithOverviewMode(true);
mWebView.getSettings().setUseWideViewPort(true);
mWebView.getSettings().setJavaScriptCanOpenWindowsAutomatically(true);
mWebView.getSettings().setAllowFileAccessFromFileURLs(true);
mWebView.getSettings().setAllowUniversalAccessFromFileURLs(true);
mWebView.getSettings().setLoadsImagesAutomatically(true);
mWebView.getSettings().setPluginState(PluginState.ON);
mWebView.loadUrl("file:///android_asset/index.html");
}
}
Any clues?