 
 		if let audioDevice = audioDevice {
 			if !audioDevice.hasMediaType(.audio) {
-				throw ApertureError.invalidAudioDevice
+				throw Error.invalidAudioDevice
 			}
 
 			let audioInput = try AVCaptureDeviceInput(device: audioDevice)

			if session.canAddInput(audioInput) {
				session.addInput(audioInput)
			} else {
				throw ApertureError.couldNotAddMic
			}
		}

		if session.canAddInput(input) {
			session.addInput(input)
		} else {
			throw ApertureError.couldNotAddScreen
		}

		if session.canAddOutput(output) {
			session.addOutput(output)
		} else {
			throw ApertureError.couldNotAddOutput
		}

		// TODO: Default to HEVC when on 10.13 or newer and encoding is hardware supported. Without hardware encoding I got 3 FPS full screen recording.


	public var onStart: (() -> Void)?
	public var onFinish: (() -> Void)?
	public var onError: ((Swift.Error) -> Void)?
	public var onPause: (() -> Void)?
	public var onResume: (() -> Void)?
	public var isRecording: Bool { output.isRecording }
