CameraEngine
CameraEngine copied to clipboard
"unable to add mic as InputDevice"
I keep getting this error
I've been having the same issue.
It looks like a race condition because when we initialize a CameraEngine
, it performs all session initialization in background (see setupSession()
in CameraEngine.swift
). As soon that the initializing part is over (on our end), we ask it to change the device (going from .Back to .Front) - causing a new call to addInputDevice
that happens at the same time as the background initializer one.
@delannoyk I failed to follow up but never solved the problem. Where you able to?
You can solve it by dispatching the call to the sessionQueue (requires modifying the source code)
public func changeCurrentDevice(position: AVCaptureDevicePosition) {
self.cameraDevice.changeCurrentDevice(position)
// Note: to avoid multi-threading crash
dispatch_async(self.sessionQueue) { () -> Void in
self.configureInputDevice()
}
}