Re: getCapabilities() as both static and object method?

On 13/05/2014 3:41 AM, Harald Alvestrand wrote:
> On 05/12/2014 08:13 PM, cowwoc wrote:
>> Perhaps I misunderstood what you meant. My understanding was that you
>> wanted classes to have both a static and instance method. If so, I
>> would be -1 on that and would favor classes having either of the two
>> but never both at the same time. I don't see the need for classes to
>> have both and think that doing so would be confusing to developers.
> I still don't understand this part - what's so especially complex about
> having a method that is callable either on the class or on the instance?
>
> The need as identified  is to know what constraints are recognized by
> the platform before calling getUserMedia (that is, before we have any
> instances to call the function on).
> What would you suggest as an alternate approach for fulfilling that need?
> Alternatively, are you suggesting that you don't think that need should
> be fulfilled?

First of all, static getCapabilities() implies the device type is a 
singleton. I mean, if I invoke Microphone.getCapabilities() it seems to 
imply there can be at most one microphone. It would be confusing to get 
different results from an instance and static methods in this case.

Secondly, my impression (coming from Java) that if you invoke a foo() on 
an instance, and an instance method does not exist then the call will 
delegate to the static method foo(). Meaning, there is no need to define 
two kinds of methods: instance invocation will automatically fallback on 
static methods. Is this different from Javascript?

>
>> On a higher level, I'm in favor of allowing developers to enumerate
>> devices and their capabilities without prompting for user permission.
>> I view getUserMedia() as the act of "opening" the devices I am
>> interested in, which would prompt the user for permission.
> I suggested a separate permission-manipulation call a few cycles back,
> but that was rejected by the WG as "too complex", so all permission
> manipulation is done through getUserMedia.
>
> So stuff is either visible to the drive-by Web, or it's gated on
> getUserMedia calls.
>
> Perhaps it's time to revisit that decision?

Yes please. I am strongly in favor of an API to enumerate capabilities 
instead of the current declarative model.

Gili

Received on Wednesday, 14 May 2014 16:06:52 UTC