title: AVCaptureSession addInput causing glitch in background audio
body: <p>I'm making a video capturing iOS app and I want to be able to record audio from the microphone while allowing background music to play. I can do all of this but the background audio skips (pauses briefly) whenever the view with the camera enters and exits the foreground. I have isolated the bug to <code>AVCaptureSession addInput</code>:</p>
  
  <pre><code>AVCaptureSession session = [[AVCaptureSession alloc] init];
  session.automaticallyConfiguresApplicationAudioSession = NO;
  
  AVCaptureDevice *audioDevice = [AVCaptureDevice defaultDeviceWithMediaType:AVMediaTypeAudio];
  AVCaptureDeviceInput *audioDeviceInput = [AVCaptureDeviceInput deviceInputWithDevice:audioDevice error:nil];
  
  // this line causes the background music to skip
  [session addInput:audioDeviceInput];
  </code></pre>
  
  <p>How can I prevent adding microphone input from affecting the background audio?</p>
  
  <p>fyi - in <code>didFinishLaunchingWithOptions</code> I set the AVAudioSession Category:</p>
  
  <pre><code>[[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategoryPlayAndRecord
                                   withOptions:AVAudioSessionCategoryOptionMixWithOthers | AVAudioSessionCategoryOptionDefaultToSpeaker
                                         error:nil];
  </code></pre>