override func viewDidLoad() {
super.viewDidLoad()
setupDeepARAndCamera()
setupCollectionView()
currentContentType = .Post
addTargets()
}
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
cameraController.startCamera(withAudio: true)
cameraController.position = .back
cameraController.preset = .hd4K3840x2160
setButtonUI()
getPermission()
timerView.isHidden = true
timerLbl.text = "00:00"
NotificationCenter.default.addObserver(self, selector: #selector(orientationDidChange), name: UIDevice.orientationDidChangeNotification, object: nil)
}
private func setupDeepARAndCamera() {
self.deepAR = DeepAR()
self.deepAR?.delegate = self
self.deepAR?.setLicenseKey(DeepArLicenseKey)
self.arView = self.deepAR?.createARView(withFrame: self.arViewContainer.frame)
self.arView?.translatesAutoresizingMaskIntoConstraints = false
self.arViewContainer.addSubview(self.arView)
self.arView?.leftAnchor.constraint(equalTo: self.arViewContainer.leftAnchor, constant: 0).isActive = true
self.arView?.rightAnchor.constraint(equalTo: self.arViewContainer.rightAnchor, constant: 0).isActive = true
self.arView?.topAnchor.constraint(equalTo: self.arViewContainer.topAnchor, constant: 0).isActive = true
self.arView?.bottomAnchor.constraint(equalTo: self.arViewContainer.bottomAnchor, constant: 0).isActive = true
cameraController = CameraController()
cameraController.deepAR = self.deepAR
self.deepAR?.videoRecordingWarmupEnabled = false
}