![]() |
DeepAR iOS
v5.2.0
|
Main class for interacting with DeepAR engine. More...
#import <DeepAR.h>
Instance Methods | |
(void) | - setLicenseKey: |
Set the license key for your app. More... | |
(void) | - initializeWithWidth:height:window: |
Starts the engine initialization where the DeepAR will initialize in rendering mode. More... | |
(void) | - initialize |
Starts the engine initialization where the DeepAR will initialize in vision only mode. More... | |
(void) | - initializeOffscreenWithWidth:height: |
Starts the engine initialization for rendering in off-screen mode. More... | |
(UIView *) | - createARViewWithFrame: |
Starts the engine initialization where the DeepAR will initialize in rendering mode. More... | |
(BOOL) | - isVisionOnly |
Indicates if DeepAR has been initialized in the vision-only mode or not. More... | |
(void) | - setRenderingResolutionWithWidth:height: |
Changes the output resolution of the processed frames. More... | |
(void) | - shutdown |
Shuts down the DeepAR engine. More... | |
(UIView *) | - switchToRenderingToViewWithFrame: |
Returns new UIView in which DeepAR will render with a given frame size. More... | |
(void) | - switchToRenderingOffscreenWithWidth:height: |
Starts rendering in the off-screen buffer. More... | |
(void) | - changeLiveMode: |
An optimization method and it allows the user to indicate the DeepAR in which mode it should operate. More... | |
(void) | - resume |
Resumes the rendering if it was previously paused, otherwise doesn't do anything. | |
(void) | - pause |
Pauses the rendering. More... | |
(void) | - processFrame:mirror: |
Feed frame to DeepAR for processing. More... | |
(void) | - processFrame:mirror:timestamp: |
Feed frame to DeepAR for processing. More... | |
(void) | - processFrameAndReturn:outputBuffer:mirror: |
Feed frame to DeepAR for processing. More... | |
(void) | - enqueueCameraFrame:mirror: |
Same functionality as processFrame with CMSampleBufferRef as an input type for frame data which is more suitable if using camera frames via AVFoundation. More... | |
(void) | - enqueueAudioSample: |
Passes an audio sample to the DeepAR engine. More... | |
(void) | - setVideoRecordingOutputName: |
Sets the video recording file output name. More... | |
(void) | - setVideoRecordingOutputPath: |
Changes the output path for all video recordings during runtime after it is called. More... | |
(void) | - startVideoRecordingWithOutputWidth:outputHeight: |
Starts video recording of the ARView with given resolution. More... | |
(void) | - startVideoRecordingWithOutputWidth:outputHeight:subframe: |
Starts video recording of the ARView with given resolution. More... | |
(void) | - startVideoRecordingWithOutputWidth:outputHeight:subframe:videoCompressionProperties: |
Starts video recording of the ARView with given resolution. More... | |
(void) | - startVideoRecordingWithOutputWidth:outputHeight:subframe:videoCompressionProperties:recordAudio: |
Starts video recording of the ARView with given resolution. More... | |
(void) | - switchEffectWithSlot:path: |
Load a DeepAR Studio file as an effect/filter in the scene. More... | |
(void) | - switchEffectWithSlot:path:face: |
Load a DeepAR Studio file as an effect/filter in the scene. More... | |
(void) | - switchEffectWithSlot:path:face:targetGameObject: |
Load a DeepAR Studio file as an effect/filter in the scene. More... | |
(void) | - switchEffectWithSlot:data: |
Load contents of a DeepAR Studio file as an effect/filter in the scene. More... | |
(void) | - switchEffectWithSlot:data:face: |
Load contents of a DeepAR Studio file as an effect/filter in the scene. More... | |
(void) | - takeScreenshot |
Produces a snapshot of the current screen preview. More... | |
(void) | - finishVideoRecording |
Finishes the video recording. More... | |
(void) | - pauseVideoRecording |
Pauses video recording if it has been started beforehand. | |
(void) | - resumeVideoRecording |
Resumes video recording after it has been paused with pauseVideoRecording. | |
(void) | - enableAudioProcessing: |
Enables or disables audio pitch processing for video recording. More... | |
(void) | - setAudioProcessingSemitone: |
Sets the pitch change amount. More... | |
(void) | - startCaptureWithOutputWidth:outputHeight:subframe: |
Enables frameAvailable method callback. More... | |
(void) | - startCaptureWithOutputWidthAndFormat:outputHeight:subframe:outputImageFormat: |
Enables frameAvailable method callback. More... | |
(void) | - stopCapture |
Stops outputting frames to frameAvailable . | |
(void) | - fireTrigger: |
Fire named trigger of an fbx animation set on the currently loaded effect. More... | |
(void) | - touchOccurred: |
Informs DeepAR that a touch with was detected. | |
(void) | - showStats: |
Display debugging stats on screen. More... | |
(void) | - simulatePhysics: |
Enable or disable global physics simulation. More... | |
(void) | - showColliders: |
Display physics colliders preview on screen. More... | |
(void) | - setFaceDetectionSensitivity: |
This method allows the user to change face detection sensitivity. More... | |
(void) | - changeParameter:component:parameter:floatValue: |
Changes a node or component float parameter. More... | |
(void) | - changeParameter:component:parameter:vectorValue: |
Changes a node or component 4D vector parameter. More... | |
(void) | - changeParameter:component:parameter:vector3Value: |
Changes a node or component 3D vector parameter. More... | |
(void) | - changeParameter:component:parameter:boolValue: |
Changes a node or component boolean parameter. More... | |
(void) | - changeParameter:component:parameter:image: |
Changes a node or component image parameter. More... | |
(void) | - changeParameter:component:parameter:stringValue: |
Changes a node or component string parameter. More... | |
(void) | - moveGameObject:targetGameObjectname: |
Moves the selected game object from its current position in a tree and sets it as a direct child of a target game object. More... | |
(void) | - startProfiling |
Starts recording profiling stats by writing them to a CSV-formatted stream. | |
(void) | - stopProfiling |
Stops recording profiling stats and sends the recorded CSV to the stat export server. | |
(void) | - setFaceTrackingInitParameters: |
Set parameters that will determine how the face tracking is initialized. More... | |
(bool) | - hasVar:slot: |
Check if variable with the given name is already created in the specified effect. More... | |
(bool) | - hasVar: |
Check if variable with the given name is already created in at least one effect. More... | |
(VarType) | - getVarType:slot: |
Get the type of the variable with the given name in the specified effect. More... | |
(VarType) | - getVarType: |
Get the type of the variable with the given name. The variable is searched in all effects. More... | |
(bool) | - getBoolVar:slot: |
Get boolean variable with the given name. More... | |
(bool) | - getBoolVar: |
(int) | - getIntVar:slot: |
Get integer variable with the given name. More... | |
(int) | - getIntVar: |
Get integer variable with the given name. The variable is searched in all effects. More... | |
(double) | - getDoubleVar:slot: |
Get double variable with the given name. More... | |
(double) | - getDoubleVar: |
Get double variable with the given name. The variable is searched in all effects. More... | |
(NSString *) | - getStringVar:slot: |
Get string variable with the given name. More... | |
(NSString *) | - getStringVar: |
Get string variable with the given name. The variable is searched in all effects. More... | |
(bool) | - setBoolVar:value:slot: |
Set the boolean variable wih the given name. More... | |
(bool) | - setBoolVar:value: |
Set the boolean variable with the given name. The variable is set globally, for all effects. More... | |
(bool) | - setIntVar:value:slot: |
Set the int variable wih the given name. More... | |
(bool) | - setIntVar:value: |
Set the int variable with the given name. The variable is set globally, for all effects. More... | |
(bool) | - setDoubleVar:value:slot: |
Set the double variable wih the given name. More... | |
(bool) | - setDoubleVar:value: |
Set the double variable with the given name. The variable is set globally, for all effects. More... | |
(bool) | - setStringVar:value:slot: |
Set the string variable wih the given name. More... | |
(bool) | - setStringVar:value: |
Set the string variable with the given name. The variable is set globally, for all effects. More... | |
(bool) | - deleteVar:slot: |
Delete the variable with the given name. More... | |
(bool) | - deleteVar: |
Delete the variable with the given name. The variable is searched in all effects. More... | |
(bool) | - clearVars: |
Clear all variables or variables from the specified effect. More... | |
(bool) | - clearVars |
Clear all variables. More... | |
Class Methods | |
(NSString *) | + sdkVersion |
The DeepAR SDK version number. More... | |
Properties | |
id< DeepARDelegate > | delegate |
The object which implements DeepARDelegate protocol to listen for async events coming from DeepAR. | |
BOOL | visionInitialized |
Indicates if computer vision components have been initialized during the initialization process. | |
BOOL | renderingInitialized |
Indicates if DeepAR rendering components have been initialized during the initialization process. | |
BOOL | faceVisible |
Indicates if at least one face is detected in the current frame. | |
CGSize | renderingResolution |
Rendering resolution with which the DeepAR has been initialized. | |
BOOL | videoRecordingWarmupEnabled |
If set to true, changes how startVideoRecording and resumeVideoRecording methods work to allow the video recording to be started immediately during runtime. More... | |
NSDictionary * | audioCompressionSettings |
The audio compression settings. | |
Main class for interacting with DeepAR engine.
You need to create an instance of this class to interact with DeepAR. DeepAR can work in vision only or rendering mode. Vision only means only computer vision functionalities (like FaceData of detected faces etc.) are available and no rendering. Rendering mode means that result of DeepAR processing will be rendered live in the UI. Different initialization methods are used for each mode.
- (void) changeLiveMode: | (BOOL) | liveMode |
An optimization method and it allows the user to indicate the DeepAR in which mode it should operate.
If called with true value, DeepAR will expect a continuous flow of new frames and it will optimize its inner processes for such workload. An example of this is the typical use case of processing the frames from the camera stream.
If called with false it will optimize for preserving resources and memory by pausing the rendering after each processed frame. A typical use case for this is when the user needs to process just one image. In that case, the user will feed the image to DeepAR by calling processFrame or similar method, and DeepAR would process it and stop rendering until a new frame is received. If we did so when the DeepAR is in live mode, it would process the same frame over and over again without ever stopping the rendering process, thus wasting processing time.
BOOL | liveMode Enable or disable live mode. |
- (void) changeParameter: | (NSString *) | gameObject | |
component: | (NSString *) | component | |
parameter: | (NSString *) | parameter | |
boolValue: | (BOOL) | value | |
Changes a node or component boolean parameter.
For more details about changeParameter API read our article here.
NSString* | gameObject The name of the node. If multiple nodes share the same name, only the first one will be affected. |
NSString* | component The name of the component. If the name of the component is null or an empty string, the node itself will be affected. |
NSString* | parameter The name of the parameter. |
BOOL | value New parameter value. |
- (void) changeParameter: | (NSString *) | gameObject | |
component: | (NSString *) | component | |
parameter: | (NSString *) | parameter | |
floatValue: | (float) | value | |
Changes a node or component float parameter.
For more details about changeParameter API read our article here.
NSString* | gameObject The name of the node. If multiple nodes share the same name, only the first one will be affected. |
NSString* | component The name of the component. If the name of the component is null or an empty string, the node itself will be affected. |
NSString* | parameter The name of the parameter. |
float | value New parameter value. |
- (void) changeParameter: | (NSString *) | gameObject | |
component: | (NSString *) | component | |
parameter: | (NSString *) | parameter | |
image: | (UIImage *) | image | |
Changes a node or component image parameter.
For more details about changeParameter API read our article here.
NSString* | gameObject The name of the node. If multiple nodes share the same name, only the first one will be affected. |
NSString* | component The name of the component. If the name of the component is null or an empty string, the node itself will be affected. |
NSString* | parameter The name of the parameter. |
UIImage* | image New image parameter. |
- (void) changeParameter: | (NSString *) | gameObject | |
component: | (NSString *) | component | |
parameter: | (NSString *) | parameter | |
stringValue: | (NSString *) | value | |
Changes a node or component string parameter.
For more details about changeParameter API read our article here.
NSString* | gameObject The name of the node. If multiple nodes share the same name, only the first one will be affected. |
NSString* | component The name of the component. If the name of the component is null or an empty string, the node itself will be affected. |
NSString* | parameter The name of the parameter. |
NSString* | value New parameter value. |
- (void) changeParameter: | (NSString *) | gameObject | |
component: | (NSString *) | component | |
parameter: | (NSString *) | parameter | |
vector3Value: | (Vector3) | value | |
Changes a node or component 3D vector parameter.
For more details about changeParameter API read our article here.
NSString* | gameObject The name of the node. If multiple nodes share the same name, only the first one will be affected. |
NSString* | component The name of the component. If the name of the component is null or an empty string, the node itself will be affected. |
NSString* | parameter The name of the parameter. |
Vector3 | value New parameter value. |
- (void) changeParameter: | (NSString *) | gameObject | |
component: | (NSString *) | component | |
parameter: | (NSString *) | parameter | |
vectorValue: | (Vector4) | value | |
Changes a node or component 4D vector parameter.
For more details about changeParameter API read our article here.
NSString* | gameObject The name of the node. If multiple nodes share the same name, only the first one will be affected. |
NSString* | component The name of the component. If the name of the component is null or an empty string, the node itself will be affected. |
NSString* | parameter The name of the parameter. |
Vector4 | value New parameter value. |
- (bool) clearVars |
Clear all variables.
- (bool) clearVars: | (NSString *) | slot |
Clear all variables or variables from the specified effect.
NSString* | slot The ID of the effect in which to search the variable. |
- (UIView *) createARViewWithFrame: | (CGRect) | frame |
Starts the engine initialization where the DeepAR will initialize in rendering mode.
This means users can use the rendering functionality of DeepAR, in addition to computer vision features, to load effects in the scene, render the frames in the UI, etc. This method returns an UIView on which surface the frames will be rendered. Internally this method uses initializeWithWidth , which means the rendering resolution and the size of the view will be the size of the provided frame.
CGRect | frame The view dimensions. |
- (bool) deleteVar: | (NSString *) | name |
Delete the variable with the given name. The variable is searched in all effects.
NSString* | name The variable name. |
- (bool) deleteVar: | (NSString *) | name | |
slot: | (NSString *) | slot | |
Delete the variable with the given name.
NSString* | name The variable name. |
NSString* | slot The slot of the effect in which to search the variable. |
- (void) enableAudioProcessing: | (BOOL) | enabled |
Enables or disables audio pitch processing for video recording.
BOOL | enabled Enable or disable audio processing. |
- (void) enqueueAudioSample: | (CMSampleBufferRef) | sampleBuffer |
Passes an audio sample to the DeepAR engine.
Used in video recording when user wants to record audio too. Audio samples will be processed only if the startVideoRecordingWithOutputWidth method has been called with recordAudio parameter set to true.
CMSampleBufferRef | sampleBuffer The sample buffer. |
- (void) enqueueCameraFrame: | (CMSampleBufferRef) | sampleBuffer | |
mirror: | (BOOL) | mirror | |
Same functionality as processFrame with CMSampleBufferRef as an input type for frame data which is more suitable if using camera frames via AVFoundation.
It is advised to use this method instead of processFrame when using camera frames as input because it will use native textures to fetch frames from the iPhone camera more efficiently.
CMSampleBufferRef | sampleBuffer The sample buffer. |
BOOL | mirror Indicates whether the image should be flipped vertically before processing (front/back camera). |
- (void) finishVideoRecording |
Finishes the video recording.
Delegate method didFinishVideoRecording will be called when the recording is done with the temporary path of the recorded video.
- (void) fireTrigger: | (NSString *) | trigger |
Fire named trigger of an fbx animation set on the currently loaded effect.
To learn more about fbx and image sequence animations on DeepAR please read our article here.
NSString* | trigger The trigger name. |
- (bool) getBoolVar: | (NSString *) | name |
@brieg Get boolean variable with the given name. The variable is searched in all effects.
NSString* | name The variable name. |
NSException | Variable with the specified name does not exist or is not a boolean. |
- (bool) getBoolVar: | (NSString *) | name | |
slot: | (NSString *) | slot | |
Get boolean variable with the given name.
NSString* | name The variable name. |
NSString* | slot The slot of the effect in which to search the variable. |
NSException | Variable with the specified name does not exist or is not a boolean. |
- (double) getDoubleVar: | (NSString *) | name |
Get double variable with the given name. The variable is searched in all effects.
NSString* | name The variable name. |
NSException | Variable with the specified name does not exist or is not a double. |
- (double) getDoubleVar: | (NSString *) | name | |
slot: | (NSString *) | slot | |
Get double variable with the given name.
NSString* | name The variable name. |
NSString* | slot The slot of the effect in which to search the variable. |
NSException | Variable with the specified name does not exist or is not a double. |
- (int) getIntVar: | (NSString *) | name |
Get integer variable with the given name. The variable is searched in all effects.
NSString* | name The variable name. |
NSException | Variable with the specified name does not exist or is not an int. |
- (int) getIntVar: | (NSString *) | name | |
slot: | (NSString *) | slot | |
Get integer variable with the given name.
NSString* | name The variable name. |
NSString* | slot The slot of the effect in which to search the variable. |
NSException | Variable with the specified name does not exist or is not an int. |
- (NSString *) getStringVar: | (NSString *) | name |
Get string variable with the given name. The variable is searched in all effects.
NSString* | name The variable name. |
NSException | Variable with the specified name does not exist or is not a string. |
- (NSString *) getStringVar: | (NSString *) | name | |
slot: | (NSString *) | slot | |
Get string variable with the given name.
NSString* | name The variable name. |
NSString* | slot The slot of the effect in which to search the variable. |
NSException | Variable with the specified name does not exist or is not a string. |
- (VarType) getVarType: | (NSString *) | name |
Get the type of the variable with the given name. The variable is searched in all effects.
NSString* | name The variable name. |
NSException | Variable with the specified name does not exist. |
- (VarType) getVarType: | (NSString *) | name | |
slot: | (NSString *) | slot | |
Get the type of the variable with the given name in the specified effect.
NSString* | name The variable name. |
NSString* | slot The slot of the effect in which to search the variable. |
NSException | Variable with the specified name does not exist. |
- (bool) hasVar: | (NSString *) | name |
Check if variable with the given name is already created in at least one effect.
NSString* | name The variable name. |
- (bool) hasVar: | (NSString *) | name | |
slot: | (NSString *) | slot | |
Check if variable with the given name is already created in the specified effect.
NSString* | name The variable name. |
NSString* | slot The slot of the effect in which to search the variable. |
- (void) initialize |
Starts the engine initialization where the DeepAR will initialize in vision only mode.
Vision only means that it will process frames in terms of detecting faces and their properties that are available in FaceData object. No rendering will be available in this mode.
- (void) initializeOffscreenWithWidth: | (NSInteger) | width | |
height: | (NSInteger) | height | |
Starts the engine initialization for rendering in off-screen mode.
NSInteger | width The rendering width. |
NSInteger | height The rendering height. |
- (void) initializeWithWidth: | (NSInteger) | width | |
height: | (NSInteger) | height | |
window: | (CAEAGLLayer *) | window | |
Starts the engine initialization where the DeepAR will initialize in rendering mode.
This means users can use the rendering functionality of DeepAR, in addition to computer vision features, to load effects in the scene, render the frames in the UI, etc.
NSInteger | width The rendering width. |
NSInteger | height The rendering height. |
CAEAGLLayer* | window Destination layer where the DeepAR engine will render the frames. |
- (BOOL) isVisionOnly |
Indicates if DeepAR has been initialized in the vision-only mode or not.
- (void) moveGameObject: | (NSString *) | selectedGameObjectName | |
targetGameObjectname: | (NSString *) | targetGameObjectName | |
Moves the selected game object from its current position in a tree and sets it as a direct child of a target game object.
This is equivalent to moving around a node in the node hierarchy in the DeepAR Studio.
NSString* | selectedGameObjectName Node to move. |
NSString* | targetGameObjectName New node parent. |
- (void) pause |
Pauses the rendering.
This method will not release any resources and should be used only for temporary pause (e.g. user goes to the next screen). Use the shutdown method to stop the engine and to release the resources.
- (void) processFrame: | (CVPixelBufferRef) | imageBuffer | |
mirror: | (BOOL) | mirror | |
Feed frame to DeepAR for processing.
The result can be received in the frameAvailable delegate method.
CVPixelBufferRef | imageBuffer The input image data that needs processing. |
BOOL | mirror Indicates whether the image should be flipped vertically before processing (front/back camera). |
- (void) processFrame: | (CVPixelBufferRef) | imageBuffer | |
mirror: | (BOOL) | mirror | |
timestamp: | (CMTimeValue) | timestamp | |
Feed frame to DeepAR for processing.
The result can be received in the frameAvailable delegate method.
CVPixelBufferRef | imageBuffer The input image data that needs processing. |
BOOL | mirror Indicates whether the image should be flipped vertically before processing (front/back camera). |
CMTimeValue | timestamp The frame timestamp. |
- (void) processFrameAndReturn: | (CVPixelBufferRef) | imageBuffer | |
outputBuffer: | (CVPixelBufferRef) | outputBuffer | |
mirror: | (BOOL) | mirror | |
Feed frame to DeepAR for processing.
Outputs the result in the outputBuffer parameter. Requires frame capturing to be started (user must call startCaptureWithOutputWidth or startCaptureWithOutputWidthAndFormat beforehand).
CVPixelBufferRef | imageBuffer The input image data that needs processing. |
CVPixelBufferRef | outputBuffer The output image buffer. |
BOOL | mirror Indicates whether the image should be flipped vertically before processing (front/back camera). |
+ (NSString *) sdkVersion |
The DeepAR SDK version number.
- (void) setAudioProcessingSemitone: | (float) | sts |
Sets the pitch change amount.
Negative values will make the recorded audio lower in pitch and positive values will make it higher in pitch. Must call enableAudioProcessing to enable the pitch processing beforehand.
float | sts The pitch change amount. |
- (bool) setBoolVar: | (NSString *) | name | |
value: | (bool) | value | |
Set the boolean variable with the given name. The variable is set globally, for all effects.
NSString* | name The variable name. |
bool | value Value to be set. |
- (bool) setBoolVar: | (NSString *) | name | |
value: | (bool) | value | |
slot: | (NSString *) | slot | |
Set the boolean variable wih the given name.
NSString* | name The variable name. |
NSString* | slot The slot of the effect in which to search the variable. |
bool | value Value to be set. |
- (bool) setDoubleVar: | (NSString *) | name | |
value: | (double) | value | |
Set the double variable with the given name. The variable is set globally, for all effects.
NSString* | name The variable name. |
double | value Value to be set. |
- (bool) setDoubleVar: | (NSString *) | name | |
value: | (double) | value | |
slot: | (NSString *) | slot | |
Set the double variable wih the given name.
NSString* | name The variable name. |
NSString* | slot The slot of the effect in which to search the variable. |
double | value Value to be set. |
- (void) setFaceDetectionSensitivity: | (NSInteger) | sensitivity |
This method allows the user to change face detection sensitivity.
NSInteger | sensitivity The sensitivity parameter can range from 0 to 3, where 0 is the fastest but might not recognize smaller (further away) faces, and 3 is the slowest but will find smaller faces. By default, this parameter is set to 1. |
- (void) setFaceTrackingInitParameters: | (FaceTrackingInitParameters) | params |
Set parameters that will determine how the face tracking is initialized.
params | FaceTrackingInitParameters |
- (bool) setIntVar: | (NSString *) | name | |
value: | (int) | value | |
Set the int variable with the given name. The variable is set globally, for all effects.
NSString* | name The variable name. |
int | value Value to be set. |
- (bool) setIntVar: | (NSString *) | name | |
value: | (int) | value | |
slot: | (NSString *) | slot | |
Set the int variable wih the given name.
NSString* | name The variable name. |
NSString* | slot The slot of the effect in which to search the variable. |
int | value Value to be set. |
- (void) setLicenseKey: | (NSString *) | key |
Set the license key for your app.
The license key is generated on the DeepAR Developer portal. Here are steps on how to generate a license key:
Copy the newly generated license key as a parameter in this method
You must call this method before you call the initialize.
NSString* | key The license key. |
- (void) setRenderingResolutionWithWidth: | (NSInteger) | width | |
height: | (NSInteger) | height | |
Changes the output resolution of the processed frames.
Can be called any time.
NSInteger | width The output resolution width. |
NSInteger | height The output resolution height. |
- (bool) setStringVar: | (NSString *) | name | |
value: | (NSString *) | value | |
Set the string variable with the given name. The variable is set globally, for all effects.
NSString* | name The variable name. |
NSString* | value Value to be set. |
- (bool) setStringVar: | (NSString *) | name | |
value: | (NSString *) | value | |
slot: | (NSString *) | slot | |
Set the string variable wih the given name.
NSString* | name The variable name. |
NSString* | slot The slot of the effect in which to search the variable. |
NSString* | value Value to be set. |
- (void) setVideoRecordingOutputName: | (NSString *) | outputName |
Sets the video recording file output name.
The argument is file name only, no extension. The file extension .mov will be appended automatically. Defalut value is "export".
NSString* | outputName Output file name without the extension. |
- (void) setVideoRecordingOutputPath: | (NSString *) | outputPath |
Changes the output path for all video recordings during runtime after it is called.
The argument is path only, no name. The defalut value is the AppData Documents folder. Example:
NSString* | outputPath Output video file path. |
- (void) showColliders: | (BOOL) | enabled |
Display physics colliders preview on screen.
BOOL | enabled Enable physics colliders preview. |
- (void) showStats: | (BOOL) | enabled |
Display debugging stats on screen.
BOOL | enabled Enable debugging stats. |
- (void) shutdown |
Shuts down the DeepAR engine.
Reinitialization of a new DeepAR instance which has not been properly shut down can cause crashes and memory leaks. Usually, it is done in view controller dealloc method.
- (void) simulatePhysics: | (BOOL) | enabled |
Enable or disable global physics simulation.
BOOL | enabled Enable global physics simulation. |
- (void) startCaptureWithOutputWidth: | (NSInteger) | outputWidth | |
outputHeight: | (NSInteger) | outputHeight | |
subframe: | (CGRect) | subframe | |
Enables frameAvailable method callback.
By default DeepARDelegate will not call frameAvailable method on each new processed frame to save on processing time and resources. If we want the processed frames to be available in frameAvailable method of DeepARDelegate we need to call this method first on DeepAR.
NSInteger | outputWidth The width of the processed frames. |
NSInteger | outputHeight The height of the processed frames. |
CGRect | subframe The subrectangle of ARView which will be outputted. This means that the output frame in frameAvailable does not need to be the same size and/or position as the one rendered to the ARView. |
- (void) startCaptureWithOutputWidthAndFormat: | (NSInteger) | outputWidth | |
outputHeight: | (NSInteger) | outputHeight | |
subframe: | (CGRect) | subframe | |
outputImageFormat: | (OutputFormat) | outputFormat | |
Enables frameAvailable method callback.
By default DeepARDelegate will not call frameAvailable method on each new processed frame to save on processing time and resources. If we want the processed frames to be available in frameAvailable method of DeepARDelegate we need to call this method first on DeepAR.
NSInteger | outputWidth The width of the processed frames. |
NSInteger | outputHeight The height of the processed frames. |
CGRect | subframe The subrectangle of ARView which will be outputted. This means that the output frame in frameAvailable does not need to be the same size and/or position as the one rendered to the ARView. |
OutputFormat | outputFormat Parameter for user to control the pixel output format of frameAvailable method |
- (void) startVideoRecordingWithOutputWidth: | (int) | outputWidth | |
outputHeight: | (int) | outputHeight | |
Starts video recording of the ARView with given resolution.
int | outputWidth The output width. |
int | outputHeight The output height. |
- (void) startVideoRecordingWithOutputWidth: | (int) | outputWidth | |
outputHeight: | (int) | outputHeight | |
subframe: | (CGRect) | subframe | |
- (void) startVideoRecordingWithOutputWidth: | (int) | outputWidth | |
outputHeight: | (int) | outputHeight | |
subframe: | (CGRect) | subframe | |
videoCompressionProperties: | (NSDictionary *) | videoCompressionProperties | |
Starts video recording of the ARView with given resolution.
int | outputWidth The output width. |
int | outputHeight The output height. |
CGRect | subframe The subframe parameter defines the sub rectangle of the ARView that you want to record in normalized coordinates (0.0 - 1.0). |
NSDictionary* | videoCompressionProperties The videoCompressionProperties is an NSDictionary used as the value for the key AVVideoCompressionPropertiesKey. Read more about video compression options in the official docs here. |
- (void) startVideoRecordingWithOutputWidth: | (int) | outputWidth | |
outputHeight: | (int) | outputHeight | |
subframe: | (CGRect) | subframe | |
videoCompressionProperties: | (NSDictionary *) | videoCompressionProperties | |
recordAudio: | (BOOL) | recordAudio | |
Starts video recording of the ARView with given resolution.
int | outputWidth The output width. |
int | outputHeight The output height. |
CGRect | subframe The subframe parameter defines the sub rectangle of the ARView that you want to record in normalized coordinates (0.0 - 1.0). |
NSDictionary* | videoCompressionProperties The videoCompressionProperties is an NSDictionary used as the value for the key AVVideoCompressionPropertiesKey. Read more about video compression options in the official docs here. |
BOOL | recordAudio If recordAudio parameter is set to true the recording will wait until you call enqueueAudioSample . When DeepAR is ready to receive audio samples it will publish NSNotification with key deepar_start_audio. You can subscribe to this notification and start feeding audio samples once you receive it. If you use provided CameraController this is handled for you by default. |
- (void) switchEffectWithSlot: | (NSString *) | slot | |
data: | (NSData *) | data | |
Load contents of a DeepAR Studio file as an effect/filter in the scene.
NSString* | slot The slot specifies a namespace for the effect in the scene. In each slot, there can be only one effect. If you load another effect in the same slot the previous one will be removed and replaced with a new effect. |
NSData* | data The contents of the file. |
- (void) switchEffectWithSlot: | (NSString *) | slot | |
data: | (NSData *) | data | |
face: | (NSInteger) | face | |
Load contents of a DeepAR Studio file as an effect/filter in the scene.
NSString* | slot The slot specifies a namespace for the effect in the scene. In each slot, there can be only one effect. If you load another effect in the same slot the previous one will be removed and replaced with a new effect. |
NSData* | data The contents of the file. |
NSInteger | face The face parameter indicates on which face to apply the effect. DeepAR offers tracking up to 4 faces, so valid values for this parameter are 0, 1, 2, and 3. For example, if you call this method with face value 2, the effect will be only applied to the third detected face in the scene. If you want to set an effect on a different face make sure to also use a different value for the slot parameter to avoid removing the previously added effect. |
- (void) switchEffectWithSlot: | (NSString *) | slot | |
path: | (NSString *) | path | |
Load a DeepAR Studio file as an effect/filter in the scene.
NSString* | slot The slot specifies a namespace for the effect in the scene. In each slot, there can be only one effect. If you load another effect in the same slot the previous one will be removed and replaced with a new effect. Example of loading 2 effects in the same scene: [self.deepAR switchEffectWithSlot:@"mask" path:"flowers"];
[self.deepAR switchEffectWithSlot:@"filter" path:"tv80"];
|
NSString* | path The path is a string path to a file located in the app bundle or anywhere in the filesystem where the app has access to. For example, one can download the filters from online locations and save them in the Documents directory. Value nil for the path param will remove the effect from the scene. |
- (void) switchEffectWithSlot: | (NSString *) | slot | |
path: | (NSString *) | path | |
face: | (NSInteger) | face | |
Load a DeepAR Studio file as an effect/filter in the scene.
NSString* | slot The slot specifies a namespace for the effect in the scene. In each slot, there can be only one effect. If you load another effect in the same slot the previous one will be removed and replaced with a new effect. |
NSString* | path The path is a string path to a file located in the app bundle or anywhere in the filesystem where the app has access to. For example, one can download the filters from online locations and save them in the Documents directory. Value nil for the path param will remove the effect from the scene. |
NSInteger | face The face parameter indicates on which face to apply the effect. DeepAR offers tracking up to 4 faces, so valid values for this parameter are 0, 1, 2, and 3. For example, if you call this method with face value 2, the effect will be only applied to the third detected face in the scene. If you want to set an effect on a different face make sure to also use a different value for the slot parameter to avoid removing the previously added effect. Example: // apply flowers effect to the first face
[self.deepAR switchEffectWithSlot:@"mask_f0" path:"flowers" face:0];
// apply beard effect to the second face
[self.deepAR switchEffectWithSlot:@"mask_f1" path:"beard" face:1];
// replace the effect on the first face with the lion
[self.deepAR switchEffectWithSlot:@"mask_f0" path:"lion" face:0];
// remove the beard effect from the second face
[self.deepAR switchEffectWithSlot:@"mask_f1" path:nil face:1];
|
- (void) switchEffectWithSlot: | (NSString *) | slot | |
path: | (NSString *) | path | |
face: | (NSInteger) | face | |
targetGameObject: | (NSString *) | targetGameObject | |
Load a DeepAR Studio file as an effect/filter in the scene.
NSString* | slot The slot specifies a namespace for the effect in the scene. In each slot, there can be only one effect. If you load another effect in the same slot the previous one will be removed and replaced with a new effect. |
NSString* | path The path is a string path to a file located in the app bundle or anywhere in the filesystem where the app has access to. For example, one can download the filters from online locations and save them in the Documents directory. Value nil for the path param will remove the effect from the scene. |
NSInteger | face The face parameter indicates on which face to apply the effect. DeepAR offers tracking up to 4 faces, so valid values for this parameter are 0, 1, 2, and 3. For example, if you call this method with face value 2, the effect will be only applied to the third detected face in the scene. If you want to set an effect on a different face make sure to also use a different value for the slot parameter to avoid removing the previously added effect. |
NSString* | targetGameObject The targetGameObject parameter indicates a node in the currently loaded scene/effect into which the new effect will be loaded. By default, effects are loaded in the root node object. |
- (void) switchToRenderingOffscreenWithWidth: | (NSInteger) | width | |
height: | (NSInteger) | height | |
Starts rendering in the off-screen buffer.
Does nothing if already rendering in off-screen mode. Internally calls startCaptureWithOutputWidth method meaning the frames will be available in the frameAvailable method as soon as they are ready.
NSInteger | width The buffer width. |
NSInteger | height The buffer height. |
- (UIView *) switchToRenderingToViewWithFrame: | (CGRect) | frame |
- (void) takeScreenshot |
Produces a snapshot of the current screen preview.
Resolution is equal to the dimension with which the DeepAR has been initialized. The DeepARDelegate method didTakeScreenshot will be called upon successful screenshot capture is finished with a path where the image has been temporarily stored.
|
readwritenonatomicassign |
If set to true, changes how startVideoRecording and resumeVideoRecording methods work to allow the video recording to be started immediately during runtime.
To use video recodring warmup follow these steps