title: MPMoviePlayerController background audio issue in iOS5
body: <p>I have an App that does the pretty standard operation:
  It plays audio (streamed or in filesystem) when the app is in 1) Foreground mode, 2) Screen locked state 3)Background mode.
  This was working fine in all iOS prior to iOS5.</p>
  
  <p>I have been using MPMoviePlayerController (Because it can play streamed and local file system audio)
  I have the following setup:</p>
  
  <ol>
  <li>info.plist has Background Mode set to "Audio"</li>
  <li><p>I have Audiosession setup as shown at        <a href="http://developer.apple.com/library/ios/#qa/qa1668/_index.html" rel="noreferrer">http://developer.apple.com/library/ios/#qa/qa1668/_index.html</a></p>
  
  <pre><code>NSError *activationError = nil;
  AVAudioSession *mySession = [AVAudioSession sharedInstance];
  [mySession setCategory: AVAudioSessionCategoryPlayback error: &amp;activationError];
  if (activationError) { /* handle the error condition */ }
  [mySession setActive: YES error: &amp;activationError];
  if (activationError) { /* handle the error condition */ }
  </code></pre></li>
  <li><p>I have background timer enabled that gets stopped at the end of audio playback
      UIBackgroundTaskIdentifier newId = [[UIApplication sharedApplication] 
                                      beginBackgroundTaskWithExpirationHandler:NULL];</p></li>
  <li>I have the Moveplayer's useApplicationAudioSession = NO</li>
  <li>I have subscribed to the following events to detect and handle various playback state and to start a new audio file at the end of current file.
      MPMoviePlayerLoadStateDidChangeNotification
      MPMoviePlayerPlaybackDidFinishNotification
      MPMoviePlayerPlaybackStateDidChangeNotification
      MPMoviePlayerNowPlayingMovieDidChangeNotification</li>
  </ol>
  
  <h1>Problem:</h1>
  
  <p>With this the audio starts to play and when the application is put to background state or if the phone is locked, the audio continues to play. But, after when I start another audio file,
  I start getting PlaybackDidFinishNotification immediately with the state set to Playback ended (But the file was never played) </p>
  
  <p>The same code plays audio files in foreground mode (After the current audio file ends, the next file is started without any problem)</p>
  
  <p>Is there anything new in iOS5 I should be doing to get this to work? I read through the MPMoviePlayerController class reference and I couldn't see anything specific for iOS5. </p>
  
  <p>Thanks in advance.</p>