为什么html5视频循环会在每次迭代中创建请求 [英] Why html5 video loop create request each iteration

查看:162
本文介绍了为什么html5视频循环会在每次迭代中创建请求的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我删除了禁用缓存滴答,并且仍然会在每个视频循环迭代中进行请求(仅在chrome上)。

启动程序:其他在chrome inspector网络区段中的含义?首次从主机加载视频,但之后所有请求都从其他加载。

每个迭代视频大小相同,而不是(来自缓存)。这是否意味着浏览器每次下载?



如果不将视频保存在localStorage中(我在类似问题中看到过),可以以某种方式避免此问题,因为此解决方案不适用于私人浏览器模式,并且localStorage的大小限制?



更新



选中禁用缓存



更新



a href =https://bugs.chromium.org/p/chromium/issues/detail?id=680063 =nofollow noreferrer> https://bugs.chromium.org/p/chromium/issues/detail ?id = 680063

解决方案

我这是另一个过程,而不是Chrome 发起请求


某些其他进程或动作启动了请求,例如用户
通过链接导航到页面,或者在地址
栏中输入一个网址。


在Chrome的情况下, video使用ffmpeg 进行解码,这可能是这个其他进程。这个过程很可能是从缓存中重新打开文件,这就是为什么请求被启动,或者缓存只保留文件的后半部分(或总和的最大内容长度),以防文件很大并且必须重新流部分内容重复 - 但是,您声明禁用缓存时不会发生这种情况。



localStorage 具有非常有限的尺寸,并且不适合存储视频数据(它只能保存字符串,所以视频必须编码为mime-64,这增加了33%的大小,每个字符由于unicode而占用两个字节) p>

更好的选择是使用 IndexedDB - 这可以保存更大的数据以及以二进制格式(Blob)存储数据。但它具有与 localStorage 一样的初始限制,但与后一种方法相反,您可以请求用户需要确认的更大尺寸。我还没有测试,但我会假设你会遇到与私人模式相同的限制,与其他存储机制一样。


I have Disable cache tick removed and still request is made on each video loop iteration(Only on chrome).

What Initiator: Other mean in chrome inspector network section? First time the video is loaded from the host, but after that all requests are loaded from Other.

Each iteration video size is the same, not (from cache). Is that mean the browser download it every time?

Can it be avoided somehow without saving the video in localStorage(I saw it in similar question), because this solution will not work in private browser mode and localStorage have size limit?

UPDATE

With Disable cache checked

Without Disable cache checked

UPDATE

Bug report: https://bugs.chromium.org/p/chromium/issues/detail?id=680063

解决方案

The meaning of this is that another process than Chrome initiated the request:

Some other process or action initiated the request, such as the user navigating to a page via a link, or by entering a URL in the address bar.

In the case of Chrome, video is decoded using ffmpeg which likely is this other process. The process is likely reopening the file from the cache which is why the request is initiated, or, the cache only holds the latter part (or max content length in sum) of the file in case the file is large and has to re-stream parts of the content over again - though, you state that when cache is disabled this doesn't happen.

localStorage has a very limited size and is not very suitable for storing video data (it can only hold strings so video must be encoded as mime-64 which increases the size 33% + each char takes up two bytes due to unicode).

A better alternative would be to use IndexedDB - this can hold much larger data as well as store the data in binary format (Blob). But it comes with an initial limit as with localStorage but contrary to the latter method you can request a larger size which the user need to confirm. I haven't tested, but I would assume you will run into the same limitations with private mode as with any other storage mechanism.

这篇关于为什么html5视频循环会在每次迭代中创建请求的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆