From b4a434656c41c27cd7f3b8851878e3ca89685940 Mon Sep 17 00:00:00 2001 From: lovegaoshi <106490582+lovegaoshi@users.noreply.github.com> Date: Fri, 8 Mar 2024 08:56:56 -0800 Subject: [PATCH] docs: android cache --- docs/pages/component/props.mdx | 1 + docs/pages/other/caching.md | 22 +++++++++++++++------- 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/docs/pages/component/props.mdx b/docs/pages/component/props.mdx index 7bf21d57dd..956823e685 100644 --- a/docs/pages/component/props.mdx +++ b/docs/pages/component/props.mdx @@ -91,6 +91,7 @@ bufferConfig={{ maxBufferMs: 50000, bufferForPlaybackMs: 2500, bufferForPlaybackAfterRebufferMs: 5000 + cacheSizeMB: 0 }} ``` diff --git a/docs/pages/other/caching.md b/docs/pages/other/caching.md index f955db367d..f157d752d0 100644 --- a/docs/pages/other/caching.md +++ b/docs/pages/other/caching.md @@ -1,22 +1,30 @@ # Caching -Caching is currently only supported on `iOS` platforms with a CocoaPods setup. +Caching is supported on `iOS` platforms with a CocoaPods setup, and on `android` using `SimpleCache`. -## Technology +## Android + +Android uses a LRU `SimpleCache` with a variable cache size that can be specified by bufferConfig - cacheSizeMB. This creates a folder named `RNVCache` in the app's `cache` folder. Do note RNV does not yet offer a native call to flush the cache yet, users can expect the cache to be flushed by cleaning the app's cache. + +In addition, this resolves RNV6's repeated source URI call problem when looping a video on Android. + +## iOS + +### Technology The cache is backed by [SPTPersistentCache](https://github.com/spotify/SPTPersistentCache) and [DVAssetLoaderDelegate](https://github.com/vdugnist/DVAssetLoaderDelegate). -## How Does It Work +### How Does It Work The caching is based on the url of the asset. -SPTPersistentCache is a LRU ([Least Recently Used](https://en.wikipedia.org/wiki/Cache_replacement_policies#Least_recently_used_(LRU))) cache. +SPTPersistentCache is a LRU ([Least Recently Used]()) cache. -## Restrictions +### Restrictions -Currently, caching is only supported for URLs that end in a `.mp4`, `.m4v`, or `.mov` extension. In future versions, URLs that end in a query string (e.g. test.mp4?resolution=480p) will be support once dependencies allow access to the `Content-Type` header. At this time, HLS playlists (.m3u8) and videos that sideload text tracks are not supported and will bypass the cache. +Currently, caching is only supported for URLs that end in a `.mp4`, `.m4v`, or `.mov` extension. In future versions, URLs that end in a query string (e.g. test.mp4?resolution=480p) will be support once dependencies allow access to the `Content-Type` header. At this time, HLS playlists (.m3u8) and videos that sideload text tracks are not supported and will bypass the cache. You will also receive warnings in the Xcode logs by using the `debug` mode. So if you are not 100% sure if your video is cached, check your Xcode logs! By default files expire after 30 days and the maximum cache size is 100mb. -In a future release the cache might have more configurable options. \ No newline at end of file +In a future release the cache might have more configurable options.