title: E/MediaRecorder﹕ start failed: -19 Exception on recorder.start()
body: <p>I'm trying to get the front camera recording using the MediaRecorder class.
  I've already succeeded in taking video with the back-facing camera but now I keep getting this error:</p>
  
  <pre><code>E/MediaRecorder﹕ start failed: -19
  </code></pre>
  
  <p>I've tried multiple values for the mediarecorder initialization but none of them changed the error so I ended up with default values for most settings.</p>
  
  <p>Here's my initialization of the media recorder:</p>
  
  <pre><code>recorder.setCamera(openFrontFacingCamera());
  recorder.setAudioSource(MediaRecorder.AudioSource.DEFAULT);
  recorder.setVideoSource(MediaRecorder.VideoSource.DEFAULT);
  recorder.setOutputFormat(MediaRecorder.OutputFormat.MPEG_4);
  
  if (Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED))
     {
      String nowDate = new SimpleDateFormat("mmhhddMMyyyy").format(new Date());
      String externalStoragePath = Environment.getExternalStorageDirectory().getAbsolutePath();
      String externalOutputPath = externalStoragePath + File.separator + nowDate + ".mp4";
      recorder.setOutputFile(externalOutputPath);
      Log.d("Path", "The output path: " + externalOutputPath);
     }
  else
     {
      String nowDate = new SimpleDateFormat("mmhhddMMyyyy").format(new Date());
      String storagePath = Environment.getDataDirectory().getAbsolutePath();
      recorder.setOutputFile(storagePath + nowDate + ".mp4");
      Log.d("Path", "The output path: " + storagePath);
     }
  
  recorder.setVideoSize(320,240);
  recorder.setVideoFrameRate(30);
  recorder.setAudioEncoder(MediaRecorder.AudioEncoder.DEFAULT);
  recorder.setVideoEncoder(MediaRecorder.VideoEncoder.DEFAULT);
  </code></pre>
  
  <p><strong>openFrontFacingCamera</strong></p>
  
  <pre><code>private Camera openFrontFacingCamera() {
      int cameraCount = 0;
      Camera cam = null;
      Camera.CameraInfo cameraInfo = new Camera.CameraInfo();
      cameraCount = Camera.getNumberOfCameras();
      for (int camIdx = 0; camIdx &lt; cameraCount; camIdx++) {
          Camera.getCameraInfo(camIdx, cameraInfo);
          if (cameraInfo.facing == Camera.CameraInfo.CAMERA_FACING_FRONT) {
              try {
                  cam = Camera.open(camIdx);
                  camID =  camIdx;
              } catch (RuntimeException e) {
                  Log.e("CameraError", "Camera failed to open: " + e.getLocalizedMessage());
              }
          }
      }
      return cam;
  }
  </code></pre>