Just another FOSS nerd.
I got BJCAST working (https://github.com/WirelessPresentation/WirelessDisplay) by installing the BJCastTV.apk on the TV and BJCast-v2.2.2.apk (from the Aug 18, 2021 release) on my phone. It also has windows/mac clients. It claims to also work with Miracast (so the phone app shouldn’t be necessary), but I wasn’t able to get it running that way. Maybe you’ll have better luck. Also it seemed rather laggy to me, and kinda shady too, despite being open-source, it’s all in chinese and displays “Trial Version” in the corner.
EDIT: Actually, I read now that it’s not FOSS, only part of the code for the demo version is available. Sad.
This is actually something I haven’t thought of. I’ll check it as soon as they deliver it. :D Although wouldn’t switching between HDMI input and miracast be janky, or does it happen automatically?