Capturing image from webcam
I'm trying to capture images by using webcam in an applet. The applet makes use of JMF. But I managed to run applet without actually installing JMF. I kept a button in HTML webpage so that when开发者_如何学Go the button gets clicked, the applet should capture the image.
But for me it is giving a java.lang.RuntimeException: No permission to capture from applets
. How can this exception be resolved so an applet can capture image using webcam in HTML page?
In order to capture images in an applet, it is necessary:
- For you to digitally sign the code.
- For the user to click "OK" when prompted to run the signed code.
- If the functionality is being called from a button using JavaScript, wrap the Java code in one of the
AccessController.doPrivileged(PrivilegedAction)
variants. - AFAIR the installer for JMF does not have the 'allow capture from applets' checked by default. That needs to be reconfigured in the JMF options. I forget how.
Update
I dont want to give client package to extra overhead of the installation of JMF.
That is just silly.
- The components of the JMF must be available on the run-time class-path of the applet, for it to function. If they are downloaded by the JRE using the applet element (or whatever), then the user has incurred that 'overhead'.
- But perhaps you mean you don't want to make the end user run the installer that advises to 'reboot' at the end. In that case, you are missing my point while avoiding answering my question. That question, again, is "How did you get the DLL?".
Applets run with very limited permissions and that might be causing the issue.. Here is an old post which has information about signing an applet to get the necessary permissions..hope this helps
I think flash is a much better option. There are really easy solutions for that even using Javascript + Flash. Take a look at this: http://www.xarg.org/project/jquery-webcam-plugin/
This question asked Too many times in this forum.. Anyways..Here is the solution: Java swing Program to capture webcam images you have to modify it for applet which takes only 30 minutes
精彩评论