         return AVCaptureDevice.default(for: mediaType.stringConstant())
     }
 
+    class func creationError(mediaType: MediaType) -> NSError {
+        return NSError(
+            domain: CaptureDeviceAuthorizationErrorDomain,
+            code: CaptureDeviceAuthorizationErrorCode.couldNotCreate.rawValue,
+            userInfo: [
+                NSLocalizedDescriptionKey: "Capture device for media type \(mediaType.stringConstant()) not available.",
+                NSLocalizedFailureReasonErrorKey: "The user denied the request to access \(mediaType.stringConstant())."
+            ]
+        )
+    }
+
 }
 

            }

            guard let device = createCaptureDevice(mediaType) else {
                let creationError = NSError(domain: CaptureDeviceAuthorizationErrorDomain, code: CaptureDeviceAuthorizationErrorCode.couldNotCreate.rawValue, userInfo: [NSLocalizedDescriptionKey: "Capture device for media type \(mediaType.stringConstant()) not available.", NSLocalizedFailureReasonErrorKey: "The user denied the request to access \(mediaType.stringConstant())."])
                completion?(.failure(creationError))
                return
            }


            return
        #else
            if currentlyAuthorized(forMediaType: mediaType) {
                guard let device = createCaptureDevice(mediaType) else {
                    completion?(.failure(creationError(mediaType: mediaType)))
                    return
                }
                completion?(.success(device))
                return
            }

