Aila_ReleaseCamera
Take full control of device camera.
Signature
- Objective-C
- Swift
void Aila_ReleaseCamera(void (^onCompletion)(void));
func Aila_ReleaseCamera(_ onCompletion: @escaping () -> Void)
Parameters
onCompletion- Block/closure called when camera is ready to use
Description
Releases the Apple device camera from Aila SDK control for use cases where third-party SDKs or other non-Aila functions require control of the camera. This is an asynchronous call: the camera is not ready to use until the onCompletion block is invoked.
Because AVCaptureSession interacts with the main thread, this function should be called as an asynchronous operation off of the main thread to ensure deadlock does not occur.
Barcode scanning is disabled while Aila_ReleaseCamera() is in effect.
Usage
- Objective-C
- Swift
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
Aila_ReleaseCamera(^{
NSLog(@"Camera released and ready for use");
// Now you can use the camera for other purposes
[self setupCustomCameraSession];
});
});
DispatchQueue.global(qos: .default).async {
Aila_ReleaseCamera {
print("Camera released and ready for use")
// Now you can use the camera for other purposes
self.setupCustomCameraSession()
}
}
See Also
- Aila_RegainCamera - Relinquish camera control to Aila
- Aila_GetAVCaptureSession - Get AVCaptureSession reference