This error can occur in several cases.
Usually, webcam cannot be used in more than one program at the same time, you need to close all other applications using it.
If you do not know which application is using your device and cannot find it manually you can try to use Windows process explorer to determine and close it then.
To use your devices in browser, you need to grant access to them. If you have already done this in the browser and still see the error, check the privacy settings in your operating system.
As a last resort, you can try the following:
This can help not only in the case when the device is being used by another application, but also in case of any unknown glitches.