This folder provides you an example project written in Objective-C that demonstrates the use of ARVideoKit framework.
- Import the
ARVideoKitinto the application delegate implementation fileAppDelegate.mand aUIViewControllerclass with anARKitscene.
@import ARVideoKit;
- 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;
}
- In the selected
UIViewControllerclass, create aRecordARglobal variable by adding the following in the interface section of the implementation file (e.gViewController.m).
@interface ViewController ()
{
RecordAR *recorder;
}
Initializing RecordAR with ARSCNView
recorder = [[RecordAR alloc] initWithARSceneKit:self.sceneView];
Initializing RecordAR with ARSKView
recorder = [[RecordAR alloc] initWithARSpriteKit:self.SKSceneView];
- Call the
prepare()method in(void)viewWillAppear:(BOOL)animated
ARWorldTrackingConfiguration *configuration = [ARWorldTrackingConfiguration new];
[recorder prepare:configuration];
- Call the
rest()method in(void)viewWillDisappear:(BOOL)animated
[recorder rest];
- Call the
record()method in the proper method to start recording.
- (IBAction)startRecording:(UIButton *)sender {
if (recorder.status == RecordARStatusReadyToRecord) {
[recorder record];
}
}
- Call the
stopAndExport()method in the proper method to stop recording.
- (IBAction)stopRecording:(UIButton *)sender {
if (recorder.status == RecordARStatusRecording) {
[recorder stopAndExport:NULL];
}
}