title: AVCaptureSession Brightness
body: <p>I am developing a mirror app using front-camera with <code>AVFoundation</code>. I have already completed to display camera screen to <code>UIView</code>. But How can I adjust brightness?
  The codes are like this:</p>
  
  <pre><code>-(void)AVCaptureInit {   
      mCameraAVSession = [[AVCaptureSession alloc] init];
      [mCameraAVSession setSessionPreset:AVCaptureSessionPresetPhoto];
  
      mCaptureDevice = [AVCaptureDevice defaultDeviceWithMediaType:AVMediaTypeVideo];
  
      NSArray *devices = [AVCaptureDevice devicesWithMediaType:AVMediaTypeVideo];
      for (AVCaptureDevice *device in devices) {
          if ([device position] == AVCaptureDevicePositionFront) {
              mCaptureDevice = device;
              break;
          }
      }
  
      //if ([mCaptureDevice hasTorch] &amp;&amp; [mCaptureDevice hasFlash])
      {
          [mCaptureDevice lockForConfiguration:nil];
          // [mCaptureDevice setTorchMode:AVCaptureTorchModeOn];
          //[mCaptureDevice setExposurePointOfInterest:0.5];
  
          [mCaptureDevice setExposureMode:AVCaptureExposureModeManual];
  
          [mCaptureDevice unlockForConfiguration];
      }
  
  
  
      // [inputDevice setTorchModeOnWithLevel:0.5 error:NULL];
  
      NSError *error;
      AVCaptureDeviceInput *deviceInput = [AVCaptureDeviceInput deviceInputWithDevice:mCaptureDevice error:&amp;error];
  
      if ([mCameraAVSession canAddInput:deviceInput]) {
          [mCameraAVSession addInput:deviceInput];
      }
  
      AVCaptureVideoPreviewLayer *previewLayer = [[AVCaptureVideoPreviewLayer alloc] initWithSession:mCameraAVSession];
      [previewLayer setVideoGravity:AVLayerVideoGravityResizeAspectFill];
      CALayer *rootLayer = [mCameraView layer];
      [rootLayer setMasksToBounds:YES];
      CGRect frame = mCaptureView.frame;
      [previewLayer setFrame:frame];
      [rootLayer insertSublayer:previewLayer atIndex:0];
  
      mCameraImageOutput = [[AVCaptureStillImageOutput alloc] init];
      NSDictionary *outputSettings = [[NSDictionary alloc] initWithObjectsAndKeys:AVVideoCodecJPEG, AVVideoCodecKey, nil];
      [mCameraImageOutput setOutputSettings:outputSettings];
  
  
      [mCameraAVSession addOutput:mCameraImageOutput];
  
      [mCameraAVSession startRunning];
  
      [self setVisible:mCaptureImage IsVisible:NO];
  }
  </code></pre>
  
  <p>Anybody said that it would be possible to adjust brightness with exposure, but I don't know how to use it. Especially, I want to adjust camera brightness when I pinch.</p>