Skip to content

Latest commit

 

History

History
 
 

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 

README.md

Swift Example

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

Implementation

  1. import ARVideoKit in the application delegate AppDelegate.swift and a UIViewController with an ARKit scene.

  2. 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
}
  1. In the selected UIViewController class, create an optional type RecordAR global variable.
var recorder:RecordAR?
  1. Initialize RecordAR with ARSCNView or ARSKView. Recommended to initialize in viewDidLoad().

Initializing RecordAR with ARSCNView

recorder = RecordAR(ARSceneKit: sceneView)

Initializing RecordAR with ARSKView

recorder = RecordAR(ARSpriteKit: SKSceneView)
  1. Call the prepare() method in viewWillAppear(_ animated: Bool)
let configuration = ARWorldTrackingConfiguration()
recorder?.prepare(configuration)
  1. Call the rest() method in viewWillDisappear(_ animated: Bool)
recorder?.rest()
  1. Call the record() method in the proper method to start recording.
@IBAction func startRecording(_ sender: UIButton) {
recorder?.record()
}
  1. Call the stopAndExport() method in the proper method to stop recording.
@IBAction func stopRecording(_ sender: UIButton) {
recorder?.stopAndExport()
}