In my application a user can make calls if he can produce an audio stream. So, I need to require access to the microphone (audio stream). Without it the application should throw an error. Video is optional. So, I call navigator.getUserMedia
and put constraints
like this:
{ audio: true, video: false }
And it throws an error when a microphone is not present, just like I need. But a side effect from this is that if the user also has access to a camera, video is not present in stream.
But if I set both audio
and video
to true
I would have an error in cases when users have a microphone but do not have access to a camera (which is ok according to my application logic)
How I can make a video stream optional get getUserMedia
?