                 captureSession.removeInput(try AVCaptureDeviceInput(device: backDevice))
                 let frontDevice = getDevice(.Front)
                 self.captureDevice = frontDevice
-                beginSession()
+                currentPosition = .Front
+                configureSession()
                 sender.setTitle("Front", forState: .Normal)
             }catch{
                 print("Cant remove/Add input: \(error)")

    }
    
    @IBAction func avswitch(sender: UIButton) {
        if self.recordingModePhoto {
            sender.setTitle("Video", forState: .Normal)
            captureSession.sessionPreset = AVCaptureSessionPresetHigh

                button.setTitle("Recording", forState: .Normal)
                
                //let filePath = NSURL(fileURLWithPath: "filePath")
                captureSession.startRunning()
                self.videoFileOutput!.startRecordingToOutputFileURL(filePath, recordingDelegate: self)
            }
            self.recording = !self.recording
