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

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:27 UTC