Video auto play

I’m having trouble stopping autoplay.

	    video = createCapture(VIDEO, function( stream ) {
	    	console.info("video stream initialized");
	    	video.stop();
	    }); 
            video.autoplay( false )	;
	    video.size(canvasW, canvasH);
	    video.hide();

Initially I had autoplay method set to false. This added video element attributes
autoplay=“false”. However, it did not work.
I added video.stop() is called. But doesn’t work.

Can anyone tells me how to stop autoplaying?

Thanks

1 Like

you talk about the DOM element made by Processing p5

createCapture()

i think
-a- for the media there is a autoplay, but possibly not for the capture object
-b- also i doubt there is a .stop() / .play() for camera ( like we know for video )


if you just use the .hide(); it will not show up in HTML area,

and now try to do that what you want / enable disable show cam picture
from the p5.js side.

let capture;
let showcam = false;

function setup() {
  createCanvas(480, 480);
  capture = createCapture(VIDEO);
  capture.hide();
}

function draw() {
  background(200,200,0);
  if ( showcam ) image(capture, 0, 0);
}

function keyPressed () {
  showcam = ! showcam;
}