title: AVCaptureSession captures black/dark frames after changing preset
body: <p>I'm developing app which supports both <em>still image</em> and <em>video</em> capture with <code>AVFoundation</code>. Capturing them requires different <code>AVCaptureSession</code> presets. I check for <code>canSetSessionPreset()</code>, begin change with <code>beginConfiguration()</code>, set required preset with <code>sessionPreset</code> and end with <code>commitConfiguration()</code>.</p>
  
  <p>I found if I'm capturing still image with <code>AVCaptureStillImageOutput</code> <strong>immediately</strong> after changing preset, it returns no errors, but the resulting image is black or very dark sometimes.</p>
  
  <p>If I start capturing video with <code>AVCaptureMovieFileOutput</code> <strong>immediately</strong> after changing preset, first several frames in a resulting file are also black or very dark at times.</p>
  
  <p>Right after changing preset the screen flickers likely due to the camera adjusting the exposure. So it looks like immediately after changing preset camera start measuring exposure from very fast shutter speed, which results in black/dark frames.</p>
  
  <p>Both problems goes away if I insert a 0.1 second delay between changing the preset and starting capture, but that's ugly and no one can guarantee it will work all the time on all devices.</p>
  
  <p>Is there a clean solution to this problem?</p>