xxxxxxxxxx
21
let capture;
function setup() {
createCanvas(500, 500);
capture = createCapture(VIDEO);
capture.hide();
}
function draw() {
//to draw the capture with our canvas aspect ratio, we could get a stretched feed
// image(capture, 0, 0, width, height);
//to ensure the aspect ratio of your capture is not affected:
let aspectRatio = capture.height / capture.width;
image(capture, 0, 0, width, width * aspectRatio);
// filter(INVERT);
}