最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Does seeking an HTML5 video require loading the whole file? - Stack Overflow

programmeradmin4浏览0评论

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?

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?

Share Improve this question asked Mar 22, 2015 at 18:21 TomTom 1,5652 gold badges22 silver badges45 bronze badges 1
  • 1 based on this it seems like you can, if the video metadata has been loaded, so the browser already knows the video size so it can ask the server to start loading from a different position, and the server knows how to honour partial data transfer requests. The fastest way to find out, of course, is to simply give it a try on a test URL and see what happens for your setup. – Mike 'Pomax' Kamermans Commented Mar 22, 2015 at 18:28
Add a ment  | 

2 Answers 2

Reset to default 10

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.

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

发布评论

评论列表(0)

  1. 暂无评论