Hi KS,
- the browser is not authorized to access the camera (valid on Chrome and Edge on Windows)
- a process already uses the camera (valid on Chrome and Edge on macOS)
In the first case I think navigator.mediaDevices.getUserMedia would fail immediately, the user won't see the authorization dialog. I am not really sure how to detect that but maybe you can try/catch the call to getUserMedia and try to call enumerateDevices within the catch. If there are no devices with id AND label it means the browser is not authorized (on Chrome you will have the default devices in the list but without the id or the label, I don't fully remember).
For the second case it happens when the user granted access to the devices. When calling the enumerateDevices you will have the list of all the devices so you can be sure that the cause of your problem is that they might be already in use: a media track already exists or a process already takes the process but it is most likely the first option witch Chrome and Edge. I don't recall having this issue on Safari or Firefox, I think the message and/or the error would have been different.
Hope I am not fully wrong and it helps :)
Best,
Benjamin