I am developing a streaming website. It works, however, at some time, I have installed a software called OBS which installed a virtual camera. Since then, when the web site tries to use the camera, it uses the OBS virtual camera, instead of my physical camera. But this occurs only in my PC. When the camera is to be used, this permission dialog appears:
In my laptop, this works, that is, in that same dialog, it shows a combobox allowing to choose which camera to use.
In the web site, I am starting the camera this way:
navigator.mediaDevices.getUserMedia(constraints).then(function (stream) {
});
Can I do something with the getUserMedia function or this problem is only related to the PC configuration?
This has to do with Google Chrome. Assuming that OBS's deviceID stays the same, then use
navigator.mediaDevices.enumerateDevices()
to get a list of all available devices.(MDN's example is quite handy):
However, if you would like to be able to switch cameras mid stream, then I would recommend using WebRTC's "official" example, however, you will need to use
stream.replaceTracks
to view it in real time.