Hello!
Alex Podolski
1

Good day, Alex.

Thanks for response. There are two major kinds of PHAssets: photos and videos.

  1. For the photo asset I extract NSData using requestImageDataForAsset:options:resultHandler: and then put it in the stream described in the referenced article.
  2. For video PHAssets the story is more interesting. First of all I try to convert PHAsset to ALAsset using the following code and if it was successful I wrap it in the NSInputStream for ALAsset from POSInputStreamLibrary. In other case I use standard NSInputStream for the file as you suggested.

I attached the chart from the Cloud Mail.Ru monitoring dashboard. It demonstrates that more than 90% of PHAssets with videos can be converted to ALAssets.

Upload Stream Types

The approach has 2 advantages:

  1. No free space required on user’s devices to obtain a copy of video in the application’s sandbox.
  2. ALAsset stream is much more performant than file stream.