It is posible to open AVCaptureVideoPreviewLayer in the background of iOS8 Custom keyboard ? I tried with this code
AVCaptureSession *session = [[AVCaptureSession alloc] init];
AVCaptureDevice *videoDevice = [AVCaptureDevice defaultDeviceWithMediaType:AVMediaTypeVideo];
if (videoDevice)
{
NSError *error;
AVCaptureDeviceInput *videoInput = [AVCaptureDeviceInput deviceInputWithDevice:videoDevice error:&error];
if (!error)
{
if ([session canAddInput:videoInput])
{
[session addInput:videoInput];
AVCaptureVideoPreviewLayer *previewLayer = [AVCaptureVideoPreviewLayer layerWithSession:session];
previewLayer.frame = self.bounds;
NSLog(@"open %@",NSStringFromCGRect(self.bounds));
[self.camView.layer addSublayer:previewLayer];
[session startRunning];
}
}
}
It is ask for permission to use camera but not open camera in background of keyboard. Please help me. Thanks.