Commit 4f386d2c authored by Laurin Quast's avatar Laurin Quast
Browse files

make video cache feature optional

parent 4c767639
Loading
Loading
Loading
Loading
+24 −0
Changes for examples/video-caching/README.md: 24 added lines, 0 removed lines.
Original line number Diff line number Diff line
# react-native-video caching example (currently only working on iOS)

# How to verify that caching is working (iOS)

1. run `./update.sh`
2. open `ios/VideoCaching.xcworkspace`
3. build and run project in simulator
4. after the video is loaded -> disconnect from the internet
5. kill the application
6. start the application again -> the video is there despite being offline :)

# How to verify that you can build the project without the caching feature (iOS)

1. In `ios/Podfile` apply the following changes
```diff
- pod 'react-native-video/VideoCaching', :path => '../node_modules/react-native-video/react-native-video.podspec'
+ pod 'react-native-video', :path => '../node_modules/react-native-video/react-native-video.podspec'
```
2. run `./update.sh`
3. open `ios/VideoCaching.xcworkspace`
4. build and run project in simulator
5. after the video is loaded -> disconnect from the internet
6. kill the application
7. start the application again -> the video should not load
+1 −1
Changes for examples/video-caching/ios/Podfile: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -28,5 +28,5 @@ target 'VideoCaching' do
    'DevSupport'
  ]

  pod 'react-native-video', :path => '../node_modules/react-native-video/react-native-video.podspec'
  pod 'react-native-video/VideoCaching', :path => '../node_modules/react-native-video/react-native-video.podspec'
end
+11 −8
Changes for examples/video-caching/ios/Podfile.lock: 11 added lines, 8 removed lines.
Original line number Diff line number Diff line
PODS:
  - boost-for-react-native (1.63.0)
  - DoubleConversion (1.1.5)
  - DVAssetLoaderDelegate (0.3.1)
  - DVAssetLoaderDelegate (0.3.2)
  - Folly (2016.10.31.00):
    - boost-for-react-native
    - DoubleConversion
@@ -9,10 +9,13 @@ PODS:
  - glog (0.3.4)
  - React (0.56.0):
    - React/Core (= 0.56.0)
  - react-native-video (3.1.0):
    - DVAssetLoaderDelegate (= 0.3.1)
  - react-native-video/Video (3.1.0):
    - React
    - SPTPersistentCache (= 1.1.0)
  - react-native-video/VideoCaching (3.1.0):
    - DVAssetLoaderDelegate (~> 0.3.1)
    - React
    - react-native-video/Video
    - SPTPersistentCache (~> 1.1.0)
  - React/Core (0.56.0):
    - yoga (= 0.56.0.React)
  - React/CxxBridge (0.56.0):
@@ -70,7 +73,7 @@ DEPENDENCIES:
  - DoubleConversion (from `../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec`)
  - Folly (from `../node_modules/react-native/third-party-podspecs/Folly.podspec`)
  - glog (from `../node_modules/react-native/third-party-podspecs/GLog.podspec`)
  - react-native-video (from `../node_modules/react-native-video/react-native-video.podspec`)
  - react-native-video/VideoCaching (from `../node_modules/react-native-video/react-native-video.podspec`)
  - React/Core (from `../node_modules/react-native`)
  - React/CxxBridge (from `../node_modules/react-native`)
  - React/DevSupport (from `../node_modules/react-native`)
@@ -112,14 +115,14 @@ EXTERNAL SOURCES:
SPEC CHECKSUMS:
  boost-for-react-native: 39c7adb57c4e60d6c5479dd8623128eb5b3f0f2c
  DoubleConversion: a9706f16e388b53ff12cca34473428ee29746a26
  DVAssetLoaderDelegate: 7d1e43ec1e98660b918a65fc50edf3d73e1f0ea6
  DVAssetLoaderDelegate: 38a24530292bf77900fdfdf635434f7f9b49486d
  Folly: c89ac2d5c6ab169cd7397ef27485c44f35f742c7
  glog: b3b0330915eccea41c5cc9731a77cf564a9be5ea
  React: 1fe0eb13d90b625d94c3b117c274dcfd2e760e11
  react-native-video: 87e0a64ccdeca6ff26182a036650cc13e3817e3f
  react-native-video: 44c6befbc1526283ca1919891fcebe4680feade4
  SPTPersistentCache: df36ea46762d7cf026502bbb86a8b79d0080dff4
  yoga: b1ce48b6cf950b98deae82838f5173ea7cf89e85

PODFILE CHECKSUM: a72d15643ecf681eee8bfdb9918eaa0cba0620f7
PODFILE CHECKSUM: f4123c35c77493d6ddbcb86898737abdf5e0fac8

COCOAPODS: 1.5.3
+5 −0
Changes for examples/video-caching/update.sh: 5 added lines, 0 removed lines.
Original line number Diff line number Diff line
rm -rf node_modules
yarn
cd ios
rm -rf Pods/* Podfile.lock
pod install
+8 −2
Changes for ios/Video/RCTVideo.h: 8 added lines, 2 removed lines.
Original line number Diff line number Diff line
@@ -4,12 +4,18 @@
#import "UIView+FindUIViewController.h"
#import "RCTVideoPlayerViewController.h"
#import "RCTVideoPlayerViewControllerDelegate.h"
#import "RCTVideoCache.h"

#if __has_include(<react-native-video/RCTVideoCache.h>)
#import <react-native-video/RCTVideoCache.h>
#import "DVURLAsset.h"
#endif

@class RCTEventDispatcher;

#if __has_include(<react-native-video/RCTVideoCache.h>)
@interface RCTVideo : UIView <RCTVideoPlayerViewControllerDelegate, DVAssetLoaderDelegatesDelegate>
#else
@interface RCTVideo : UIView <RCTVideoPlayerViewControllerDelegate>
#endif

@property (nonatomic, copy) RCTBubblingEventBlock onVideoLoadStart;
@property (nonatomic, copy) RCTBubblingEventBlock onVideoLoad;
Loading