Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When refresh applet page webcam is not loading? #202

Closed
shamaks opened this issue Apr 7, 2014 · 3 comments
Closed

When refresh applet page webcam is not loading? #202

shamaks opened this issue Apr 7, 2014 · 3 comments
Labels

Comments

@shamaks
Copy link

shamaks commented Apr 7, 2014

Hi
i used webcam-capture jar in my applet code to capture photo. when i run my applet code on web at first time it works, if i click refresh the page will get refresh and again if i click capture photo it is not working. please help me regarding this. i'm waiting for u r replay.
the below are the list of webcam-capture jar i tried.

webcam-capture-0.3.10-RC6-dist.jar
webcam-capture-0.3.10-20140310.191743-24.jar
webcam-capture-0.3.10-RC6.jar

when i click refresh it throws below error.

basic: Removed progress listener: sun.plugin.util.ProgressMonitorAdapter@c115
basic: PluginMain.unregisterApplet: 9 from mananger sun.plugin2.applet.Applet2Manager@1a11f21
Exception in thread atomic-processor-1
Exception in thread webcam-updater-thread-1
java.lang.IllegalMonitorStateException
    at java.util.concurrent.locks.ReentrantLock$Sync.tryRelease(Unknown Source)
    at java.util.concurrent.locks.AbstractQueuedSynchronizer.release(Unknown Source)
    at java.util.concurrent.locks.ReentrantLock.unlock(Unknown Source)
    at java.util.concurrent.LinkedBlockingQueue.take(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor.getTask(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)
java.lang.IllegalMonitorStateException
    at java.util.concurrent.locks.ReentrantLock$Sync.tryRelease(Unknown Source)
    at java.util.concurrent.locks.AbstractQueuedSynchronizer.release(Unknown Source)
    at java.util.concurrent.locks.ReentrantLock.unlock(Unknown Source)
    at java.util.concurrent.LinkedBlockingQueue.take(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor.getTask(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)
@sarxos
Copy link
Owner

sarxos commented Apr 7, 2014

Hi @shamaks,

Handling webcam in applet is really tricky - I found that it behaves in a completely different way if you compare it with the classic or webstart app (different lifecycle vs dependency on natives and hardware, especially problematic on Windows).

The problem you are facing is caused by the fact that JVM is restarting the applet before the close operation is completed. I suppose that solution in your case is to add:

<param name="separate_jvm" value="true" />

In the applet HTML element (see here).

Here you can find the most recent code for the webcam capture applet:

https://github.com/sarxos/webcam-capture/tree/master/webcam-capture-examples/webcam-capture-applet

Please note that it is not a reference implementation and everyone are welcome to change it if bug is found or if some nice enhancement can be done.

@shamaks
Copy link
Author

shamaks commented Apr 10, 2014

Thanks, It's working now.

@sarxos
Copy link
Owner

sarxos commented Apr 10, 2014

Cool. I'm closing the ticket in such a case.

@sarxos sarxos closed this as completed Apr 10, 2014
@sarxos sarxos changed the title when refresh a page webcam is not loading ? When refresh applet page webcam is not loading? Apr 10, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants