Java Access to the Webcam when another program use the webcam

280 views Asked by At

I need to create a program who can use webcam in same time of another program. So i use Sarxos Webcam-capture.

I try to play with the lock like this :

webcam.getLock().unlock();

Or

webcam.getLock().disable();

But my program or the other program lost the webcam or simply crash.

StackTrace of crash :

com.github.sarxos.webcam.WebcamException: Cannot execute task at com.github.sarxos.webcam.WebcamProcessor$AtomicProcessor.process(WebcamProcessor.java:72) at com.github.sarxos.webcam.WebcamProcessor.process(WebcamProcessor.java:140) at com.github.sarxos.webcam.WebcamTask.process(WebcamTask.java:46) at com.github.sarxos.webcam.ds.cgt.WebcamOpenTask.open(WebcamOpenTask.java:20) at com.github.sarxos.webcam.Webcam.open(Webcam.java:271) at webcam.webcam.MyRunnable.run(DetectMotion.java:70) at java.lang.Thread.run(Thread.java:745) Caused by: com.github.sarxos.webcam.WebcamException: Cannot start native grabber! at com.github.sarxos.webcam.ds.buildin.WebcamDefaultDevice.open(WebcamDefaultDevice.java:330) at com.github.sarxos.webcam.ds.cgt.WebcamOpenTask.handle(WebcamOpenTask.java:38) at com.github.sarxos.webcam.WebcamProcessor$AtomicProcessor.run(WebcamProcessor.java:81) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) ... 1 more

Anyone have an idea ?

0

There are 0 answers