The browser already knows why your camera is black
When a camera fails to start on a web page, the browser is not confused about the reason. The getUserMedia call rejects with a DOMException whose name is specified, and the name identifies the cause exactly. NotAllowedError means permission was refused, by you or by policy. NotFoundError means no device of that kind is attached. NotReadableError means the hardware is present and something else has it. OverconstrainedError means the device exists but cannot deliver the format that was asked for.
Almost every webcam test page throws that away and shows a black rectangle. The information needed to fix the problem was returned by the platform and discarded by the page, which is why people end up reinstalling drivers to solve a conferencing app they left running in the background.
That last case, NotReadableError, is the one worth knowing about, because it is both the most common and the least visible. On most systems a camera can be held by one application at a time. A video call that was closed with the window rather than quit, a recording tool minimised to the tray, or a background process that grabbed the device at login will hold it. Nothing on screen indicates this. The camera light may not even be on. The only symptom is that every other application reports a failure, and the reason is a program you believe you are not running.
The microphone half has a different problem, which is that a still picture of a waveform proves nothing. The useful test is a level meter that moves with your voice, and the useful measurement is root mean square rather than peak: peak jumps on a single keystroke and reads as working, while RMS tracks sustained level, which is what tells you the microphone is genuinely picking up speech. A signal that registers but stays very low is a distinct diagnosis from silence, since one usually means input gain and the other usually means the wrong device is selected.
It is also worth checking what the camera actually delivers rather than what was requested. A camera routinely ignores the resolution asked for and returns whatever it can, so the constraints tell you nothing; the track settings tell you the truth. That is the number to compare against a "1080p webcam" claim on a box. Nothing here is recorded: the stream is attached to a preview element and an audio analyser in the tab, and is discarded when you stop.