Aila_GetAVCaptureSession
Obtain reference to Aila's internal AVCaptureSession.
Signature
- Objective-C
- Swift
AVCaptureSession *Aila_GetAVCaptureSession(void);
func Aila_GetAVCaptureSession() -> AVCaptureSession
Returns
Reference to the internal AVCaptureSession used by Aila SDK.
Description
Obtains a reference to Aila's internal AVCaptureSession. Aila requires full control of the session, so user code must not modify the session or camera configuration in any way, except to add or remove additional capture outputs.
For example, it may be desirable to add an AVCaptureVideoPreviewLayer to the app's user interface in order to assist end-users in scanning.
Multi-Camera Support
If you would like to simultaneously utilize another camera (such as an iPad front camera for facial recognition), this session is compatible with multiple cameras. The use of this AVCaptureSession as an AVCaptureMultiCamSession is possible in iOS 13 or newer. Check the connections already being utilized and add your desired AVCaptureDevice if not already in use.
Usage
- Objective-C
- Swift
// Get the capture session
AVCaptureSession *session = Aila_GetAVCaptureSession();
// Add a preview layer to display camera feed
AVCaptureVideoPreviewLayer *previewLayer =
[AVCaptureVideoPreviewLayer layerWithSession:session];
previewLayer.videoGravity = AVLayerVideoGravityResizeAspectFill;
previewLayer.frame = self.view.bounds;
[self.view.layer addSublayer:previewLayer];
// Get the capture session
let session = Aila_GetAVCaptureSession()
// Add a preview layer to display camera feed
let previewLayer = AVCaptureVideoPreviewLayer(session: session)
previewLayer.videoGravity = .resizeAspectFill
previewLayer.frame = view.bounds
view.layer.addSublayer(previewLayer)
User code must not modify the configuration of this session even if Aila_ReleaseCamera() is in effect. Instead, another AVCaptureSession should be created.
See Also
- Aila_ReleaseCamera - Take full control of device camera
- Aila_RegainCamera - Relinquish camera control to Aila
- AilaCaptureView - Pre-built camera view with UI