问题
I am using JMF to operate my web cam.My usb webcam works perfectly with JMF, I used it in JMStudio however,when I make this call from my java code
deviceListVector = CaptureDeviceManager.getDeviceList( null );
my USB "webcam" is detected however when i am trying to detect webcam on my laptop it is not detecting any device.
How can I properly detect the webcam of laptop, and its formats, from JMF API?
回答1:
- Make sure that the system you're using it on contains all the required files eg On Windows it requires certain dlls. The easiest way to do this is to use the setup program.
- Once JMF is properly installed run JMFRegistry?, detect the camera, then register and/or save the results. (In vista you'll need to run it as Administrator for it work)
- The code should now be returning the list of devices. Assuming the code has jmf.jar added to its project files.
You might be interested in alternatives: http://en.wikipedia.org/wiki/Java_Media_Framework#Alternatives The FMJ project is one that is designed to be API compatible(not everything is implemented yet) and does dynamic device detection.
回答2:
Be sure to include jmf.jar & sound.jar in your project classpath. Although I had it in my CLASSPATH, it didn't work until I included those files in my project libraries.
来源:https://stackoverflow.com/questions/2570944/unable-to-detect-capture-device-webcam-through-jmf