獲取 AVCaptureSession
在獲取
- (AVCaptureDevice*)backCamera
{
NSArray*devices = [AVCaptureDevicedevicesWithMediaType:AVMediaTypeVideo];
for(AVCaptureDevice*deviceindevices) {
if(device.position==AVCaptureDevicePositionBack) {
returndevice;
}
}
returnnil;
}
[_avSessionbeginConfiguration];
_avSession.sessionPreset=AVCaptureSessionPreset640x480;
//通過capture對象創(chuàng)建輸入設(shè)備對象
NSError*error =nil;
_backCameraDevice= [selfbackCamera];
[_backCameraDevicelockForConfiguration:&error];
//_backCameraDevice.focusMode = AVCaptureFocusModeLocked;
[_backCameraDeviceunlockForConfiguration];
[_avSessioncommitConfiguration];
[_backCameraDevice setFocusModeLockedWithLensPosition:slider.value completionHandler:nil]; 此方法是設(shè)置對焦北秽,position為0到1宫莱;
[_backCameraDevicelockForConfiguration:&error];
_backCameraDevice.videoZoomFactor= sender.value; 此方法可以實現(xiàn)鏡頭放大縮小,最小為1.0
[_backCameraDeviceunlockForConfiguration];