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

Re: Syntax options for constraints structure

From: Paul Neave <paul.neave@gmail.com>
Date: Fri, 11 May 2012 14:47:48 +0100
To: Anant Narayanan <anant@mozilla.com>, Dan Burnett <dburnett@voxeo.com>, Harald Alvestrand <harald@alvestrand.no>
Cc: public-media-capture@w3.org
Message-ID: <3055B4EFB7C64C42B5673901AAC1CA30@gmail.com>
Thank you Anant. I was not aware of the requirement to specify optional parameters in order.

> 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
> },
> ]
> }
> });
> 

This approach seems much more sensible and is less verbose. Also in my opinion it makes more sense because the array is being used as an array should, not just as a placeholder to enforce order.

Dan and Harald, would this be an acceptable structure?

Paul.
Received on Friday, 11 May 2012 13:48:28 GMT

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