let myVideo; let otherVideo; function setup() { createCanvas(windowHeight, windowWidth); let constraints = {audio: true, video: true}; myVideo = createCapture(constraints, function(stream) { let p5l = new p5LiveMedia(this, "CAPTURE", stream, "NYCAMST") p5l.on('stream', gotStream); } ); myVideo.elt.muted = true; myVideo.hide(); } function draw() { background(220); stroke(255); image(myVideo,0,0,width,height); if (otherVideo) { blend(otherVideo, 0, 0, otherVideo.width, otherVideo.height, 0, 0, width, height, MULTIPLY); } } // We got a new stream! function gotStream(stream, id) { // This is just like a video/stream from createCapture(VIDEO) otherVideo = stream; //otherVideo.id and id are the same and unique identifiers otherVideo.hide(); }