W3C home > Mailing lists > Public > public-webrtc@w3.org > March 2012

Re: Constraints and Capabilities API for getUserMedia: more detailed proposal

From: Paul Neave <paul.neave@gmail.com>
Date: Tue, 20 Mar 2012 15:47:52 +0000
To: Dan Burnett <dburnett@voxeo.com>
Cc: public-webrtc@w3.org, public-media-capture@w3.org
Message-ID: <2A20E6B08D6843849CDBB2D790F05876@gmail.com>
This proposal seems good, except there is one issue. JavaScript cannot use hyphens in object names unless wrapped in quotes. So this example:

navigator.getUserMedia( { mandatory: [video-min-height: 600, video-max-bandwidth: 500], etc…} );

should really be:

navigator.getUserMedia( { mandatory: ['video-min-height': 600, 'video-max-bandwidth': 500], etc…} );

or better still using camel case:

navigator.getUserMedia( { mandatory: [videoMinHeight: 600, videoMaxBandwidth: 500], etc…} );


However, in my opinion, I feel as though the max/min requirements are still too verbose. Specifying the max and min should be an available option, but there should also be a more simpler API such as:

navigator.getUserMedia( { video: true, videoHeight: 600, videoBandwidth: 500, etc…} );

With defaults being assumed if not specified. In this case, a typical example would be:

navigator.getUserMedia( { video: true, audio: true, videoWidth: 800, videoHeight: 600, videoMaxBandwidth: 800, videoMinBandwidth: 400, videoFrameRate: 30 } );

Specifying a "min-framerate", for example, seems slightly odd. What if the browser is not capable of keeping up to the specified minimum frame rate? In that case, surely specifying the frame rate you want, videoFrameRate: 30 for example, would suffice and the browser attempts to reach this goal?

In my opinion the API should be as simple as possible, with an elegant way for the browser to assume defaults if not specified. Otherwise each getUserMedia request will be drowned in a specifications list for even the simplest of use cases.

Thanks,
Paul.
Received on Tuesday, 20 March 2012 15:48:30 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 20 March 2012 15:48:31 GMT