title: Front camera brightness get very low when start recording in custom camera
body: <p>I'm working in a custom video recorder which contain both front and back camera. When i start recording in back camera no problem, when i start recording in front camera brightness of the camera reduced.</p>
  
  <p>i have camera switch button to change front and back camera</p>
  
  <pre><code>int currentCameraId;
  reverseCamera.setOnClickListener(new View.OnClickListener() {
          @Override
          public void onClick(View v) {
              mCamera.stopPreview();
              mCamera.release();
  
              if (currentCameraId == Camera.CameraInfo.CAMERA_FACING_BACK) {
                  currentCameraId = Camera.CameraInfo.CAMERA_FACING_FRONT;
              } else {
                  currentCameraId = Camera.CameraInfo.CAMERA_FACING_BACK;
              }
              mCamera = Camera.open(currentCameraId);
  
              setCameraDisplayOrientation(UnlVideoActivity.this, currentCameraId, mCamera);
              try {
  
                  mCamera.setPreviewDisplay(mHolder);
              } catch (IOException e) {
                  e.printStackTrace();
              }
              mCamera.startPreview();
          }
      });
  
   public void setCameraDisplayOrientation(Activity activity,
                                          int cameraId, android.hardware.Camera camera) {
      android.hardware.Camera.CameraInfo info =
              new android.hardware.Camera.CameraInfo();
      android.hardware.Camera.getCameraInfo(cameraId, info);
      int rotation = activity.getWindowManager().getDefaultDisplay().getRotation();
      int degrees = 0;
      params.setRotation(rotation);
      switch (rotation) {
          case Surface.ROTATION_0:
              Toast.makeText(UnlVideoActivity.this, "LAND", Toast.LENGTH_SHORT).show();
              degrees = 0;
              break;
          case Surface.ROTATION_90:
              Toast.makeText(UnlVideoActivity.this, "PORT", Toast.LENGTH_SHORT).show();
              degrees = 90;
              break;
          case Surface.ROTATION_180:
              degrees = 180;
              break;
          case Surface.ROTATION_270:
              degrees = 270;
              break;
      }
  
      int result;
      if (info.facing == Camera.CameraInfo.CAMERA_FACING_FRONT) {
          result = (info.orientation + degrees) % 360;
          result = (360 - result) % 360;  // compensate the mirror
      } else {  // back-facing
          result = (info.orientation - degrees + 360) % 360;
      }
      camera.setDisplayOrientation(result);
      camera.startPreview();
  }
  </code></pre>
  
  <p>by this way i switch the front camera when i start recoring the brightness came to low.</p>
  
  <p><strong>code for recording</strong></p>
  
  <pre><code>  private boolean prepareMediaRecorder() {
      mCamera = getCameraInstance();
  
      mediaRecorder = new MediaRecorder();
      mediaRecorder.setOrientationHint(orientationHint);
      mCamera.unlock();
      mediaRecorder.setPreviewDisplay(mHolder.getSurface());
      mediaRecorder.setCamera(mCamera);
  
      mediaRecorder.setAudioSource(MediaRecorder.AudioSource.CAMCORDER);
      mediaRecorder.setVideoSource(MediaRecorder.VideoSource.CAMERA);
  
      mediaRecorder.setProfile(CamcorderProfile.get(CamcorderProfile.QUALITY_HIGH));
  
      mediaRecorder.setOutputFile("/sdcard/myvideo.mp4");
      mediaRecorder.setMaxDuration(60000); // Set max duration 60 sec.
      mediaRecorder.setMaxFileSize(5000000); // Set max file size 5M
  
      mediaRecorder.setPreviewDisplay(mCameraSurfaceView.getHolder().getSurface());
  
      try {
          mediaRecorder.prepare();
      } catch (IllegalStateException e) {
          releaseMediaRecorder();
          return false;
      } catch (IOException e) {
          releaseMediaRecorder();
          return false;
      }
      return true;
  
  }
  </code></pre>