How Firefox implements optional constraints

>From 
http://mxr.mozilla.org/mozilla-central/source/dom/media/MediaManager.cpp#750

   // Then apply optional constraints.
   //
   // These are only effective when there are multiple sources to pick from.
   // Spec as-of-this-writing says to run algorithm on "all possible tracks
   // of media type T that the browser COULD RETURN" (emphasis added).
   //
   // We think users ultimately control which devices we could return, 
so after
   // determining the webpage's preferred list, we add the remaining choices
   // to the tail, reasoning that they would all have passed individually,
   // i.e. if the user had any one of them as their sole device (enabled).
   //
   // This avoids users having to unplug/disable devices should a 
webpage pick
   // the wrong one (UX-fail). Webpage-preferred devices will be listed 
first.


Clarification: The first device in the returned list becomes the default 
choice, so the webapp gets what it wants, as before, unless the user 
*explicitly* overrides the default with another device that the app has 
disclosed it also works with (a want not a need).

Another way to express this is as a fairness problem in the reductive 
optional algorithm: the fewer devices users disclose, the more choices 
they get. We should remove impediments to users disclosing all their 
devices to the browser.

I'd like to propose that this behavior be made explicit in the spec, 
rather than left to be inferred by implementations.

.: Jan-Ivar :.

Received on Thursday, 14 November 2013 21:31:55 UTC