Unverified Commit ca3e49a1 authored by Hampton Maxwell's avatar Hampton Maxwell Committed by GitHub
Browse files

Merge pull request #955 from n1ru4l/implement-ios-caching

ios Caching Support
parents ba159c3f 8d5f81a4
Loading
Loading
Loading
Loading
+7 −1
Changes for .gitignore: 7 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -33,7 +33,13 @@ local.properties
# node.js
#
node_modules/
npm-debug.log
*.log

# yarn
yarn.lock

# editor workspace settings
.vscode

# BUCK
buck-out/
+1 −1
Changes for .npmignore: 1 added line, 1 removed line.
Original line number Diff line number Diff line
/example
/examples
+4 −0
Changes for CHANGELOG.md: 4 added lines, 0 removed lines.
Original line number Diff line number Diff line
## Changelog

### Next Version

* Support video cachging for iOS ([#955](https://github.com/react-native-community/react-native-video/pull/955))

### Version 3.2.0
* Basic fullscreen support for Android MediaPlayer [#1138](https://github.com/react-native-community/react-native-video/pull/1138)
* Simplify default Android SDK code [#1145](https://github.com/react-native-community/react-native-video/pull/1145) [#1146](https://github.com/react-native-community/react-native-video/pull/1146)
+26 −0
Changes for README.md: 26 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -50,6 +50,32 @@ If you would like to allow other apps to play music over your video component, a
Note: you can also use the `ignoreSilentSwitch` prop, shown below.
</details>

<details>
  <summary>iOS (CocoaPods)</summary>
Setup your Podfile like it is described in the [react-native documentation](https://facebook.github.io/react-native/docs/integration-with-existing-apps#configuring-cocoapods-dependencies). 

Depending on your requirements you have to choose between the two possible subpodspecs:

video only:

```diff
  pod 'Folly', :podspec => '../node_modules/react-native/third-party-podspecs/Folly.podspec'

+  `pod 'react-native-video', :path => '../node_modules/react-native-video/react-native-video.podspec'`
end
```

video with caching (you can learn more about caching [here](docs/caching.md):

```diff
  pod 'Folly', :podspec => '../node_modules/react-native/third-party-podspecs/Folly.podspec'

+  `pod 'react-native-video/VideoCaching', :path => '../node_modules/react-native-video/react-native-video.podspec'`
end
```

</details>

<details>
  <summary>tvOS</summary>
  

docs/caching.md

0 → 100644
+20 −0
Changes for docs/caching.md: 20 added lines, 0 removed lines.
Original line number Diff line number Diff line
# Caching

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

# Technology

The cache is backed by [SPTPersistentCache](https://github.com/spotify/SPTPersistentCache) and [DVAssetLoaderDelegate](https://github.com/vdugnist/DVAssetLoaderDelegate).

# How Does It Work

The caching is based on the url of the asset.
SPTPersistentCache is a LRU ([last recently used](https://en.wikipedia.org/wiki/Cache_replacement_policies#Least_recently_used_(LRU))) cache.

# Restrictions

Currenly the uri of the resource that should be cached needs to have the appropriate file extension (one of `mp4`, `m4v` or `mov`). In order to be cached. In future versions (once dependencies allow access to the `content-type` header) this will no longer be necessary. 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 maxmimum cache size is 100mb.

In a future release the cache might have more configurable options.
Loading