I can get mediaDevices of type "videoinput" through navigator.mediaDevices.enumerateDevices()
Promise.
I can get the mediaStream through navigator.mediaDevices.getUserMedia(constraints)
promises.
In order to have two video tracks in userMedia, what should the constraints
look like?
You can get at most one video track and one audio track each time you call
getUserMedia()
, but you can call it multiple times. However, this may ask the user multiple times, depending on https, browser, and user actions.Follow the standard (currently requires adapter.js in Chrome) to get a specific "videoinput" device, constrain it # using
ThedeviceId
##deviceIdis passed to
getUserMedia:
exact
If you want two cameras, you have to callkeyword makes the constraint required, ensuring that it only returns the correct constraint, otherwise it will fail.
getUserMedia
again with a different
deviceIdand hope that the operating system you are on supports it (e.g. mobile phones usually don't).