Android WebView and html5 vids - java

Please, is there any way to force WebView to play html5 embedded vids? I spent two days tempting it (from just enabling js and plugins with hardware acceleration to using html5webview class) and made video tag working, but embedding with iframe only shows me preview.
Any suggestions, please?

Does it play if you click on it manually? There are all sorts of things that may go wrong with HTML5 video on the internet, on Android you also have to take into account the various permissions.
Try this first:
Load the webpage in a browser - does it work?
Load the webpage in the browser on the device, does it work?
Load the webpage in the webview, does it play when you click on it?
There should be an auto play property on the webview, but I know that one IOS at least that one is ignore and the video won't play until you click it.

Related

React Native - Opening Android Image Gallery Directly

As the title states, I am wondering how to open the Android image gallery directly from my app. Every single package that is out there, including react-native-image-picker, react-native-image-crop-picker, and yes, even Expo's expo-image-picker all open the "Recents" area!
Opening the gallery MUST be possible, since apps like Whatsapp, Tinder, Facebook, etc. all have this functionality when choosing pictures.
Such a simple functionality - and yet after a month of on and off search I have come up with no solution. Can anybody provide me with a way to do this? Or guide me in the correct direction? At this point I am prepared to write native Android code or custom React Native to get this to work.
i found this library
react-native-multiple-image-picker
it will open camera roll not recent file

Opening a PDF in an Android WebView

I have an android app that includes a WebView. When a user clicks on a link to a pdf nothing happens in the app. After some research it seems that the WebView doesn't support showing PDF files out of the box.
I've looked at several solutions on SO and all of them seem to use deprecated code.
What is the best way to accomplish this? I would add that I am fine with another app opening the pdf (it doesn't have to display directly in my app).
Edit: Clarification
Due to security concerns, pointing our pdf url to docs.google.com is not allowed.
Unfortunately, Android doesn't support viewing PDFs in a WebView. But still, you can do it in some other way. Actually, you can use the Google Docs. We will be loading the PDF in the Google Docs.
Here is the Code Snippet which you can use to open the PDF-
String myPdfUrl = "http://example.com/awesome.pdf";
String url = "http://docs.google.com/gview?embedded=true&url=" + myPdfUrl;
webView.getSettings().setJavaScriptEnabled(true);
webView.loadUrl(url);
That's all. Your Pdf will be open in the Google Docs.

Android flash website in webview and back button force closes application

I am trying to make a little app that shows Timetable, but to make it easier I want to show flash website on fragment webview. How can I do this?
I have tried to enable plugin, but it doesn't enable flashplayer. What would be the best solution to show it in the webview or just in app?
In your Manifest file on application tag add this property
android:hardwareAccelerated="true"
If not working then try setting the below property to your webView.
mWebView.setLayerType(View.LAYER_TYPE_HARDWARE, null);
Note: The above fix does not work in all android phones.

Integrating flash player in JavaFX web browser

I created a web browser using WebView and WebEngine classes of JavaFX. It is working fine but not able to play videos. It is opening youtube.com but is not playing videos of youtube. It is asking to install Adobe flash player. Even after installing, the problem is same. Do I have to integrate some plug-in of Adobe Flash Player in my Java code. If yes, how? Or there is some other solution. Kindly help.
WebView in JavaFX 2.2 does not support plugin based content such as Flash content.
As alternatives, for launching YouTube video content from JavaFX you can use:
HostServices.showDocument go launch flash content in the default system web browser OR
YouTube's iframe embedding API in WebView rather than it's flash interface.
The YouTube iframe embedding API embeds html5 video content, rather than flash video content and html5 video content works in WebView.
For more info, see http://www.youtube.com/html5

Switching from WebView to other views in Android

I am developing a photo sharing app for Android. I have a web site that I want the Android to get WebViews for most of it, but I want the android to have a native home screen rather than the web site homescreen.
As of right now, I open a WebView for login (this is needed because i must login with twitter) but after that I want the android to go to its own native home screen rather that the web site home screen.
I have tried using the shouldOverrideUrl() method to no avail. Is it even possible to program and android app to switch from the WebView at a given url?
Just create a method to check for the URLs to catch. Then make it not call the URL and open the home screen.

Categories