             if oldOutput == self.videoDataOutput || oldOutput == self.photoOutput || oldOutput == self.metadataOutput || oldOutput == self.videoFileOutput  {
                 self.session.removeOutput(oldOutput)
             }
+            if let dataOutput = oldOutput as? AVCaptureVideoDataOutput {
+                self.session.removeOutput(dataOutput)
+            }
         }
     }
     

                if self.session.canSetSessionPreset(self.resolution.foundationPreset()) {
                    self.session.sessionPreset = self.resolution.foundationPreset()
                }
                
                self.configureFrameRate()
 
                if self.capturesHighResolutionImages && self.photoOutput.isHighResolutionCaptureEnabled {
                    self.photoOutput.isHighResolutionCaptureEnabled = true

                }
                
                self.session.commitConfiguration()
                self.configureFrameRate()
                completion(CameraSetupResult.videoSuccess)
                break
            case .denied:
