react-native-video/docs/pages/other/caching.md
Krzysztof Moch 85e30f0335
feat: move docs to github pages (#3296)
* feat(docs): setup nextra

* feat(docs): add pages

* docs: update introduction page

* docs: fix typos

* docs: fix links

* docs: update README

* docs: sync with master

* docs: remove old docs

* fix(ci/docs): fix typos

* fix(ci/docs): fix docs setup

* fix(docs): update next config

* chore(ci/docs): clean up

* chore(docs): add meta tags

* chore: apply review changes

* docs: move drm into api section

* docs: fix next config

* docs: fix links

* docs: add methods section

* chore: sync with main

* docs: add missing onAudio events
2023-10-26 08:54:14 +02:00

1.2 KiB

Caching

Caching is currently only supported on iOS platforms with a CocoaPods setup.

Technology

The cache is backed by SPTPersistentCache and DVAssetLoaderDelegate.

How Does It Work

The caching is based on the url of the asset. SPTPersistentCache is a LRU (Least Recently Used) cache.

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.

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.