0

Im working on an application that downloads videos (sometimes over 1GB+) to internal iOS file system.

I am using ASIHTTPRequest to download data, that works great, however the complicated bit is the encryption. For encryption I usually use NSData+Encryption - works great for encryption and decryption of NSData , however I cannot load video that is over 1GB into RAM so when I do document AES256EncryptWithKey that just doesn't work.

The other challenge is that how do I play encrypted file? Currently I am using AVPlayer, and I saw there are some methods playing it from HTTP server, but I could find any clean solution from the local storage.

Regarding encryption I could probably use something like:

Memory issues when encrypting/decrypting a large file with RNCryptor on iOS

Community
  • 1
  • 1
Andrius Steponavičius
  • 8,074
  • 3
  • 22
  • 25
  • 1
    Why don't you just store it encrypted on the server? That will solve the first problem. As for the second, it will not end well for you...decrypting a file that huge on a mobile platform in any reasonably amount of time is a pipe dream. – borrrden Apr 03 '14 at 10:12
  • Thanks, I think first is quite a good idea. What if decryption is happening on the batches that AVPlayer is loading? Do you think thats posiible? – Andrius Steponavičius Apr 03 '14 at 10:17
  • That's the only reasonable way to handle it, but you have no way of knowing what AVPlayer is going to load next, unless you decrypt chunks yourself and continuously add them as the "next" items so in fact you are just playing a series of 5 second videos or so. More likely you would need to handle the actual video playback yourself if you want to stream it from a local file. That means looking into media playback libraries (I don't think there are many since it is not a common thing to do...) – borrrden Apr 03 '14 at 10:19
  • Regarding first, could I not add encrypted batches on ASIHTTPRequest and make file out of that? – Andrius Steponavičius Apr 03 '14 at 10:27

0 Answers0