# Running Camera with buttons in p5.js

**URL:** <https://discourse.processing.org/t/running-camera-with-buttons-in-p5-js/26281>\
**Category:** Coding Questions\
**Created:** [December 15, 2020, 9:15pm UTC](https://discourse.processing.org/t/running-camera-with-buttons-in-p5-js/26281 "2020-12-15T21:15:38Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![fullmotion](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/fullmotion/32/11300_2.png) [@fullmotion](https://discourse.processing.org/u/fullmotion)\
**Post date:** [December 15, 2020, 9:15pm UTC](https://discourse.processing.org/t/running-camera-with-buttons-in-p5-js/26281/1 "2020-12-15T21:15:38Z")

</div>

Hello, debugging the camera option in this sketch. 1) Why isn’t camera opening inside the canvas? 2) How can I make the buttons disappear when the camera opens on the canvas? [https://editor.p5js.org/fullmotion/sketches/Kh1YLSfWI](https://editor.p5js.org/fullmotion/sketches/Kh1YLSfWI)

---

<div class="post-metadata">

**Author:** ![josephh](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/josephh/32/210_2.png) [@josephh](https://discourse.processing.org/u/josephh)\
**Post date:** [December 15, 2020, 10:29pm UTC](https://discourse.processing.org/t/running-camera-with-buttons-in-p5-js/26281/2 "2020-12-15T22:29:00Z")

</div>

Hi,

Actually running your code gives me this error in the console :

```auto
ReferenceError: nameP is not defined (sketch: line 95)

```

But after commenting, there’s also other missing variable declarations. Is it intentional?

---

<div class="post-metadata">

**Author:** ![fullmotion](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/fullmotion/32/11300_2.png) [@fullmotion](https://discourse.processing.org/u/fullmotion)\
**Post date:** [December 16, 2020, 5:04am UTC](https://discourse.processing.org/t/running-camera-with-buttons-in-p5-js/26281/3 "2020-12-16T05:04:30Z")

</div>

Thanks for your reply. No, it’s not intentional, could you point out what I could enhance for it to work?  
Thanks!

---

<div class="post-metadata">

**Author:** ![josephh](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/josephh/32/210_2.png) [@josephh](https://discourse.processing.org/u/josephh)\
**Post date:** [December 16, 2020, 11:20am UTC](https://discourse.processing.org/t/running-camera-with-buttons-in-p5-js/26281/4 "2020-12-16T11:20:11Z")

</div>

Well the code doesn’t work because you have undefined variables. Either delete them or initialize them.

Did you write the code? Because otherwise you would have wrote the variable definition yourself 😉
