DeepAR iOS  v5.2.0
Instance Methods | Properties | List of all members
CameraController Class Reference

Helper class that wraps AVFoundation to handle camera-related logic like starting camera preview, choosing resolution, front or back camera, and video orientation. More...

#import <CameraController.h>

Inheritance diagram for CameraController:

Instance Methods

(instancetype) - init
 Initializes a new CameraController instance. More...
 
(void) - checkCameraPermission
 Checks camera permissions.
 
(void) - checkMicrophonePermission
 Checks microphone permissions.
 
(void) - startCamera
 Starts camera preview using AVFoundation. More...
 
(void) - startCameraWithAudio:
 Starts camera preview using AVFoundation. Allows to start microphone as well. More...
 
(void) - stopCamera
 Stops camera preview.
 
(void) - startAudio
 Starts capturing audio samples using AVFoundation. More...
 
(void) - stopAudio
 Stops capturing audio samples.
 

Properties

DeepARdeepAR
 The DeepAR instance. More...
 
ARViewarview
 The ARView instance. More...
 
AVCaptureDevicePosition position
 The currently selected camera. More...
 
AVCaptureSessionPreset preset
 Represents camera resolution currently used. Can be changed in real-time.
 
AVCaptureVideoOrientation videoOrientation
 Represents currently used video orientation. Should be called with right orientation when the device rotates.
 

Detailed Description

Helper class that wraps AVFoundation to handle camera-related logic like starting camera preview, choosing resolution, front or back camera, and video orientation.

CameraController works with both DeepAR and ARView implementations, just make sure to set one or the other as a property on CameraController instance. Check Github example for detailed usage example.

Method Documentation

◆ init

- (instancetype) init

Initializes a new CameraController instance.

Initialization example:

...
self.cameraController = [[CameraController alloc] init];
self.cameraController.deepAR = self.deepAR;
// or if using ARView
// self.cameraController.arview = self.arview;
[self.cameraController startCamera];
...
Helper class that wraps AVFoundation to handle camera-related logic like starting camera preview,...
Definition: CameraController.h:18
instancetype init()
Initializes a new CameraController instance.
void startCamera()
Starts camera preview using AVFoundation.

◆ startAudio

- (void) startAudio

Starts capturing audio samples using AVFoundation.

Checks permissions and asks if none has been given. Must be called if startVideoRecordingWithOutputWidth has been called with recordAudio parameter set to true.

◆ startCamera

- (void) startCamera

Starts camera preview using AVFoundation.

Checks camera permissions and asks if none has been given. If DeepAR started in rendering mode will render camera frames to the ARView.

◆ startCameraWithAudio:

- (void) startCameraWithAudio: (BOOL)  audio

Starts camera preview using AVFoundation. Allows to start microphone as well.

Checks camera permissions and asks if none has been given. Additionally, checks for microphone permissions if specified. If DeepAR started in rendering mode, it will render camera frames to the ARView.

Parameters
BOOLaudio If set to true, camera won't need to reinitialize when starting video recording.

Property Documentation

◆ arview

- (ARView*) arview
readwritenonatomicweak

The ARView instance.

Must be set manually if using ARView. See init for more details.

Deprecated:
This API is deprecated. Please assign the DeepAR instance on deepAR property instead.

◆ deepAR

- (DeepAR*) deepAR
readwritenonatomicweak

The DeepAR instance.

Must be set manually if using DeepAR. See init for more details.

◆ position

- (AVCaptureDevicePosition) position
readwritenonatomicassign

The currently selected camera.

Options:

  • AVCaptureDevicePositionBack
  • AVCaptureDevicePositionFront

    Changing this parameter in real-time causes the preview to switch to the given camera device.


The documentation for this class was generated from the following file: