Re: [Bug 23933] Proposal: Change constraints to use WebIDL dictionaries

On 06/12/2013 2:40 PM, Jan-Ivar Bruaroey wrote:
> The lesson is that people don't think twice about using mandatory, 
> probably because constraints are too complicated. They test until it 
> works, and expect browsers to "do the right thing" from there. You and 
> I disagree about what "the right thing" is for unknowns. I argue the 
> current default, while logically sound, is too harsh, and 
> un-webAPI-like. I further argue that only webdevs like you who care 
> about unknowns, will call getKnownConstraints(), and even then 
> probably only if you have a strong incentive to (you dislike the 
> default). Defaults for dummies.
>
> Since you asked, let me try to imagine another example:
>
>   * Someone adds an "auto-night-detection" constraint to IANA (or
>     wherever), and Chrome Canary implements it.
>   * Sometime later (I'm not saying when) someone adds { mandatory: {
>     auto-night-detection: true } } to their existing app (I'm not
>     talking about people who add optional).
>
> Question 1: when is this ok to do?
>
>   * Now their app stops working on anything but Chrome Canary. How is
>     this useful?
>   * Say for argument's sake that 50% of web-cams out there already
>     have auto-night-detection built in as an inherent property that
>     doesn't even need to be turned on.
>   * Now the UA is blocking 49% of legitimate users at nighttime, and
>     everyone during daytime (user can't tell the difference).
>

Which gets back to my point that mandatory constrains are stupid. 
Look... either mandatory really means mandatory or it doesn't. When a 
developer lists auto-night-detection under mandatory constraints it 
means they *absolutely* need it. By changing the default, you're saying 
mandatory means: *absolutely* need it, unless it's unknown. That's not 
mandatory :)

Let's just cut the BS and replace mandatory constraints with optional 
priority-ordered constrains and be done with it. This will yield the 
behavior you're asking for.

> I don't want the UA to do that. You, the app can do that.
>
> As I've stated before, this only applies to inherent properties, since 
> the minute you try to control a camera, you learn from 
> getCapabilities() if it's not supported.

I get the feeling that we're saying the same thing. Here is what I have 
in mind, let me know where our views diverge. I think apps should do this:

var devices = getDevices(); // User gets prompted
var device;
var capabilities;
for (var i = 0; i < devices.length; ++i)
{
   var d = devices[i];
   var c = device.capabilities;
   if (c.width > 800 && c.height > 600)
   {
     device = d;
     capabilities = c;
     break;
   }
});
if (device)
   getUserMedia(device, capabilities, onSuccess, onFailure); // User 
gets prompted

Gili

Received on Friday, 6 December 2013 20:00:16 UTC