This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 22101 - Need a persistent means in JS to select specific camera (or microphone)
Summary: Need a persistent means in JS to select specific camera (or microphone)
Status: RESOLVED INVALID
Alias: None
Product: WebRTC Working Group
Classification: Unclassified
Component: Media Capture and Streams (show other bugs)
Version: unspecified
Hardware: PC All
: P2 normal
Target Milestone: ---
Assignee: public-media-capture@w3.org
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-05-21 01:16 UTC by Silvia Pfeiffer
Modified: 2013-05-22 07:17 UTC (History)
3 users (show)

See Also:


Attachments

Description Silvia Pfeiffer 2013-05-21 01:16:30 UTC
I have an application where I need three cameras as input. It is not a phone, but a desktop with multiple cameras. I have three video elements into which I add the video streams with gUM.

I would like it to be deterministic which camera is projected into which video element. Right now in Chrome I have to manually select the camera from the list of exposed cameras in settings (or the camera icon once the first camera is connected) to choose which camera the next video element will contain.

The current spec proposes to introduce a "facingMode" enum to pick between cameras. Unfortunately, that is of limited use to only mobile cameras. It won't help in my case. I would prefer if the means to pick cameras was based on a more generic means of identifying cameras.

Here's my proposal:
In the Chrome settings list, the cameras are identified by their name. I can imagine having a "cameraName" enum in the constraints. If there are multiple cameras with the same name, a number (such as "HD Pro Webcam C920 #1") should be added (that's how VLC does it). Similarly, one could think of a "microphoneName" constraint.
Comment 1 Travis Leithead [MSFT] 2013-05-21 18:10:46 UTC
Facing mode is not for camera identification/selection. It's more of a directionality indicator. What I presume you are looking for is the "sourceId" of the device.
Comment 2 Silvia Pfeiffer 2013-05-22 06:14:16 UTC
(In reply to comment #1)
> Facing mode is not for camera identification/selection. It's more of a
> directionality indicator.

OK, fair enough. My requirement still stands. I will rename the bug.

> What I presume you are looking for is the
> "sourceId" of the device.

No, the sourceId does not persist after reloading the page and can thus not be used in JavaScript. What I am looking for is a persistent way to identify cameras and a means to select these cameras in a gUM call through constraints.
Comment 3 Adam Bergkvist 2013-05-22 06:49:31 UTC
(In reply to comment #2)
> No, the sourceId does not persist after reloading the page and can thus not
> be used in JavaScript. What I am looking for is a persistent way to identify
> cameras and a means to select these cameras in a gUM call through
> constraints.

The sourceId does indeed remain the same after a page reload.

From the spec:
"sourceId of type DOMString
    The application-unique identifier for this source. The same identifier must be valid between sessions of this application, but must also be different for other applications. Some sort of GUID is recommended for the identifier. Returned for all types of sources (video, audio, etc.). "
Comment 4 Silvia Pfeiffer 2013-05-22 07:17:10 UTC
So what is currently implemented in Chrome as MediaStreamTrack.id and what you are referring to as MediaSourceStates.sourceId are different. I guess the examples in the spec make sense. So, this is about getting implementations. Thanks.