Estoy interesado en mostrar solamente el video de una url mediante webview
y me gustaria deshacerme de la página en blanco, que aparece al salir del video en fullscreen.
NO USO <iframe>
para mostrar el video. ¿hay alguna manera? Os dejo foto del problema
Gracias por adelantado.
A continuacion añado mi codigo:
WebViewActivity.java
private VideoEnabledWebView webView;
private VideoEnabledWebChromeClient webChromeClient;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_example);
Bundle b = getIntent().getExtras();
View nonVideoLayout = findViewById (R.id.nonVideoLayout);
ViewGroup videoLayout = (ViewGroup) findViewById (R.id.videoLayout);
View loadingView = getLayoutInflater().inflate(R.layout.view_loading_video, null);
webView = (VideoEnabledWebView) findViewById (R.id.webView);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
webView.getSettings().setMediaPlaybackRequiresUserGesture(false);
getWindow().setFlags(
WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
}
webChromeClient = new VideoEnabledWebChromeClient(nonVideoLayout, videoLayout, loadingView, webView)
{
@Override
public void onProgressChanged(WebView view, int progress)
{
// TODO
}
};
webChromeClient.setOnToggledFullscreen(new VideoEnabledWebChromeClient.ToggledFullscreenCallback() {
@Override
public void toggledFullscreen(boolean fullscreen) {
if (fullscreen) {
WindowManager.LayoutParams attrs = getWindow().getAttributes();
attrs.flags |= WindowManager.LayoutParams.FLAG_FULLSCREEN;
attrs.flags |= WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON;
getWindow().setAttributes(attrs);
if (Build.VERSION.SDK_INT >= 14) {
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
}
} else {
if (Build.VERSION.SDK_INT >= 14) {
getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_VISIBLE);
}
}
}
});
webView.setWebChromeClient(webChromeClient);
if (urlConElVideo != null) {
webView.loadUrl(urlConElVideo);}
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
if ((keyCode == KeyEvent.KEYCODE_BACK) && webView.canGoBack()) {
webView.goBack();
return true;
}
return super.onKeyDown(keyCode, event);
}