3 ms·
Okay, so I have a couple answers to that. If the user is viewing the video from the start, then there's no problem. There are multiple ways to make this work.
by Dylan16807 6y ago
Okay, so I have a couple answers to that.
If the user is viewing the video from the start, then there's no problem. There are multiple ways to make this work.
If the user wants to jump into the middle of the video, it won't work.
That's the short answer.
The long answer goes into more detail on how to make it work:
It would be possible to have the http server unzip a megabyte at a time and send it to the client, but you said you want to send the zip to the user so we'll cross out this possibility.
That leaves two ways of doing things.
The easy way is to have the client make an HTTP Range request to get the last 100KB of the zip file, then make a second request to start at the beginning of the zip file. This will let the client act like a completely normal unzipper, and it can start playing immediately.
The hard way is to go into more detail about how a zip file is structured. We don't actually need the directory to start decompressing. A zip file is structured as [file header][file data][file header][file data][file header][file data][directory]. You can just start decompressing the first file in the zip and feeding it into your media decoder. It'll work.
For watching videos from the start, zipping is only be a problem if you put multiple videos into a single zip and use a web server that doesn't support Range requests.