Big video streaming fills up ram, small video unstable in mobile application

I now have nextcloudpi running on an old PC. It’s 64 bit with a Core 2 Duo E8400 and 8GB ram and it’s running nextcloud 15.0.8.1 on Debian Stretch. Whenever I try to stream a video through the mobile application, it always freezes permanently, although downloading it locally is as fast as can be. But when I try to stream it through a shared link, it looks as if the video is offloaded to the ram or something, because when I try to stream a 17GB video, it fills up all my 8GB ram and then starts filling up the swap space. Meanwhile the server is completely unresponsive during all this and if I manage to load the monitoring page, it shows the CPU load average at around 4-5 and growing.

The problem with the ram seemingly doesn’t happen if the video is small, around 100MB, but it still cannot be played through the mobile application, because the built in video player doesn’t support it, while if I try to stream it to another app it either doesn’t start or it does start, but if I try to move it forward it freezes forever. Although when it does manage to play the server still becomes completely unresponsive until I stop the video.

So basically trying to play video through the app, even if it’s to stream it to another app, is unstable to the point it makes it unusable. But if I stream the video through my browser or my phone’s browser, it’s completely fine. However if the video is too big it fills up my ram and kills the server.

Does anyone know a fix for this?