     }
     
     func getMaxZoomFactor() -> CGFloat {
-        guard let device = self.videoInput?.device else {
+        guard let device = videoInput?.device else {
             return 1
         }
         if #available(iOS 11.0, *) {
-            return device.maxAvailableVideoZoomFactor
+            return device.maxAvailableVideoZoomFactor / 2
         } else {
-            return device.activeFormat.videoMaxZoomFactor
+            return device.activeFormat.videoMaxZoomFactor / 2
         }
     }
     

    
    @objc func switchCameraBtnClick() {
        do {
            guard !self.restartRecordAfterSwitchCamera else {
                return
            }
            
            guard let currInput = self.videoInput else {
                return
            }
            var newVideoInput: AVCaptureDeviceInput?
            if currInput.device.position == .back, let front = self.getCamera(position: .front) {
                newVideoInput = try AVCaptureDeviceInput(device: front)
            } else if currInput.device.position == .front, let back = self.getCamera(position: .back) {
                newVideoInput = try AVCaptureDeviceInput(device: back)
            } else {
                return
            }
            
            let zoomFactor = currInput.device.videoZoomFactor
            
            if let ni = newVideoInput {
                self.session.beginConfiguration()
                self.session.removeInput(currInput)
                if self.session.canAddInput(ni) {
                    self.session.addInput(ni)
                    self.videoInput = ni
                    ni.device.videoZoomFactor = zoomFactor
                } else {
                    self.session.addInput(currInput)
                }
                self.session.commitConfiguration()
                if self.movieFileOutput.isRecording {
                    let pauseTime = self.animateLayer.convertTime(CACurrentMediaTime(), from: nil)
                    self.animateLayer.speed = 0
                    self.animateLayer.timeOffset = pauseTime
                    self.restartRecordAfterSwitchCamera = true
                }
            }
        } catch {

extension ZLCustomCamera: UIGestureRecognizerDelegate {
    
    public func gestureRecognizer(_ gestureRecognizer: UIGestureRecognizer, shouldRecognizeSimultaneouslyWith otherGestureRecognizer: UIGestureRecognizer) -> Bool {
        let gesTuples: [(UIGestureRecognizer?, UIGestureRecognizer?)] = [(recordLongGes, cameraFocusPanGes), (recordLongGes, focusCursorTapGes), (cameraFocusPanGes, focusCursorTapGes)]
        
        let result = gesTuples.map { (ges1, ges2) in
            return (ges1 == gestureRecognizer && ges2 == otherGestureRecognizer) ||
            (ges2 == otherGestureRecognizer && ges1 == gestureRecognizer)
        }.filter { $0 == true}
        
        return result.count > 0
    }
    
}
