I want to embed the following video into an Android web view: https://www.espn.com.ar/core/video/iframe?id=6034792&endcard=false&omniReportSuite=wdgespg
I have tried different methods of the web view but without any results. No errors, I can view the player only but it doesn't play.
//MANIFEST:
<uses-permission android:name="android.permission.INTERNET" />
<application
...
android:hardwareAccelerated="true">
//CODE:
String html = String.format("<iframe src=\"%s\" width=\"340\" height=\"313\" style=\"border:none;overflow:hidden\" scrolling=\"no\" frameborder=\"0\" allowTransparency=\"true\"></iframe>", url.getSrc());
wview.loadDataWithBaseURL("https://www.espn.com.ar", html, "text/html", "UTF-8", null);
//OR
wview.loadUrl(url.getSrc());
//MY WEBVIEW:
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:wheel="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentTop="true">
<WebView
android:id="@+id/wview"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
</LinearLayout>
</RelativeLayout>
Please check below code it is working fine with me, on manifest add android:hardwareAccelerated="true"
WebView webview = findViewById(R.id.myweb);
webview.setWebChromeClient(new WebChromeClient());
webview.getSettings().setLoadsImagesAutomatically(true);
webview.getSettings().setJavaScriptEnabled(true);
webview.getSettings().setAllowFileAccess(true);
webview.setScrollBarStyle(View.SCROLLBARS_INSIDE_OVERLAY);
webview.getSettings().setJavaScriptCanOpenWindowsAutomatically(true);
webview.getSettings().setPluginState(WebSettings.PluginState.ON);
webview.getSettings().setMediaPlaybackRequiresUserGesture(false);
webview.getSettings().setDomStorageEnabled(true);
webview.getSettings().setAppCacheMaxSize(1024 * 8);
webview.getSettings().setRenderPriority(WebSettings.RenderPriority.HIGH);
webview.getSettings().setCacheMode(WebSettings.LOAD_NO_CACHE);
webview.requestFocus(View.FOCUS_DOWN);
webview.getSettings().setAppCacheEnabled(true);
webview.loadUrl("https://www.espn.com.ar");