I am working on a tool that optionally uses multiple cameras and microphones via getUserMedia
and MediaStreamTrack.getSources
if available.
I liked clean code, acquiring any capture device on demand if needed. However, the user then is sometimes asked several times in a row to allow for the specific capture devices.
To resolve this, I acquire a selected microphone together with the first video device needed. Kind of dirty, but most users only see one request this way.
Is there any better way to ask for more then one device at once (eg. wildcard for all capture devices) and even for more then one camera at once?
With getUserMedia
one can only request one camera plus one microphone at the same time. This is a limitation in the spec.
Browsers, however, could bundle requests for more devices, but none of them do today, and probably never will, because it is such an edge-case.
Note that permission-grants persist in Chrome. In Firefox, your best bet is to convince the user to choose "Always Share" (assumes https
).