In p5js editor, I wanted to test the example called “capture” to turn on my webcam on my mac pro. The code must be correct since I used the example that already existed, but the camera is not turning on and I do not know why. It works in the web editor in p5.js, but not on the editor on my computer.
the console says,
{
“constraintName”: “”,
“message”: “”,
“name”: “InvalidStateError”
}
let capture;
function setup() {
createCanvas(390, 240);
capture = createCapture(VIDEO);
capture.size(320, 240);
//capture.hide();
}
function draw() {
background(255);
image(capture, 0, 0, 320, 240);
filter(INVERT);
}