[mediacapture-main] Unclear how to associate current active device with enumerated devices

jnoring has just created a new issue for 
https://github.com/w3c/mediacapture-main:

== Unclear how to associate current active device with enumerated 
devices ==
After calling getUserMedia and setting up a webrtc connection, we can 
fetch info about the local stream like so (assume localStream is a 
MediaStream object):

```
localStream.getTracks();
```

...this returns an array of MediaStreamTrack objects.  What is unclear
 to me is how to take the MediaStreamTrack objects, and reconcile that
 with ```navigator.mediaDevices.enumerateDevices```. assuming the 
browser sets the "label" attribute on both the MediaDeviceInfo object 
returned from enumerateDevices, as well as the "label" attribute on 
MediaStreamTrack, in theory it's possible to make an association.  I 
have no idea why a MediaStreamTrack wouldn't just HAVE a 
MediaDeviceInfo associated with it, or why the MediaStreamTrack ID 
wouldn't be some common key between the two objects, or any number of 
other methods that are significantly better than relying on label.

Currently Firefox doesn't set this label, so literally--unless I've 
missed something--there is no way to know what the current active 
camera/microphone is for a given MediaStream in Firefox.  As best I 
can tell this is also legitimate per the spec, since 
MediaStreamTrack's label attribute states ```User Agents may label 
audio and video sources```.

Two questions:

1. What am I doing wrong?  This feels ridiculously hard to implement 
in a way that doesn't suck.
2. From an API standpoint, having MediaDeviceInfo be completely 
separate from MediaStreamTrack makes for an API that is really, really
 cumbersome to implement.  Has anyone at the w3c tried to make a 
coherent cross-browser API (which, at this point, should be 
theoretically possible with both Chrome and Firefox) that A) allows 
device enumeration, B) allows device selection, C) can tell what the 
current active device(s) are and D) persists user-selected devices 
between runs of the page?

Please view or discuss this issue at 
https://github.com/w3c/mediacapture-main/issues/299 using your GitHub 
account

Received on Monday, 4 January 2016 22:11:41 UTC