title: Prevent AVPlayer from pausing when it enters the background?
body: <p>I have a simple app with an AVPlayer playing M3U8 content. Within the app, I do the following to allow background audio:</p>
  
  <pre><code>    NSError *audioError;
      [[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategoryPlayback error:&amp;audioError];
      if (audioError == nil)
      {
          [[AVAudioSession sharedInstance] setActive:YES error:nil];
      }
  </code></pre>
  
  <p>When I hit the lock button on my phone, the audio pauses. If I hit the lock button again (to look at the lock screen) I see media controls and I can un-pause the content to hear the audio.</p>
  
  <p>My question is, how do I prevent this auto-pause so it keeps playing when the lock button is first pressed? I tried something like the following:</p>
  
  <pre><code>- (id) init
  {
      // ...
      [[NSNotificationCenter defaultCenter] addObserver: self selector: @selector(handleEnteredBackground) name: UIApplicationDidEnterBackgroundNotification object: nil];
      // ...
  }
  
  - (void) handleEnteredBackground
  {
      // [player play];
      [player performSelector:@selector(play) withObject:nil afterDelay:1];
  }
  
  </code></pre>
  
  <p>But this didn't seem to work.</p>