How to Integrate web-cam with a web page - java

I am developing a web application using Java (Servlet, JSP). In a JSP page, I want to show the web camera window to the user. When client clicks a button "Capture", then I should be able to capture the image and store it in some place.
I have done a lot of research, but could not find a satisfactory solution.

That's where the beauty of Applet comes in. Facebook has an Applet that connects to the PC camera and does capturing.

This site provides a good example in JSP:
http://thenerdinme.com/do-it-yourself/how-to-take-screenshots-with-java/

Why do not use something like flex which provides better support for this?

Related

Can WebView do like browser?

I have a question bothering me for these few days, I want to implement browser-like WebView, which has add/close tab and open multiple websites. But after I searched through many forums and documentation still couldn't find any solution for this, wondering can WebView do exactly what phone browser can do?
This is answered by the documentation.
Building web apps in WebView
If you want to deliver a web application (or just a web page) as a part of a client application, you can do it using WebView. The WebView class is an extension of Android's View class that allows you to display web pages as a part of your activity layout. It does not include any features of a fully developed web browser, such as navigation controls or an address bar. All that WebView does, by default, is show a web page.
So the answer to your question is No. The WebView class cannot do exactly what a phone browser can do.
This does not stop you from implementing missing browser features for yourself ... starting with WebView. However, the javadoc for WebView states this:
In most cases, we recommend using a standard web browser, like Chrome, to deliver content to the user. To learn more about web browsers, read the guide on invoking a browser with an intent.
And more ...

Transforming c2kschools.net into an App with Visual Studio

I wish to develop a mobile App that simply makes use of the C2K service for schools website. It has an initial ASPX login page and once logged in, it goes to a personal index.aspx homepage.
What would be the best way to go about this using Visual Studio? I have looked at Apache Cordova but I am not sure about it. Advice on which package to use and what approach I should take to transform this website into an App would be much appreciated.
Thanks in advance.
Ching
I think Cordova in Visual Studio should meet your requirement, you can simply create a blank project index.html and redirect this html to the, e.g. http://www.example.com/login.aspx
After compile, you can run your existing web inside the app.
However, the "LOOKING" of the web site will be changed, since the screen of the phone may be too small to display the content of the entire original web site, you may need to change the appearance of your original web site, otherwise the users may need to zoom-in zoom-out all the time when they browse the web site inside the phone app.

GWT application "invite friends from Facebook" dialog

I am creating an web application with java, GWT-Platform and GAE.
I succeeded to create a "log in with Facebook account" flow, and now i want to create on one of my presenters an "invite friends from Facebook" window that will look like this:
Requests Dialog (the forum didn't allowed me to attach an image :( )
I don't want to use any written library like "gwt-facebook", I want to use only Facebook Graph API.
Is there a way to do it with Java and GWT, and how?
Thanks in advance :)
I've not used GWT but I've worked on something similar. Can't you generate custom javascript on the page that gets generated and use the Facebook javascript SDK to do this?

Android app for a web application without an API

Is it possible to create an Android app for an existing web application which doesn't provide any API?
Webview just provides a crude view of the same web app in Android, but interface with webview looks crappy.
What you're asking is very possible. Just load up your URL in the webview and then redirect all clicks to go back to the same view. There you have an embedded website into an application.
What do you mean by interface for WebView looks crappy? You can make it look like anything native on the phone.
If you want your web page to have the look and feel of a native android app without creating the native app, you'll need to do so using javascript on your served page. Take a look at http://jquerymobile.com/ which seems to do a lot of the leg work. You can use that javascript and a little elbow grease to accomplish what you describe.

How to play a sound in a JSF web app?

Is it possible to play a sound (.wav or .mp3) in a client's browser using a JSF web app?
I have tried using javax.sound.sampled.SourceDataLine and it worked on Windows, but when I deploy the .war on a Linux host I get this exception:
"javax.sound.sampled.LineUnavailableException: Audio Device Unavailable"
Java code executes on the server to generate web pages that are displayed in the client's browser. If you have JSF web app code using the javax.sound.sampled.SourceDataLine class, the sound will play on the server (if this is even possible...), not in the client's browser.
To play a sound at the client, you'll either have to reference an audio file in the web page as Pascal Thivent has posted, or you'll have to play the sound through a Flash/Silverlight/Java Applet plugin referenced in the page.
Is it possible to play a sound (.wav or .mp3) in a client's browser using a JSF web app?
I should have mentioned that, but this has nothing to do with JSF or any other server-side technology. If you want to play a sound on the client-side, generate the appropriate client-side code, i.e. HTML here.
HTML 5 has an <audio> tag but, until it gets mainstream, see Playing Sounds on a Web Site and How To Play Sound (which does a good job at summarizing the solutions) to learn more on the <embed> tag and the <object> tag.
I have tried using javax.sound.sampled.SourceDataLine and it worked on Windows, but when I deploy the .war on a Linux host I get this exception: "javax.sound.sampled.LineUnavailableException: Audio Device Unavailable"
This exception literally means that the machine where the code runs doesn't have an audio device. I can imagine that it is very reasonable that webservers doesn't have any audio device, this namely doesn't make any sense.
As others have pointed out, you need to play sound at the client machine. You can find here a lot of background information and examples.
Not via JSF but you can use primefaces for an app like that http://www.primefaces.org/showcase/ui/media.jsf

Categories

Resources