W3C home > Mailing lists > Public > public-webrtc@w3.org > October 2011

PARTIALLY ACCEPTED: Re: CHANGE: Use a JS Object as an argument to getUserMedia

From: Harald Alvestrand <harald@alvestrand.no>
Date: Wed, 12 Oct 2011 18:21:27 +0200
Message-ID: <4E95BE87.3040400@alvestrand.no>
To: Anant Narayanan <anant@mozilla.com>
CC: public-webrtc@w3.org
I think the result of discussion on this topic is:

- The use of an object rather than a string as the first argument to 
getUserMedia  is ACCEPTED. The editors should come up with a proposal 
for how this spec should look.
- Removing the callback arguments and making getUserMedia return a 
stream is CONTROVERSIAL. We don't have a clear consensus on the list. 
The chairs will attempt to figure out where consensus may lie; the 
editors shouldn't change this until further notice.

On 10/03/11 21:39, Anant Narayanan wrote:
> What
> --
> I'd like to propose that we use a JS Object instead of a string as the *only* argument to getUserMedia().
>
> Why
> --
> We're just now beginning with the implementation of the specification in Firefox and we'd rather not write a new string parser :) Parsing strings can be error prone, whereas JavaScript objects offer the same extensibility as strings (and can be stringified into JSON if required). Additionally, coming up with a new string format is extra work and will end up  very close to a structured object model anyway.
>
> In order to avoid developers from providing empty objects in case they want default behavior, it is also necessary to eliminate any other arguments to getUserMedia. This change  will also align getUserMedia to behave closer to other web APIs, where changes to state are notified either via event listeners or callbacks that have been explicitly assigned.
>
> How
> --
> It is proposed that getUserMedia takes only a single argument, a JavaScript object. To begin with, only two properties will be specified to be interpreted by the User-Agent:
>
> {
>    audio: true,
>    video: true
> }
>
> Both audio and video default to true, thus this call:
>
> var stream = navigator.media.getUserMedia();
>
> will return a MediaStream object that records both video and audio. Since getUserMedia() only takes 1 argument, the developer has to attach an event listener or callback:
>
> stream.onReadyStateChange = function() {} // Like XHR
>
> or
>
> stream.addEventListener("<event-name>", function() {}); // Event listener
>
>
> Would love to hear what everyone thinks.
>
> Regards,
> -Anant
>
>
>
Received on Wednesday, 12 October 2011 16:21:55 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Wednesday, 12 October 2011 16:21:56 GMT