title: Playing audio file while I download it
body: <p>I am trying to play partially downloaded file (I want the audio to start when it has enough downloaded data).</p>
  
  <p>I have tried the following:</p>
  
  <pre><code>self.mutableData = nil;
  self.mutableData = [NSMutableData data];
  self.mutableData.length = 0;
  
  GTMHTTPFetcher *fetcher =
  [[self driveService].fetcherService fetcherWithURLString:song.filePath];
  
  [fetcher setReceivedDataBlock:^(NSData *dataReceivedSoFar) {
      [self.mutableData appendData:dataReceivedSoFar];
  
      if (!self.audioPlayer.playing &amp;&amp; self.mutableData.length &gt; 1000000)
      {
          self.audioPlayer = nil;
          self.audioPlayer = [[AVAudioPlayer alloc] initWithData:self.mutableData error:nil];
          [self.audioPlayer play];
      }
  }];
  
  [fetcher beginFetchWithCompletionHandler:^(NSData *data, NSError *error) {
      if (error == nil) 
      {
          NSLog(@"NSURLResponse: %@", fetcher.response.);
      } 
      else 
      {
          NSLog(@"An error occurred: %@", error);
      }
  }];
  </code></pre>
  
  <p>But it starts playing the first 1-3 seconds and then the app either crashes or it plays that 1-3 seconds over and over again until the download finishes and then it plays the whole song.</p>
  
  <p>Can I somehow achieve this with <code>AVPlayer</code>, or fix this problem?</p>