     internal func switchCamera() {
         self.currentDevice = self.currentDevice == self.captureDeviceRear ?
             self.captureDeviceFront : self.captureDeviceRear
+        self.currentDeviceType = self.currentDevice == self.captureDeviceRear ? .rear : .front
         
         self.setupCurrentDevice()
     }

    open override func viewDidDisappear(_ animated: Bool) {
        super.viewDidDisappear(animated)
        
        self.captureSession.stopRunning()
        self.motionManager.stopAccelerometerUpdates()
    }
    

    
    public func captureOutput(_ captureOutput: AVCaptureOutput!, didOutputMetadataObjects metadataObjects: [Any]!, from connection: AVCaptureConnection!) {
        self.onFaceDetection?(metadataObjects as! [AVMetadataFaceObject])
    }
    
    open func updateFlashMode() {
