MacBook Pro screen turning off and on unless plugged into external display or playing video
The screen of my MacBook Pro 2016 turns off and on repeatedly unless it is plugged into an external display or a video is playing. When neither of these conditions are it consistently flickers from on to a black screen. This problem occurred a while ago and it went away when I updated it to Big SurOS. This problem has returned and I have tried updating it again to the now current MontereyOS 12.4. However this problem still persists.
I regularly plug it into my TV via HDMI and USB-C adapter to watch things in my room. I also cast to a google chrome cast in my living room. I used to be able to disconnect from either and use my MacBook just fine. What can I do to get rid of this problem?
MacBook Pro 13″, macOS 12.3