For anyone who doesn’t have a device that natively supports this feature, there’s an app on F-Droid called “Privacy Indicators” that provides this for camera and mic access. It uses the built-in Accessibility services to provide this, and needs a couple of other special permissions
You can change the color of the indicator, mine’s red for more visibility.
I installed it from GitHub however, since the F-Droid build was really outdated: https://github.com/NitishGadangi/Privacy-Indicator-App