title: iOS Objective-C/Swift read file while downloading
body: <p>I'm trying to play an audio file while it's downloading, is that possible in iOS?</p>
  
  <p>I know I can get the location of the file "after" it's downloaded through:  </p>
  
  <pre><code>(void)URLSession:(NSURLSession *)session downloadTask:(NSURLSessionDownloadTask *)downloadTask didFinishDownloadingToURL:(NSURL *)location
  </code></pre>
  
  <p>But I need to read/play it while it's still downloading.</p>
  
  <p><strong>Update</strong>
  My original problem is:
  I need to play a streamable audio file in either right or left headphones. There's already method setPan in AVAudioPlayer, but AVAudioPlayer does not work perfectly with streaming data. On the other hand, AVPlayer works perfect with streaming data, but it does not allow to "setPan".</p>
  
  <p>My idea was to start downloading the audio file and pass it to AVAudioPlayer and call "setPan", but i can't access the file while it's being downloaded. And I'm still not sure if AVAudioPlayer will append the new downloaded data that is added to the file, while the file is playing. </p>