aspose file tools*
The moose likes Applets and the fly likes How can I run an applet for accessing the PC camera Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Applets
Bookmark "How can I run an applet for accessing the PC camera" Watch "How can I run an applet for accessing the PC camera" New topic
Author

How can I run an applet for accessing the PC camera

Daniel Georgescu
Greenhorn

Joined: Apr 30, 2011
Posts: 5

Hi,
I'm working on my master thesis. I have as subject -face recognition. The subjects should be identified in a webcam/PC camera, locally installed. I mean an USB camera. The application that I developed so far is a web application and I have all the necessary code accessing the camera in Swing, in a JFrame.
Even so I'm not able to port this code to a working applet inside my web app.
I've dug into this for few weeks. The best result I had was a blank applet frame.
The others reported different exceptions, either missing classes under JMF framework, or ( my best friend ) the applet class is not found.
The applet code I have is



and works fine if I run it in Eclipse ->Run as Java applet.

The question is:
Could you point me to a good tutorial or show me something working?
I'll really appreciate if you can give something for dummies or no-brain webcam Java applet programmer.
Thank you
Mavaj Sun Co
Greenhorn

Joined: Apr 18, 2012
Posts: 1
Hi ,

I saw your code and I have tried to run it , but I go the error



I am wondering if you could solve the problem and willing to share with me how did you solve it . I have kind of similar requirement for my application but I can not access to any webcam local ( USB webcam ) via applet , but swing version work fine .

Thanks
MavajSunCo
Tim Moores
Rancher

Joined: Sep 21, 2011
Posts: 2408
At the very least, the applet needs to be signed: http://www.coderanch.com/how-to/java/HowCanAnAppletReadFilesOnTheLocalFileSystem
Daniel Georgescu
Greenhorn

Joined: Apr 30, 2011
Posts: 5

I could solve it, doing undesired things. Not all are necessary. I don't know if here's allowed to cross post, but I posted on Oracle site, too. There is a long but detailed discussion. You will find every problem I met and how I solved it.
https://forums.oracle.com/forums/thread.jspa?threadID=2215540
I can say 3 things :
- basically it is a problem related to signing the applet
- begin with little steps : creating a file on your system, writing in that file, etc...
- keep an eye all the time in your Java Console in your browser.
Pat Farrell
Rancher

Joined: Aug 11, 2007
Posts: 4659
    
    5

Daniel Georgescu wrote:
- begin with little steps : creating a file on your system, writing in that file, etc...


As designed, applets can't access files on the browser's system. They are the wrong tool for what you are trying to do. With enough signature stuff, perhaps on some operating systems, with some browsers you can make it work. But it will always be against the spirit, since a camera is by definition a device that will vary wildly in capabilities. Its hard to write
device independent code when you start out having to deal with device specifics.

I would look for javascript libraries that can access the camera, and skip applets completely.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61433
    
  67

JavaScript has less access to the client system than applets do.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Pat Farrell
Rancher

Joined: Aug 11, 2007
Posts: 4659
    
    5

Bear Bibeault wrote:JavaScript has less access to the client system than applets do.


Didn't know that. Still, Applets seem to me to be a poor match to the OP's requirements.
 
 
subject: How can I run an applet for accessing the PC camera