xxxxxxxxxx
var capture;
function setup() {
createCanvas(windowWidth, windowHeight);
capture = createCapture(VIDEO); // opens up the camera
pixelDensity(1); // turns off oversampling ("retina display")
capture.size(1280, 720); // in pixels
capture.hide(); // telling the browser to hide the camera so we can draw it ourselves
}
function draw() {
background(0);
image(capture, 0, 0, width, height);
}