   fileprivate func addAudioInput() throws {
     let audioDevice = AVCaptureDevice.defaultDevice(withMediaType: AVMediaTypeAudio)
     audioInput = try AVCaptureDeviceInput(device: audioDevice)
-    
-    if (!captureSession.canAddInput(audioInput)) {
+    try addCaptureInput(audioInput!)
+  }
+  
+  /**
+   Add `input` to `captureSession`.
+   - Throws: `CaptureManagerError.InvalidCaptureInput` if the input cannot be added to `captureSession`.
+   */
+  fileprivate func addCaptureInput(_ input: AVCaptureInput) throws {
+    if (!captureSession.canAddInput(input)) {
       throw CaptureManagerError.invalidCaptureInput
     }
-    
-    captureSession.addInput(audioInput)
+    captureSession.addInput(input)
   }
   
   /**

  fileprivate func addStillImageOutput() throws {
    stillImageOutput = AVCaptureStillImageOutput()
    stillImageOutput?.outputSettings = [AVVideoCodecKey: AVVideoCodecJPEG]
    
    if (!captureSession.canAddOutput(stillImageOutput)) {
      throw CaptureManagerError.invalidCaptureOutput
    }
    
    captureSession.addOutput(stillImageOutput)
  }
  
  /**

  case sessionNotSetUp
  case missingOutputConnection
  case missingVideoDevice
  case missingMovieOutput
  case missingPreviewLayerProvider
  case cameraToggleFailed
  case focusNotSupported
