chuckfairy / node-webcam

Nodejs Cross Platform Webcam usage
MIT License
193 stars 51 forks source link

Fails with an error on Mac Catalina when run from VSCode #40

Open MayurRJoshi opened 4 years ago

MayurRJoshi commented 4 years ago

I was trying to use this module in my VSCode extension to capture an image using the webcam on Mac Catalina. But running,

const NodeWebcam = require('node-webcam')
NodeWebcam.capture('./a.jpg', {}, function( err, data ) {

  if ( !err ) console.log( "Image created!" );
  console.log(err)
 });

from inside the VSCode terminal fails with error, Error: Command failed: imagesnap -w 1 -q ./a.jpg.

Hence, running from within the extension fails too.

Running the same code from a terminal outside VSCode works. (After granting permission to the Terminal app in the popup)

So the issue seems to be that VSCode does not have permission to access Camera on Mac Catalina.

Is there anyway to get this working? Or open the typical permission popup to allow the user to grant permission to VSCode to access Camera?

chuckfairy commented 4 years ago

https://github.com/rharder/imagesnap/issues/27 I'm seeing other issues from the repo for Catalina and I also had some issues with imagesnap. It looks like there is a separate build till it's fixed on the main repo. I can check that and maybe we can include a post install for grabbing a binary similar to how windows works now.