I have a problem with storing videos in Cache Storage. It works fine if the video has small size, but if its size is about 100MB, I get this error:
DOMException: Entry was not found.
I use the following code:
fetch(videoUrl).then(function(res) {
var responseToCache = res.clone();
caches.open('videos').then(function(cache) {
var request = new Request('.mp4');
cache.put(request, responseToCache).catch(function(err) {
console.log(err); //this is where the error is thrown
});
});
});
I can store multiple small files with total size >= 100 MB however.
I suppose this is a limit of Chrome browser, but I cannot find any reference in Internet.
Is there any way to avoid this limitation?
Edit:
The max video size I can store is 64MB. If the size is more than that, an error occurs.
Edit 2:
The error occurs only in Chrome. Firefox has no such limit. I tried videos with size >= 350MB, and its OK, in Firefox.
I have a problem with storing videos in Cache Storage. It works fine if the video has small size, but if its size is about 100MB, I get this error:
DOMException: Entry was not found.
I use the following code:
fetch(videoUrl).then(function(res) {
var responseToCache = res.clone();
caches.open('videos').then(function(cache) {
var request = new Request('https://example./video.mp4');
cache.put(request, responseToCache).catch(function(err) {
console.log(err); //this is where the error is thrown
});
});
});
I can store multiple small files with total size >= 100 MB however.
I suppose this is a limit of Chrome browser, but I cannot find any reference in Internet.
Is there any way to avoid this limitation?
Edit:
The max video size I can store is 64MB. If the size is more than that, an error occurs.
Edit 2:
The error occurs only in Chrome. Firefox has no such limit. I tried videos with size >= 350MB, and its OK, in Firefox.
Share Improve this question edited May 7, 2016 at 13:06 Oleg asked Apr 30, 2016 at 10:46 OlegOleg 23.3k10 gold badges70 silver badges86 bronze badges 4- i forgot where but i read that was a Windows-specific bug in the Cache API implementation in Chrome and they're willing to fix it in the next versions. – Akram Saouri Commented Apr 30, 2016 at 10:59
- What's the max size you can store for 1 item? 5M? 20M? 99? – Rudie Commented May 7, 2016 at 10:16
- @Rudie The max size is 64MB. If video is bigger, an error occurs – Oleg Commented May 7, 2016 at 10:59
- Great question. Hard to answer. This kind of new technologies needs to be tested and debugged before use in production applications. Firefox it's ok, as always. Chrome has serious bugs, as usual. – Marcos Pérez Gude Commented May 7, 2016 at 11:34
2 Answers
Reset to default 3 +100The "max size" is not a set number it is based off of your puter and amount of available disk space, that specific number is kind of tricky to calculate and so it is easier just to place chrome://net-internals/#httpCache
in your google chrome address bar, click on "cache" then find the Max size:
under statistics
if this number is too small you can change the max size
.
Follow these steps:
- Right-click the Google Chrome shortcut on the Start menu or desktop and select “Properties“
- Click the “Shortcut” tab at the top of the “Google Chrome Properties” window.
- Click the “Target” field, and push the “End” key to move the cursor to the end of the text.
- Push the space bar once.
- Type “–disk-cache-size=1073741824” (this is equal to 1GB) in the field, modifying the number after “size=” so that it represents the space that you would like to devote to the Google Chrome disk cache in bytes.
- Click “OK.” Close any running instances of Google Chrome, and re-open the browser to begin using the new cache size.
Any other questions on the topic, refer to this page for a great answer https://superuser./questions/769626/why-doesnt-chrome-respect-the-diskcachesize-policy
You are also responsible for periodically purging cache entries. Each browser has a hard limit on the amount of cache storage that a given origin can use. The browser does its best to manage disk space, but it may delete the Cache storage for an origin. The browser will generally delete all of the data for an origin or none of the data for an origin. Make sure to version caches by name and use the caches only from the version of the script that they can safely operate on.
Read more here
Because this technology's specification has not stabilized yet, I don't remend you to use It in your application.
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745121453a4612438.html
评论列表(0条)