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
Related
I have a website which lists the links to videos. Clicking on these links will play video on browser.
Now, I am planning to develop an Android app for my website. The way I am going to do is just framing this website inside Android app.
Now, when I click on these links inside the Android app, the video is getting played as like it plays on the browser. But I need it in a way such that when a user clicks on these links the video should play automatically on full screen landscape mode.
What modification should be done in the coding to play this video on full screen upon clicking on the video link?
Thanks
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
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.
Is there a way to embed a YouTube video with JavaFX 2 without a WebView? And if using a WebView is the only viable option, how can I detect when a video started and ended?
Is there a way to embed a YouTube video with JavaFX 2 without a WebView?
Technically, probably yes, but legally no as that would require using a video player other than the YouTube video player, which would violate YouTube's current terms of service.
If instead, you embed a player in JavaFX using a WebView to display YouTube's HTML5 embedded player, then that is ok with the YouTube terms of service agreement.
how can I detect when a video started and ended?
Use the YouTube JavaScript API to monitor playback status.
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