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: Thu, 10 May 2012 19:31:43 +0100
To: Dan Burnett <dburnett@voxeo.com>
Cc: public-media-capture@w3.org
Message-ID: <E4E7B6162E394683B092FE865C5EAAC4@gmail.com>
Dan, 

Thanks for this. I have not been able to join the call, however I do have some concerns with this syntax that I hope you will consider.

Firstly, why are there so many arrays and objects created? And why is an array [] used at all? It's bizarre!

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"
  }


}

There's no need to wrap each and every attribute in its own object {} parentheses, and no need to use an array at all.

Also, videoEnumAutowhitebalance should be, in my opinion, camel case videoEnumAutoWhiteBalance and a boolean - true or false, not "on" or "off".


Example 2:

{ mandatory: {
    videoEnumProvide: true
  },
  optional: {
    audioEnumProvide: true


  }
}

Again, simpler.


Also, we could extend the current agreed syntax like so:

{ video: {}, audio: {} }

that way it still equates to true, which means current projects that use { video: true } will still work. Definitions for optional and mandatory could then be placed inside each object.

{ video: { mandatory: {} } }


I appreciate the work on this and would like to help, speaking as an experienced JavaScript developer.
Many thanks,
Paul.



On Wednesday, 9 May 2012 at 20:21, Dan Burnett wrote:

> Group,
> 
> At the last meeting I agreed to send an email showing different syntax options for the constraint structure.
> Here it is. I believe the two alternatives I show are at least close to the primary suggestions made on the call (and the list). Let's discuss this on today's call and see if we can come to some agreement.
> 
> -- dan
> 
> 
> ****************
> ** ORIGINAL **
> ****************
> First, here are the three original examples:
> 
> Example 1:
> 
> {mandatory:[{videoMinHeight:600}, {videoMaxBandwidth:500}],
> optional:[
> {videoMaxAspectratio:1.333333333333},
> {videoMinTimebetweenrefframes:20},
> {videoMinFramerate:30},
> {videoEnumAutowhitebalance:on}]}
> 
> This example requests a video stream with the properties shown. Note that if the browser can satisfy either a minimum time between reference frames of 20 or a minimum framerate of 30 but not both, then it will satisfy the former. Also, if the browser cannot, at the least, provide a video stream with a minimum height of 600 and a maximum bandwidth of 500, then the call to getUserMedia will fail.
> 
> 
> Example 2:
> 
> {mandatory:[{videoEnumProvide:true}],
> optional:[{audioEnumProvide:true}]}
> 
> This example requests both an audio and a video stream. If the browser cannot, at the least, provide a video stream, then the errorCallback will be called with an error.
> 
> 
> Example 3: 
> 
> {mandatory:[{videoEnumProvide:true}, {audioEnumProvide:true}]}
> 
> This example requires that the browser either return a stream with both audio and video or call the errorCallback with an error.
> 
> 
> 
> ***********************
> ** ALTERNATIVE 1 **
> ***********************
> 
> Example 1:
> {video:
> {mandatory:{minHeight:600, maxBandwidth:500},
> optional:[
> {maxAspectratio:1.333333333333},
> {minTimebetweenrefframes:20},
> {minFramerate:30},
> {enumAutowhitebalance:on}]}}
> 
> 
> 
> Example 2:
> 
> {video:true, audio:optional}
> 
> 
> 
> Example 3:
> 
> {video:true, audio:true}
> 
> 
> 
> 
> ***********************
> ** ALTERNATIVE 2 **
> ***********************
> 
> Example 1:
> 
> {mandatory:[{videoMinHeight:600}, {videoMaxBandwidth:500}],
> optional:[
> {videoMaxAspectratio:1.333333333333},
> {videoMinTimebetweenrefframes:20},
> {videoMinFramerate:30},
> {videoEnumAutowhitebalance:on}]}
> 
> 
> 
> Example 2:
> 
> {video:true,
> optional:[{audioEnumProvide:true}]}
> 
> 
> 
> Example 3:
> 
> {video:true, audio:true} 
Received on Thursday, 10 May 2012 18:32:18 GMT

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