Disconnect all external devices from the computer just in case one of them is causing a problem. Keep them disconnected while troubleshooting since you don't need anything to interfere.
Create a new admin user account. Then log out of the current macOS user account & log into the new user account. Can you use the camera now? If so, then you have an issue within your main macOS user account.
If another user account doesn't work, then try booting into Safe Mode. Are you able to access the camera now? If so, then it most likely means you have some third party software installed which is causing the problem.
If neither of these options work, then you will need to perform a clean install of macOS which involves erasing the disk followed by reinstalling macOS. You need to test the camera before installing any third party apps and before migrating/restoring from a backup. If the camera works, then the hardware is working.
If it still does not work, then you can try a DFU Firmware Revive or better yet a DFU Firmware Restore....with the latter, again make sure to test the camera before installing any third party software or migrating/restoring from a backup. If the DFU Firmware Restore under these conditions does not have the camera working, then you have confirmed a hardware issue with the laptop that will need to be repaired by Apple or an Apple Authorized Service Provider.
How to revive or restore Mac firmware - Apple Support