3

In my React Native application I am using React Native Video.

Currently, the library offers caching (using SPTPersistentCache and DVAssetLoaderDelegate). The caching currently implemented is by the asset's URL. Or in other words, if I watch a video from https://video.net/video.mp4 next time I pass the same link to React Native Video, the cached version of the file will be loaded.

However, in my application the same video file can be stored in different places (it will have different download links). Thus, caching would not work properly for me and it might result in an already cached file being re-downloaded once again if its download link is different.

Is there a way I could cache files by a unique ID rather than their download link. All my video files have unique IDs and I would like to cache them by their ID.

Any help would be appreciated.

EDJ
  • 843
  • 3
  • 17
  • 37
  • Nice question, I think creating centralized state for video caching will solve the problem. You can store the file in state only once for first fetching and you can allocate the id to it and you can use that id to fetch the cached video from that centralized state, I think this will help you somehow. – Pranil Tunga Jul 16 '19 at 13:22

1 Answers1

0

Unfortunately, this is not something you can do out of the box.

Looking at the implementation of VideoCaching, it expects a URI identifier in order to store the respective data coming from it inside a temporary location. The only way I can think is you adding extra functionality on the original implementation!

Good luck in any case :)

wizofe
  • 494
  • 7
  • 19