# createCapture() constraints and facingMode

**URL:** <https://discourse.processing.org/t/createcapture-constraints-and-facingmode/3960>\
**Category:** Coding Questions\
**Created:** [September 29, 2018, 8:28pm UTC](https://discourse.processing.org/t/createcapture-constraints-and-facingmode/3960 "2018-09-29T20:28:48Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![tony](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/tony/32/949_2.png) [@tony](https://discourse.processing.org/u/tony)\
**Post date:** [September 29, 2018, 8:28pm UTC](https://discourse.processing.org/t/createcapture-constraints-and-facingmode/3960/1 "2018-09-29T20:28:48Z")

</div>

Are there any resources out there that clearly list all the possible constraints you can apply to [createCapture()](https://p5js.org/reference/#/p5/createCapture)?

All they do is redirect you to this page:  
[https://w3c.github.io/mediacapture-main/getusermedia.html#media-track-constraints](https://w3c.github.io/mediacapture-main/getusermedia.html#media-track-constraints)  
and leave it at that.

Basically, I want to change the [facingMode](https://w3c.github.io/mediacapture-main/getusermedia.html#dom-videofacingmodeenum) so that I can use the `environment` camera and not the `user` camera, and as far as I can tell, I have to supply a `Constraints` object in order to do that.

I don’t know if this is necessarily a problem with the constraints, but the lack of clear examples is a little frustrating. This is the only snippet I have to go off of:

```auto
function setup() {
  createCanvas(480, 120);
  var constraints = {
    video: {
      mandatory: {
        minWidth: 1280,
        minHeight: 720
      },
      optional: [{ maxFrameRate: 10 }]
    },
    audio: true
  };
  createCapture(constraints, function(stream) {
    console.log(stream);
  });
}

```

Someone’s had this problem before, right?

**EDIT** :  
Found a solution here:

> <https://github.com/processing/p5.js/issues/1496#issuecomment-229953095>

But the original problem still remains. What does `exact` mean? Where do I find a general reference for Constraints?

---

<div class="post-metadata">

**Author:** ![jb4x](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/jb4x/32/789_2.png) [@jb4x](https://discourse.processing.org/u/jb4x)\
**Post date:** [September 30, 2018, 6:31am UTC](https://discourse.processing.org/t/createcapture-constraints-and-facingmode/3960/2 "2018-09-30T06:31:30Z")

</div>

Thanks for sharing the solution 🙂

---

<div class="post-metadata">

**Author:** ![jeremydouglass](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/jeremydouglass/32/20_2.png) [@jeremydouglass](https://discourse.processing.org/u/jeremydouglass)\
**Post date:** [October 1, 2018, 7:17pm UTC](https://discourse.processing.org/t/createcapture-constraints-and-facingmode/3960/3 "2018-10-01T19:17:20Z")

</div>

> [@tony](#):
>
> But the original problem still remains. What does `exact` mean? Where do I find a general reference for Constraints?

I think that is worth asking as a follow-on question on the issue that you linked, e.g. “what does `exact` mean and is it documented anywhere?”
