CacheWebView icon indicating copy to clipboard operation
CacheWebView copied to clipboard

CacheExtensionConfig.addExtension() doesn't work

Open tonyxu99 opened this issue 4 years ago • 0 comments

For my use case, I want to cache "mp4" files. I use the following code: CacheExtensionConfig extension = new CacheExtensionConfig(); extension.addExtension("mp4"); builder.setCacheExtensionConfig(extension);

However, the mp4 files still won't be cached. I have checked the source code (CacheExtensionConfig.java), this is the issue: public boolean isMedia(String extension) { if (TextUtils.isEmpty(extension)) { return false; } if (NO_CACH.contains(extension)) { return true; } return no_cache.contains(extension.toLowerCase().trim()); } "mp4" is in NO_CACHE static HashSet. Therefore, there is no way to cache mp4 files even if we have added "mp4" to no_cashe HashSet varible. I suggest that you should remove if (NO_CACH.contains(extension)) { return true; }

Thank you.

tonyxu99 avatar Oct 25 '21 18:10 tonyxu99