I know how to send a video by chunks in nodejs, however it’s by sending only the video and there is no other content on the page. I would like to ask if there is a way to serve an html file with video tag for example and sending video into that video tag in chunks so there can be other content around the video. I can’t find anything on google, probably because I don’t know how to ask this without writing and example. All examples are sending just the video data.
If you already know how to send videos, then you just need to include the route on the HTML.
For example, if you have a route
/videos, which will serve a specific video, modify it to include a file name:
/videos/:file. Then modify your route to send that file. Next, on your HTML, include the route and file name:
<video width="300" height="300" controls> <source src="/videos/the-video-file.mp4" type="video/mp4"> </video>
Now your app should serve the videos .
So I should have route to render html file for example /videos
and then another route /videos/:file and the source tag will perform a get request?
Yes, as long as your route does stream the video chunks, it should work (I’ve tested it, but with different routes for the videos and the HTML files).
Ah I understand now, thank you so much.