W3C home > Mailing lists > Public > public-media-capture@w3.org > April 2012

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

From: Li Li <Li.NJ.Li@huawei.com>
Date: Mon, 09 Apr 2012 16:22:13 +0000
To: Harald Alvestrand <harald@alvestrand.no>
Cc: Soo-Hyun Choi <s.choi@hackerslab.eu>, "public-media-capture@w3.org" <public-media-capture@w3.org>
Message-id: <B60F8F444AAC9C49A9EF0D12D05E09422167F434@szxeml535-mbs.china.huawei.com>
What if I want to use the video input on foo1 (a webcam with mic) and audio input on bar3 (a headset)?
If I say: 
navigator.getUserMedia({audio:true, video:true}, {mandatory: [{identity:foo1}, {identity:bar3}]}, cb), then the UA doesn't know where the audio stream comes from: foo1 or bar3.

It seems an object-oriented approach is needed for this case:
foo1.getUserMedia({video:true}, cb);
bar3.getUserMedia({audio:true}, cb);

So it becomes a two-step drill-down process:
1) navigator.getCapabilitie() gets a list of qualified logical devices with stream capabilities;
2) {device}.getUserMedia() gets a stream from the selected device with the requested capability;


-----Original Message-----
From: Harald Alvestrand [mailto:harald@alvestrand.no] 
Sent: Monday, April 09, 2012 9:51 AM
To: Li Li
Cc: Soo-Hyun Choi; public-media-capture@w3.org
Subject: Re: : Constraints and Capabilities API for getUserMedia: more detailed proposal

On 03/29/2012 03:55 AM, Li Li wrote:
> Thanks for bringing this up. I hope application should be able to discover cameras and select which ones to use, as it is not uncommon for mobile devices to have two cameras these days.
> If this ability is not supported, then there is also a gap between getCapabilities(), which return multiple cameras, and getUserMedia(), which can't select them.
If we define a constraint named "video-camera-identity", with a string
value, and define that getCapabilities() return a single, unique value
of "video-camera-identity" for each camera, the problem is solved:

getCapabilities() returns
[ camera1 {
'video-camera-identity': 'foo1'
camera2 {
'video-camera-identity': 'bar3'

getUserMedia gets called as

getUserMedia(....., [ mandatory: { 'video-camera-identity' : 'bar3' } ] )

apologies for the braces and brackets of the wrong type; I hope the idea
shines through.
One issue: this constraint is not an enum, a max or a min - it's a
fourth type of constraint.

Does this need further definition?

> Li
> -----ʼԭ-----
> : Soo-Hyun Choi [mailto:s.choi@hackerslab.eu] 
> ʱ: 2012329 8:28
> ռ: Li Li
> : public-media-capture@w3.org
> : Re: Constraints and Capabilities API for getUserMedia: more detailed proposal
> All,
> On Wed, Mar 28, 2012 at 11:32, Li Li <Li.NJ.Li@huawei.com> wrote:
>> If the getCapabilities() returns multiple devices (e.g. camera001,
>> camera002), I wonder how navigator.getUserMedia() is able to select which
>> device to use. Do we have to say: camera001.getUserMedia(), or somehow
>> designate the target device in the argument?
> As I've raised the similar issue earlier regarding this
> (http://lists.w3.org/Archives/Public/public-media-capture/2012Mar/0015.html),
> this sort of choosing multiple cameras should better to be considered.
> Best regards,
> Soo-Hyun

Received on Monday, 9 April 2012 16:23:00 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 21:24:35 UTC