How to get Cocoa to detect USB webcam device

777 views Asked by At

Cannot access webcam from browser

My aim is to access a USB webcam (video / camera) device from any web browsers on OS X. Using Flash, I cannot see the USB webcam that is plugged in, switched on and active.

Adobe Flash select webcam

Similarly, I cannot detect the webcam video source using HTML5 getUserMedia() https://www.webrtc-experiment.com/DetectRTC/. Though the Audio stream from the USB device is listed

HTML5 getUserMedia

ImageSnap (Cocoa)

To verify if the USB device is in fact accessible in OSX, I use the open source tool ImageSnap .

$ imagesnap -l
Video Devices:
FaceTime HD Camera (Built-in)

Only the built-in iSight camera is detected, not the attached USB camera.

ImageSnap uses the Cocoa framework.

wacaw (Carbon)

Next, using wacaw, I can list out the attached USB camera, and even correctly take snapshots.

$ wacaw -L
DVFreeThread - CFMachPortCreateWithPort hack = 0x116970, fPowerNotifyPort= 0x1158d0
There are 5 devices in the list.
The current selection is 0.
 0 - AVer Virtual Camera [is available] [has inputs]
    There are 1 inputs for this device (0).
    The current selection is 0.
   0 - AVer Virtual Camera [is available]
 1 - DV Video [is available] [has no inputs]
 2 - IIDC FireWire Video [is available] [has no inputs]
 3 - USB Video Camera for AverVision Digital Presenter 2 [is available] [has no inputs]
 4 - USB Video Class Video [is available] [has inputs]
    There are 1 inputs for this device (4).
    The current selection is 0.
   0 - FaceTime HD Camera (Built-in) [is available]

wacaw uses Carbon framework.

Problem

How can I make the USB camera accessible via Cocoa, which will also make it accessible through web browsers?

1

There are 1 answers

0
supc On

Obviously that camera needs a driver to make it work. Apps on Mac are running in 64-bit nowadays, and the carbon driver (should be implemented with sequence grabber framework) is 32-bit only. It might work if the camera producer offers driver written with cocoa, or just use a UVC camera instead.