@@ -142,6 +142,11 @@ class ViewController: UIViewController {
142142 NotificationCenter . default. addObserver ( self , selector: #selector( orientationDidChange) , name: UIDevice . orientationDidChangeNotification, object: nil )
143143 }
144144
145+ override func viewWillLayoutSubviews( ) {
146+ super. viewWillLayoutSubviews ( )
147+ arView. frame = self . view. bounds
148+ }
149+
145150 override func viewWillTransition( to size: CGSize , with coordinator: UIViewControllerTransitionCoordinator ) {
146151 super. viewWillTransition ( to: size, with: coordinator)
147152 // sometimes UIDeviceOrientationDidChangeNotification will be delayed, so we call orientationChanged in 0.5 seconds anyway
@@ -156,10 +161,11 @@ class ViewController: UIViewController {
156161
157162 self . deepAR = DeepAR ( )
158163 self . deepAR. delegate = self
159- self . deepAR. setLicenseKey ( " your_license_key_here " )
164+ self . deepAR. setLicenseKey ( " your_licence_key " )
160165
161166 cameraController = CameraController ( )
162167 cameraController. deepAR = self . deepAR
168+ self . deepAR. videoRecordingWarmupEnabled = true ;
163169
164170 self . arView = self . deepAR. createARView ( withFrame: self . arViewContainer. frame) as! ARView
165171 self . arView. translatesAutoresizingMaskIntoConstraints = false
@@ -168,7 +174,7 @@ class ViewController: UIViewController {
168174 self . arView. rightAnchor. constraint ( equalTo: self . arViewContainer. rightAnchor, constant: 0 ) . isActive = true
169175 self . arView. topAnchor. constraint ( equalTo: self . arViewContainer. topAnchor, constant: 0 ) . isActive = true
170176 self . arView. bottomAnchor. constraint ( equalTo: self . arViewContainer. bottomAnchor, constant: 0 ) . isActive = true
171-
177+
172178 cameraController. startCamera ( )
173179 }
174180
@@ -248,7 +254,7 @@ class ViewController: UIViewController {
248254 let height : Int32 = Int32 ( deepAR. renderingResolution. height)
249255
250256 if ( currentRecordingMode == RecordingMode . video) {
251- deepAR. startVideoRecording ( withOutputWidth : width , outputHeight : height )
257+ deepAR. resumeVideoRecording ( )
252258 isRecordingInProcess = true
253259 return
254260 }
@@ -343,9 +349,13 @@ class ViewController: UIViewController {
343349extension ViewController : DeepARDelegate {
344350 func didFinishPreparingForVideoRecording( ) { }
345351
346- func didStartVideoRecording( ) { }
352+ func didStartVideoRecording( ) {
353+ NSLog ( " didStartVideoRecording!!!!! " )
354+ }
347355
348356 func didFinishVideoRecording( _ videoFilePath: String ! ) {
357+
358+ NSLog ( " didFinishVideoRecording!!!!! " )
349359
350360 let documentsDirectory = NSSearchPathForDirectoriesInDomains ( . documentDirectory, . userDomainMask, true ) . first!
351361 let components = videoFilePath. components ( separatedBy: " / " )
@@ -385,7 +395,15 @@ extension ViewController: DeepARDelegate {
385395 }
386396 }
387397
388- func didInitialize( ) { }
398+ func didInitialize( ) {
399+ let width : Int32 = Int32 ( deepAR. renderingResolution. width)
400+ let height : Int32 = Int32 ( deepAR. renderingResolution. height)
401+
402+ if ( currentRecordingMode == RecordingMode . video) {
403+ deepAR. startVideoRecording ( withOutputWidth: width, outputHeight: height)
404+ return
405+ }
406+ }
389407
390408 func faceVisiblityDidChange( _ faceVisible: Bool ) { }
391409}
0 commit comments