TL;DR
Seeking in a plain MP4 works by asking the server for byte ranges. We'll write a 25-line Node server that answers them, show what happens in Chromium when a server ignores them, and fix the other classic seek-killer: the moov atom at the end of the file.
π¦ Code: github.com/USER/range-demo (replace before publishing)
Versions used: node 22 , python 3.13 , ffmpeg 6.1.1 , playwright with Chromium 153.0.8010.12 . #webdev #tutorial
1. π The protocol in four lines
From MDN's range request guide :
Accept-Ranges: bytes (anything but none ) means the server supports ranges. No header means it doesn't.
Client sends Range: bytes=0-1023 . Server replies 206 Partial Content with Content-Range: bytes 0-1023/146515 .
Out-of-bounds range gets 416 .
A server that doesn't support ranges replies 200 OK with the whole body.
2.β¦