Skip to main content

Aila_GetAVCaptureSession

Obtain reference to Aila's internal AVCaptureSession.

Signature

AVCaptureSession *Aila_GetAVCaptureSession(void);

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

// 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];
warning

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