WebView wvVideo = (WebView) findViewById(R.id.wvVideo);
String ytVideo= "<html><body><iframe width='350' height='160' src='www.youtube.com/watch?v=yqNGzYsPN6M' frameborder='0' allowfullscreen></iframe></body></html>";
wvVideo.getSettings().setPluginsEnabled(true);
wvVideo.getSettings().setAllowFileAccess(true);
wvVideo.getSettings().setPluginState(PluginState.ON);
wvVideo.getSettings().setBuiltInZoomControls(true);
wvVideo.getSettings().setJavaScriptEnabled(true);
wvVideo.loadData(ytVideo, "text/html", "utf-8");
It just display thumbnail and when i click on that, its not playing. just display black screen. my API Target is 15 and i set all the required permissions for that but still not working.
Your settings seems fine.
As for me the following settings did the job on my project which play HTML5 videos. Try them
webview.getSettings().setJavaScriptEnabled(true);
webview.getSettings().setDomStorageEnabled(true); // I think you will need this one
webview.getSettings().setPluginState(PluginState.ON);
webview.getSettings().setCacheMode(WebSettings.LOAD_NO_CACHE);// no need I think
webview.getSettings().setLoadWithOverviewMode(true);
webview.getSettings().setUseWideViewPort(true);
webview.getSettings().setBuiltInZoomControls(true);
webview.setInitialScale(1);
webview.setWebChromeClient(new WebChromeClient()); // dont forget this one
Add android:hardwareAccelerated="true" to your manifest file.
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme"
android:hardwareAccelerated="true">
Related
My client website http://partidos.online has some embedded videos in his website which are shared from google drive but these videos are not playing in my webview. Hre is the URL for video http://partidos.online/video/47. I want to play this Inline video in this webview.
this is my Manifest file:
<uses-permission android:name="android.permission.INTERNET" />
<application
android:hardwareAccelerated="true"
android:icon="#drawable/logo1"
android:theme="#style/AppTheme">
....
....
</application>
this my MainActivity.java
webView = (WebView) findViewById(R.id.webviewMain);
webView.getSettings().setMediaPlaybackRequiresUserGesture(true);
webView.getSettings().setJavaScriptEnabled(true);
webView.getSettings().setDomStorageEnabled(true);
webView.getSettings().setPluginState (PluginState.ON);
webView.getSettings().setAppCacheEnabled(true);
webView.getSettings().setAppCachePath(getApplicationContext().getFilesDir().getAbsolutePath() + "/cache");
webView.getSettings().setDatabaseEnabled(true);
webView.getSettings().setDatabasePath(getApplicationContext().getFilesDir().getAbsolutePath() + "/databases");
webView.loadUrl(URL);
webView.setWebViewClient(new WebViewClient();
webView.setWebChromeClient(new WebChromeClient(){});
You cannot play videos by WebView from your Google Drive. I suggest creating new YouTube channel and upload that video there. Then set the URL accordingly to URL of your video on YT.
I am trying to open
http://admin.aquateams.com
in android webview but it's showing white screen.
Do I need any polyfill for this ??
Here is webview code for android:
webView.getSettings().setJavaScriptEnabled(true);
webView.getSettings().setLoadWithOverviewMode(true);
webView.getSettings().setUseWideViewPort(true);
webView.setScrollBarStyle(WebView.SCROLLBARS_OUTSIDE_OVERLAY);
webView.setScrollbarFadingEnabled(false);
webView.getSettings().setBuiltInZoomControls(true);
webView.loadUrl(String.valueOf("http://admin.aquateams.com")));
var myWebView = page.getViewById("my-web-view");
myWebView.android.getSettings().setJavaScriptEnabled(true);
myWebView.android.getSettings().setAppCacheEnabled(true);
myWebView.android.getSettings().setDomStorageEnabled(true);
My webpage works fine on Google Chrome on my Android phone, but it does not display well when I load it inside a WebView.
My WebView settings as follows:
webview.getSettings().setJavaScriptEnabled(true);
webview.getSettings().setDomStorageEnabled(true);
webview.getSettings().setDatabaseEnabled(true);
webview.getSettings().setAppCacheEnabled(true);
webview.getSettings().setUseWideViewPort(true);
webview.getSettings().setLoadWithOverviewMode(true);
webview.getSettings().setLayoutAlgorithm(WebSettings.LayoutAlgorithm.NORMAL);
What could be the problem?
Try this before the settings but after you put in the URL
nameOfWebView.setDrawingCacheEnabled(true);
nameOfWebView.buildDrawingCache();
webview.setLayerType(WebView.LAYER_TYPE_SOFTWARE, null);
I have a html document, I've already tested on the html editor online website (http://htmledit.squarefree.com), it worked fine. However, WebView on android don't show this document, it only show text plain. I have very little experience with html, can anyone help me?
Make sure that your AndroidManifest.xml file includes
<uses-permission android:name="android.permission.INTERNET"/>
just after the
<uses-sdk />
tag. Without this, your app won't be able to access the Internet and therefore webview won't load anything.
HTH
Try -
WebView myWebView = (WebView) findViewById(R.id.webview1);
WebSettings webSettings = myWebView.getSettings();
webSettings.setJavaScriptEnabled(true);
This will enable javascript
I am building an App with api level 11. this is my Java Code
myWebView = (WebView) findViewById(R.id.webSitioPublico);
final ProgressBar Pbar;
Pbar = (ProgressBar) findViewById(R.id.progresoSitioPublico);
WebSettings webSettings = myWebView.getSettings();
webSettings.setPluginState(PluginState.ON);
webSettings.setPluginsEnabled(true);
webSettings.setAllowFileAccess(true);
webSettings.setJavaScriptEnabled(true);
setExplorer(url);
My SWF is on my own external server
with just
<object width="215" height="140">
<param name="movie" value="http://192.168.0.198:5771/es/games/paint.swf">
<embed src="http://192.168.0.198:5771/es/games/paint.swf"
width="215" height="140">
</embed>
</object>
I am testing on a Nexus 7 4.2.2 api level 17, but building this app for api level 11.
Nothing appears on screen just a box with question marks on the place where SWF should be.
my manifest
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme"
android:name="Rafael"
android:hardwareAccelerated = "true">
<activity
android:name="Principal"
android:label="#string/app_name"
android:theme="#style/AppTheme"
android:screenOrientation="portrait"
android:hardwareAccelerated = "true"
>
</activity>
<service android:name="ScannerService" ></service>
</application>
But you can still download apk from adobe
http://helpx.adobe.com/fr/flash-player/kb/archived-flash-player-versions.html
it will work in firefox mobile, the default browser (but not chrome mobile)
i have done it and it work on my galaxy nexus with android 4.2.2 :)
I guess it isen't possible anymore.
SWF require Adobe flash who has been deleted from Android
Adobe Removing Flash for Android From Google Play
use it myWebView.load(url) instead of setExplorer(url);