Skip to content

Commit

Permalink
Avoid overwriting cache entries on every play or download.
Browse files Browse the repository at this point in the history
  • Loading branch information
dero committed Oct 4, 2021
1 parent d7ac820 commit 64ca172
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/js/web-components/video-download/VideoDownloader.js
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,12 @@ export default class VideoDownloader extends HTMLElement {
async saveToCache(urls) {
try {
const cache = await caches.open(this.internal.cacheName);
await cache.addAll(urls);

urls.forEach(async (url) => {
if (!await cache.match(url)) {
await cache.add(url);
}
});
} catch (error) {
if (error.name === 'QuotaExceededError') {
/**
Expand Down

0 comments on commit 64ca172

Please sign in to comment.