Firstly, ensure that the camera is not being blocked by any application or system settings. Go to System Preferences, then Security & Privacy, and click on the Privacy tab. From there, select Camera on the left sidebar and ensure that the checkbox next to the apps you want to use the camera with (such as FaceTime, Foto Booth, etc.) is checked.
If the camera permissions are set correctly and the issue persists, you can try resetting the System Management Controller (SMC) on your MacBook Pro. To do this, shut down your MacBook Pro, then press and hold the power button for about 10 seconds. Release the button, then turn on your MacBook Pro again.
If the problem still persists after resetting the SMC, you can also try resetting the NVRAM (non-volatile random-access memory) or PRAM (Parameter RAM). To do this, restart your MacBook Pro and immediately press and hold the Option, Command, P, and R keys simultaneously. Keep holding the keys until you hear the startup sound for the second time, then release them.
After trying these steps, check if the camera issue has been resolved. If not, it might be worth considering reaching out to Official Apple Support for further assistance or visiting an Apple Store for a closer look at the hardware.