I am working on iOS-Cordova cross platform. I am accessing Camera API com.mbppower.camerapreview from github. I want to Zoom in and Zoom Out my camera and Want to capture image Through Native iOS Class , My Code is working for iPhone But not working for iPad.
AnyOne Please help ? My code is :-
const CGFloat pinchVelocityDeviderFactor = 1.0f;
AVCaptureDevice *device = [AVCaptureDevice defaultDeviceWithMediaType:AVMediaTypeVideo];
if (([pinchRecognizer state] == UIGestureRecognizerStateBegan) ||
([pinchRecognizer state] == UIGestureRecognizerStateChanged)) {
//Error Message.
NSError *error = nil;
static CGFloat vf;//MAX(1.0, MIN(desiredZoomFactor, self.videoDevice.videoZoomFactor));
if((1.0 <= pinchRecognizer.scale) && (2.5 >= pinchRecognizer.scale))
{
//Setting vf.
vf = 1.0 + pinchRecognizer.scale * pinchVelocityDeviderFactor;
//Get Return Value of lock configuraton.
BOOL bRet = [device lockForConfiguration:&error];
//Lock Configuration.
if(bRet)
{
//if(1.0 <= vf && vf <= 2.5)
//Set Zoom factor.
device.videoZoomFactor = vf;
//Unlock Device Configuration.
[device unlockForConfiguration];
}
}
}
My app become Crash for iPad.
'NSRangeException', reason: '*** -[AVCaptureVideoDevice setVideoZoomFactor:] - the passed videoZoomFactor 1.141650 out-of-range [1, activeFormat.videoMaxZoomFactor]'
Please help guys
Thanks