![]() |
DeepAR iOS
v5.2.0
|
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>
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 | |
DeepAR * | deepAR |
The DeepAR instance. More... | |
ARView * | arview |
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. | |
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.
- (instancetype) init |
Initializes a new CameraController instance.
Initialization example:
- (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.
- (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.
- (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.
BOOL | audio If set to true, camera won't need to reinitialize when starting video recording. |
|
readwritenonatomicweak |
The ARView instance.
Must be set manually if using ARView. See init for more details.
|
readwritenonatomicweak |
|
readwritenonatomicassign |
The currently selected camera.
Options:
AVCaptureDevicePositionFront
Changing this parameter in real-time causes the preview to switch to the given camera device.