Skip to content

Latest commit

 

History

History
 
 

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 

README.md

Objective-C Example

This folder provides you an example project written in Objective-C that demonstrates the use of ARVideoKit framework.

Implementation

  1. Import the ARVideoKit into the application delegate implementation file AppDelegate.m and a UIViewController class with an ARKit scene.
@import ARVideoKit;
  1. In the application delegate implementation file AppDelegate.m, add this 👇 in order to allow the framework access and identify the supported device orientations. Recommended if the application supports landscape orientations.
-(UIInterfaceOrientationMask)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window {
return ViewAR.orientation;
}
  1. In the selected UIViewController class, create a RecordAR global variable by adding the following in the interface section of the implementation file (e.g ViewController.m).
@interface ViewController ()
{
    RecordAR *recorder;
}
  1. Initialize RecordAR with ARSCNView or ARSKView. Recommended to initialize in (void)viewDidLoad.

Initializing RecordAR with ARSCNView

recorder = [[RecordAR alloc] initWithARSceneKit:self.sceneView];

Initializing RecordAR with ARSKView

recorder = [[RecordAR alloc] initWithARSpriteKit:self.SKSceneView];
  1. Call the prepare() method in (void)viewWillAppear:(BOOL)animated
ARWorldTrackingConfiguration *configuration = [ARWorldTrackingConfiguration new];
[recorder prepare:configuration];
  1. Call the rest() method in (void)viewWillDisappear:(BOOL)animated
[recorder rest];
  1. Call the record() method in the proper method to start recording.
- (IBAction)startRecording:(UIButton *)sender {
    if (recorder.status == RecordARStatusReadyToRecord) {
        [recorder record];
    }
}
  1. Call the stopAndExport() method in the proper method to stop recording.
- (IBAction)stopRecording:(UIButton *)sender {
    if (recorder.status == RecordARStatusRecording) {
        [recorder stopAndExport:NULL];
    }
}