title: Android can't record video with Front Facing Camera, MediaRecorder start failed: -19
body: <p>I have two different code bases with the same problem.</p>
  
  <p><strong>The first one is code copied straight from developer.android.com here:</strong>
  <a href="http://developer.android.com/guide/topics/media/camera.html#custom-camera" rel="nofollow noreferrer">http://developer.android.com/guide/topics/media/camera.html#custom-camera</a></p>
  
  <p><strong>The second one is this code:</strong></p>
  
  <p><a href="http://android-er.blogspot.com.au/2011/10/simple-exercise-of-video-capture-using.html" rel="nofollow noreferrer">http://android-er.blogspot.com.au/2011/10/simple-exercise-of-video-capture-using.html</a></p>
  
  <p>Both work fine with the normal rear camera, but as soon as I try to use the front facing camera I get the error.</p>
  
  <p>This happens on the following devices:</p>
  
  <ul>
  <li><p><strong>Nexus S 4.1.2</strong></p></li>
  <li><p><strong>Galaxy Nexus 4.1.2</strong></p></li>
  <li><p><strong>Nexus 7 4.2.1 (it only has front facing camera)</strong></p></li>
  </ul>
  
  <p>I have tried what looks like 2.2 era Camera Params as well, which some people claim is required with some Samsung and HTC devices, although multiple different articles reference different String Keys:</p>
  
  <pre><code>c = Camera.open(frontFacingCameraID); // attempt to get a Camera instance
  Camera.Parameters params = c.getParameters();
  params.set("cam-mode", 1);
  params.set("cam_mode", 1);
  params.set("camera-id", 1);
  c.setParameters(params);
  </code></pre>
  
  <p>None of these work, also please note that I am detecting the correct Front Facing Camera ID which on the Nexus 7 is of course: 0. But the results are the same on all the devices.</p>
  
  <p>I have tried using low quality profile, I have tried setting the video resolution, encoder, output format, bitrate, frame rate and video size manually in a multitude of ways but none which have worked.</p>
  
  <p>The thing which makes me think theres nothing wrong with most of the code is that the regular camera works fine. So my guess is its something to do with the prepareVideoRecorder() / prepareMediaRecorder() method which sets up the Media Recorder.</p>
  
  <p>Perhaps a Media Recorder manual encoding settings that are known to work on a front facing camera?</p>
  
  <p>I have to say, the Android Camera and MediaRecorder API's suck. Compared with iOS its a bit of a mess, not to mention some of the scary looking param incompatibility issues and different resolutions across the fragmented device landscape.</p>
  
  <p>Assuming I can get it working on my JB devices, does anyone know from experience if most of these issues are resolved with API 15 ICS?</p>
  
  <p>I would consider not supporting API 10 Gingerbread if its going to be too hard to support.</p>