{"action":"created","issue":{"url":"https://api.github.com/repos/react-native-community/react-native-video/issues/955","repository_url":"https://api.github.com/repos/react-native-community/react-native-video","labels_url":"https://api.github.com/repos/react-native-community/react-native-video/issues/955/labels{/name}","comments_url":"https://api.github.com/repos/react-native-community/react-native-video/issues/955/comments","events_url":"https://api.github.com/repos/react-native-community/react-native-video/issues/955/events","html_url":"https://github.com/react-native-community/react-native-video/pull/955","id":301608886,"node_id":"MDExOlB1bGxSZXF1ZXN0MTcyMzkxMDk3","number":955,"title":"ios Caching Support","user":{"login":"n1ru4l","id":14338007,"node_id":"MDQ6VXNlcjE0MzM4MDA3","avatar_url":"https://avatars2.githubusercontent.com/u/14338007?v=4","gravatar_id":"","url":"https://api.github.com/users/n1ru4l","html_url":"https://github.com/n1ru4l","followers_url":"https://api.github.com/users/n1ru4l/followers","following_url":"https://api.github.com/users/n1ru4l/following{/other_user}","gists_url":"https://api.github.com/users/n1ru4l/gists{/gist_id}","starred_url":"https://api.github.com/users/n1ru4l/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/n1ru4l/subscriptions","organizations_url":"https://api.github.com/users/n1ru4l/orgs","repos_url":"https://api.github.com/users/n1ru4l/repos","events_url":"https://api.github.com/users/n1ru4l/events{/privacy}","received_events_url":"https://api.github.com/users/n1ru4l/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":33,"created_at":"2018-03-02T00:19:07Z","updated_at":"2018-10-09T12:58:20Z","closed_at":"2018-08-06T22:28:55Z","author_association":"CONTRIBUTOR","pull_request":{"url":"https://api.github.com/repos/react-native-community/react-native-video/pulls/955","html_url":"https://github.com/react-native-community/react-native-video/pull/955","diff_url":"https://github.com/react-native-community/react-native-video/pull/955.diff","patch_url":"https://github.com/react-native-community/react-native-video/pull/955.patch"},"body":"I want some discussion about this (related to #99). I am currently working on an iOS app so ~~I have no needs for android right now.~~ **Edit:** Android integration will follow soon!\r\n\r\nWould love some feedback from guys that are more into objective c. This is almost the first objective c I have ever written 😅.\r\n\r\nI added the libraries that I am using [SPTPersistentCache](https://github.com/spotify/SPTPersistentCache) and [DVAssetLoaderDelegate](https://github.com/vdugnist/DVAssetLoaderDelegate) as ~~git submodules as I have seen it [react-native-fast-image](https://github.com/DylanVann/react-native-fast-image)~~ cocoapod dependencies.\r\nI am using a the setup described here: http://facebook.github.io/react-native/docs/integration-with-existing-apps.html.\r\n\r\nif you would setup react-native with this library your Podfile should look similar to this:\r\n\r\n```ruby\r\n# Uncomment the next line to define a global platform for your project\r\nplatform :ios, '10.0'\r\n\r\ntarget 'VideoCaching' do\r\n  rn_path = '../node_modules/react-native'\r\n\r\n  pod 'yoga', path: \"#{rn_path}/ReactCommon/yoga/yoga.podspec\"\r\n  pod 'DoubleConversion', :podspec => \"#{rn_path}/third-party-podspecs/DoubleConversion.podspec\"\r\n  pod 'Folly', :podspec => \"#{rn_path}/third-party-podspecs/Folly.podspec\"\r\n  pod 'glog', :podspec => \"#{rn_path}/third-party-podspecs/GLog.podspec\"\r\n  pod 'React', path: rn_path, subspecs: [\r\n    'Core',\r\n    'CxxBridge',\r\n    'RCTAnimation',\r\n    'RCTActionSheet',\r\n    'RCTImage',\r\n    'RCTLinkingIOS',\r\n    'RCTNetwork',\r\n    'RCTSettings',\r\n    'RCTText',\r\n    'RCTVibration',\r\n    'RCTWebSocket',\r\n    'RCTPushNotification',\r\n    'RCTCameraRoll',\r\n    'RCTSettings',\r\n    'RCTBlob',\r\n    'RCTGeolocation',\r\n    'DevSupport'\r\n  ]\r\n\r\n  pod 'react-native-video/VideoCaching', :path => '../node_modules/react-native-video/react-native-video.podspec'\r\nend\r\n```\r\n\r\n## **Functionality**\r\n\r\nAggressive Caching based on the uri (similar to [react-native-fast-image](https://github.com/DylanVann/react-native-fast-image)). \r\nThe storage is backed by [SPTPersistentCache](https://github.com/spotify/SPTPersistentCache). (LRU Cache). Might be possible to make this someway more customisable.\r\n\r\nSince it is not possible to create an [`AVAsset`](https://developer.apple.com/documentation/avfoundation/avasset) from NSData which SPTPersistentCache returns. I also added another layer which saves the file to the devices temporary folder (Google says it is cleared after 3 days). So after three days it will have to be refetched from the persistent storage ([SPTPersistentCache](https://github.com/spotify/SPTPersistentCache)). This results in additional storage size.\r\n\r\n## **Testing**\r\n\r\n### **Method 1:**\r\n\r\nCheck out the example app located in [`examples/video-caching`](https://github.com/n1ru4l/react-native-video/tree/implement-ios-caching/examples/video-caching)\r\n\r\n**UPDATE**: There is now a README.md file which describes how you can test the implementation\r\n\r\nCommands for initializing the project:\r\n\r\n```\r\nyarn\r\ncd ios\r\npod install\r\ncd ..\r\n```\r\n\r\nAfter you initialized the project, you can open the `ios/VideoCaching.xcworkspace` project in xcode (and run it your device/simulator).\r\n\r\n### **Method 2:**\r\n\r\nUse my private fork `@n1ru4l/react-native-video@3.1.0-alpha.4` in your project. (The project will also require a proper cocoapods setup). You can copy it from the example app ([`examples/video-caching`](https://github.com/n1ru4l/react-native-video/tree/implement-ios-caching/examples/video-caching)) and replace the pod with the following line:\r\n\r\n`pod 'react-native-video/VideoCaching', :path => '../node_modules/@n1ru4l/react-native-video/react-native-video.podspec'`\r\n\r\n\r\n\r\n## **TODO**\r\n- [x] Clean up debug logging\r\n- [x] Make feature optional (react-native-camera did this with additional frameworks https://github.com/react-native-community/react-native-camera/pull/1341/files)"},"comment":{"url":"https://api.github.com/repos/react-native-community/react-native-video/issues/comments/428181576","html_url":"https://github.com/react-native-community/react-native-video/pull/955#issuecomment-428181576","issue_url":"https://api.github.com/repos/react-native-community/react-native-video/issues/955","id":428181576,"node_id":"MDEyOklzc3VlQ29tbWVudDQyODE4MTU3Ng==","user":{"login":"AlexandruVoica","id":30737899,"node_id":"MDQ6VXNlcjMwNzM3ODk5","avatar_url":"https://avatars3.githubusercontent.com/u/30737899?v=4","gravatar_id":"","url":"https://api.github.com/users/AlexandruVoica","html_url":"https://github.com/AlexandruVoica","followers_url":"https://api.github.com/users/AlexandruVoica/followers","following_url":"https://api.github.com/users/AlexandruVoica/following{/other_user}","gists_url":"https://api.github.com/users/AlexandruVoica/gists{/gist_id}","starred_url":"https://api.github.com/users/AlexandruVoica/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AlexandruVoica/subscriptions","organizations_url":"https://api.github.com/users/AlexandruVoica/orgs","repos_url":"https://api.github.com/users/AlexandruVoica/repos","events_url":"https://api.github.com/users/AlexandruVoica/events{/privacy}","received_events_url":"https://api.github.com/users/AlexandruVoica/received_events","type":"User","site_admin":false},"created_at":"2018-10-09T12:58:20Z","updated_at":"2018-10-09T12:58:20Z","author_association":"NONE","body":"Can we get a status update on the caching feature, please? 😅 I am especially interested in the Android implementation."}}
{"actor":{"display_login":"AlexandruVoica"}}