W3C home > Mailing lists > Public > public-media-capture@w3.org > May 2012

Re: Syntax options for constraints structure

From: Anant Narayanan <anant@mozilla.com>
Date: Thu, 10 May 2012 12:17:49 -0700
Message-ID: <4FAC145D.6040600@mozilla.com>
To: public-media-capture@w3.org
On 5/10/12 11:31 AM, Paul Neave wrote:
> In my view, this could be much more simplified like so:
>
> Example 1:
>
> { mandatory: {
>      videoMinHeight:600,
>      videoMaxBandwidth:500
>    },
>    optional: {
>      videoMaxAspectratio: 1.333333333333,
>      videoMinTimebetweenrefframes: 20,
>      videoMinFramerate: 30,
>      videoEnumAutowhitebalance: "on"
>    }
> }

We could certainly make the optimization of grouping each "set" of 
constraints in one object instead of making a new object for each 
constraint, and I think Dan did have something like this in his original 
proposal in the form of a "Constraint Set", IIRC.

So, my preferred syntax is, as an example:

navigator.getUserMedia({
   video: {
     mandatory: {
       videoMinHeight:600,
       videoMaxBandwidth:500
     },
     optional: [
       {
         videoMaxAspectratio: 1.333333333333,
         videoMinTimebetweenrefframes: 20,
         videoMinFramerate: 30,
         videoEnumAutowhitebalance: "on"
       },
       {
         videoMinTimebetweenrefframes: 40,
         videoMinFramerate: 10
       },
     ]
   }
});

-Anant
Received on Thursday, 10 May 2012 19:18:17 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 16:14:59 GMT