# Video auto play

**URL:** <https://discourse.processing.org/t/video-auto-play/17195>\
**Category:** Coding Questions\
**Created:** [January 20, 2020, 7:04am UTC](https://discourse.processing.org/t/video-auto-play/17195 "2020-01-20T07:04:03Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![airinterface](https://avatars.discourse-cdn.com/v4/letter/a/ea666f/32.png) [@airinterface](https://discourse.processing.org/u/airinterface)\
**Post date:** [January 20, 2020, 7:04am UTC](https://discourse.processing.org/t/video-auto-play/17195/1 "2020-01-20T07:04:03Z")

</div>

I’m having trouble stopping autoplay.

```auto
	    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

---

<div class="post-metadata">

**Author:** ![kll](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/kll/32/964_2.png) [@kll](https://discourse.processing.org/u/kll)\
**Post date:** [January 21, 2020, 4:24am UTC](https://discourse.processing.org/t/video-auto-play/17195/2 "2020-01-21T04:24:47Z")

</div>

you talk about the DOM element made by Processing p5

```auto
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.

```auto
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;
}

```
