Stream large video files from REST endpoin

Hi, Maybe someone can help me with the issue I’m having when trying to stream mp4 video files. I have create simple REST endpoint to return mp4 file and the microflow looks like this: I’m adding ‘video/mp4’ header as the ‘Content-Type’ header: If I try to stream small mp4 file (around 400kb) then everything works fine. The request returns the data and if I open it in chrome the video is playing as expected. The issue is when I try to return larger file (around 10mb) when opening in Chrome the vide doesn’t start playing and in the console I’m seeing this error: com.mendix.systemwideinterfaces.MendixRuntimeException:     at com.mendix.util.classloading.Runner.doRunUsingClassLoaderOf( Caused by: null     at   Maybe anyone has had experience and can have some suggestions on this?
2 answers

Hi Karlis,

The problem is that the browser is trying to load the entire video in a single HTTP request which will not work for such large files.
To fix this In addition to the content-type header, videos need more headers to allow for buffering, scrubbing etc.
Specifically, you need to check the content-range and content-length headers in the incoming request and serve the appropriate bytes. The response should contain the same headers.
For more details see
Some example code on how to do this with Java

Hope this helps


Contact Menno de Haas on Slack. I know he built a small module/java action to support streaming objects. Maybe he can publish it for you in the appstore