Tom
Tom

Reputation: 1565

Does seeking an HTML5 video require loading the whole file?

I want to randomly seek to different points in a ~30 minute video every 30 seconds. The filesize will be 100mb. When I seek does the player start loading from that point or does it have to load the entire file and then find that time within it?

Upvotes: 10

Views: 1498

Answers (2)

Cristian Casais
Cristian Casais

Reputation: 21

No, it starts loading from the given timestamp, as long as the browser knows the duration of the video.

Upvotes: 1

Harvtronix
Harvtronix

Reputation: 854

It depends on the browser. If we are talking about a modern browser then when you seek, they will typically send a new http request to the server containing a Range: header, indicating what "chunk" of the file they want to load. This would only be for a browser utilizing http 1.1 or higher. I think if the browser supports html5 video then you can be fairly certain that they will be using http 1.1. Keep in mind though that the client will typically always be loading something. So if you seek to 5 seconds into the vid it will essentially start loading the entire thing again until another seek happens.

Upvotes: 10

Related Questions