My solution is a bit old school: A raspberry pi connected to my network and running miniDLNA. It has an externally powered USB hard drive. My TV runs Android and I have VLC installed. Any DLNA client works including Xbox and mobile phone apps too.
I don’t think mini DLNA is even updated anymore so eventually my solution might stop working but it’s been running solid for 10 years
EarlyOOM is your friend. Tweak it to save the most important stuff and kill irrelevant stuff first when low on memory.