Embeded Video in html content does not play on WebView - java

I am working on app which contain inline image and embeded video in HTML content. video displayed but clicking on play button video wont play. I have used following code of loading html content on webview.
WebSettings mainViewsettings = witContentWebView.getSettings();
mainViewsettings.setJavaScriptEnabled(true);
mainViewsettings.setAllowFileAccess(true);
mainViewsettings.setLayoutAlgorithm(WebSettings.LayoutAlgorithm.NARROW_COLUMNS);
mainViewsettings.setLoadWithOverviewMode(true);
mainViewsettings.setBuiltInZoomControls(true);
mainViewsettings.setDomStorageEnabled(true);
witContentWebView.setWebChromeClient(new WebChromeClient()
{
});
witContentWebView.loadDataWithBaseURL("", witsContentStr,"text/html", "UTF-8", "");
I have also set android:hardwareAccelerated="true" in manifest file, but I did not get any success. Could you guys help me solveout in this.

Maybe problem in is codec? Just open a browser? You use Chromium Web View or old Web View? (Android version)

Answer shamelessly copied from https://stackoverflow.com/a/3520920/1602333.
I am not sure if this is what you need. Anyway I hope the following be useful.
You can use the iframe method that youtube provides to play its videos. If the browser supports html5 will show the video with it, otherwise with flash.
You can use the following code as an example <iframe class="youtube-player" type="text/html" width="640" height="385" src="http://www.youtube.com/embed/bIPcobKMB94" frameborder="0">
in the above example the video id is bIPcobKMB94. You can change this id and show your video.
You can access a live example of it here
More infromation for youtube iframe
YouTube HTML5 Video Player

Related

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.

How to render an HTML web page in video on android?

I am working on an idea where I need to render an HTML5 web page in video on android. Actually it works this way that a video is being displayed on the screen of the TV and I want to render a web page on that video So far my research shows that this is called as video overlay or composite which can be found here Link. My question is how can I acheive this in Android??
Or in other words I would say how can I achieve video overlay in android. Is there any API for that ??
Any suggestion to achieve this will be really appreciated.
Thanks in advance

Android WebView and html5 vids

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.

Java plugin in a Flex HTML component

Anyone have an idea how to access through HTML component a page that requires Java plugin? I am using this new samsung android camera and I would like to open the link where the camera is streaming the video in a html component. If I make a browser like the one in tour de flex using the html component, it opens the page where the video should be seen. But then how do I access the Java plugin to play it.
Thanks,
David

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

Categories