This project is read-only.

Video capture device id is used by other application

Mar 23, 2009 at 10:24 PM
I am getting the error in the title when trying to set the Scene.ShowCameraImage value to true. I am not using the camera with any other application. Any idea what the problem might be? I am using the integrated webcam of my Dell Inspiron.
Thanks!
Coordinator
Mar 24, 2009 at 8:05 PM
If you only have one camera connected (in your case, it's the integrated webcam on your Dell computer), then ID 0 should be the device ID to use. The error message means that it can't access the web-camera for some reason. I wonder if it has anything to do with the audio device ID, but I accidentally left it as 0 (the 2nd parameter of InitVideoCapture method), but it should be set to -1. Please try -1 for the audio device ID and see if that works. We've tested with integrated webcams before and it worked fine. I can't think of any other problems.

Ohan
Mar 24, 2009 at 9:53 PM
Ohan, I tried changing the audio device, but the problem remains. What's interesting is that the first time I run the application after I start the computer it works fine, there's no error, but every time afterwards the error occurs, I don't know if you have an idea of what could caus this kind of behaviour. I am going to try using an external webcam to see if it solves the problem.
Coordinator
Mar 25, 2009 at 7:55 PM
Do you have any virtual camera installed on your machine? If you do, probably you want to uninstall all of your virtual cameras from the machine.

Ohan
Mar 9, 2010 at 6:45 PM

I´m having the same problem as him, but i didnt discovery any solution do fix it yet.

I need to change DirectShowCapture.cs codce?

Mar 9, 2010 at 7:53 PM

My camera (Logitech for Notebooks or something like that) comes with software that gets automatically launched when the camera is used by a program (this is the software that lets you change camera settings like exposure, focus, etc.).  When your GoblinXNA program launches for the first time, do you notice any other programs launch (either in the taskbar or in another window behind your active one)?  It may be the case that when your GoblinXNA program quits, the camera software does not quit properly and that's why when you launch your GoblinXNA program a second time, it complains that the camera is already being used by another program.

Mar 10, 2010 at 5:05 PM
Edited Mar 10, 2010 at 5:06 PM

I thought about it, but i closed all softwares that use the webcam, but didnt work´s.

Ahh I change some code, and sometimes function, but sometimes no.It alleatory....Hhahahaa. I really dont know how to solve this problem.

Mar 13, 2010 at 4:27 AM

Same problem here. I'm sure that my webcam isn't used by another application.

But if I start my XNA program a second time I get the same error.

Mar 13, 2010 at 8:02 PM

the 3.2 version works fine....its something that you changed in this new version...

Coordinator
Mar 15, 2010 at 5:52 AM

I think I answered this somewhere else, but don't remember where. If you got to DirectShowCapture.cs class, there is a FAILURE_THRESHOLD or something that is set to 100. If it can't acquire the video image for more than 100 frames, it'll think the webcam is accessed by another application. However, there are cases that it takes more than 100 frame time for the webcam to initialize, so if you change this to 1000, it should work. It'll be changed to 1000 from v3.4.

Ohan

Mar 17, 2010 at 4:36 AM

Now it works fine, thank you!