This folder provides you an example project written in Swift that demonstrates the use of ARVideoKit framework.
-
import ARVideoKitin the application delegateAppDelegate.swiftand aUIViewControllerwith anARKitscene. -
In the application delegate
AppDelegate.swift, add this 👇 in order to allow the framework access and identify the supported device orientations. Recommended if the application supports landscape orientations.
func application(_ application: UIApplication, supportedInterfaceOrientationsFor window: UIWindow?) -> UIInterfaceOrientationMask {
return ViewAR.orientation
}
- In the selected
UIViewControllerclass, create an optional typeRecordARglobal variable.
var recorder:RecordAR?
Initializing RecordAR with ARSCNView
recorder = RecordAR(ARSceneKit: sceneView)
Initializing RecordAR with ARSKView
recorder = RecordAR(ARSpriteKit: SKSceneView)
- Call the
prepare()method inviewWillAppear(_ animated: Bool)
let configuration = ARWorldTrackingConfiguration()
recorder?.prepare(configuration)
- Call the
rest()method inviewWillDisappear(_ animated: Bool)
recorder?.rest()
- Call the
record()method in the proper method to start recording.
@IBAction func startRecording(_ sender: UIButton) {
recorder?.record()
}
- Call the
stopAndExport()method in the proper method to stop recording.
@IBAction func stopRecording(_ sender: UIButton) {
recorder?.stopAndExport()
}