开发者

How to access webcams with JMF?

I would like to access my webcam with JMF, create a snapshot, and email it. I have working email code, but every time I try:

CaptureDeviceInfo inf = CaptureDeviceManager.getDevice("vfw:Microsoft W开发者_运维问答DM Image Capture(Win32):0");
        player = Manager.createRealizedPlayer(inf.getLocator());

But I get a nullpointexception error. How to fix it?


This is because your code is not detecting the webcam

you must copy the jmf.properties file to the same directory as your executable jar

you will find the jmf.properties file int the lib folder of your jmf installation.

For me it was C:\Program Files\JMF2.1.1e\lib\jmf.properties


the device name is "Microsoft WDM Image Capture", what you pass to CaptureDeviceManager.getDevice(). the "vfw://0" part is the locator.

see Owen McGovern's example: http://geoffair.net/java/java_sun1.htm. It has working player and working snapshot code.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜