简体   繁体   English

寻找HTML5视频是否需要加载整个文件?

[英]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. 我希望每30秒在一个~30分钟的视频中随机寻找不同的点。 The filesize will be 100mb. 文件大小为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? 当我寻找时,播放器从该点开始加载,还是必须加载整个文件,然后在其中找到时间?

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. 如果我们在谈论现代浏览器,那么当您寻找时,他们通常会向服务器发送一个新的http请求,其中包含Range:标头,指示他们想要加载的文件的“块”。 This would only be for a browser utilizing http 1.1 or higher. 这仅适用于使用http 1.1或更高版本的浏览器。 I think if the browser supports html5 video then you can be fairly certain that they will be using http 1.1. 我认为如果浏览器支持html5视频,那么你可以相当肯定他们将使用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. 因此,如果你试图进入vid 5秒钟,它将基本上开始再次加载整个事物,直到另一次搜索发生。

不,只要浏览器知道视频的持续时间,它就会从给定的时间戳开始加载。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM