title: How can I avoid the AVPlayerLayer `setPlayer` audio blip?
body: <p>I have an application that plays video using <code>AVPlayer</code> and <code>AVPlayerLayer</code>. In my app, I'm able to play audio when the app is locked by setting the <code>player</code> property of my <code>AVPlayerLayer</code> to <code>nil</code> when the application enters the background:</p>
  
  <pre><code>-(void)appEnteredBackgroundNotification:(NSNotification *)notification {
  
      [[self playerLayer] setPlayer:nil];
  
  }
  </code></pre>
  
  <p>However, when I do this, the audio will lag/blip for around 0.5 seconds. This sounds really really bad for the end user. Same goes for when the app enters foreground and I re-set the <code>player</code> property.</p>
  
  <p>How can I avoid this audio blip? As a test I've tried removing the player in a background thread to no avail.</p>
  
  <p><strong>Update:</strong> I spoke with an Apple engineer at WWDC and they said that this issue is a bug on their end (so far not fixed in iOS 9) and this approach is the correct approach. Great...</p>