Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AudioKit engine failing on physical device Error Domain=com.apple.coreaudio.avfaudio Code=-10875

I'm using the latest AudioKit (5), and have got it to pretty much work to my liking on the device simulator. Issue is that on my physical device (iphone x / ios 14), the engine.start() is failing.

General logic on viewDidAppear:

private func startEngine() {
        do {
            try AVAudioSession.sharedInstance().setCategory(AVAudioSession.Category.playAndRecord)
            try engine.start()
        } catch let err {
            print("START ENGINE FAILED: ", err)
        }
    }

Output:

Error Domain=com.apple.coreaudio.avfaudio Code=-10875 "(null)" UserInfo={failed call=err = AUGraphParser::InitializeActiveNodesInOutputChain(ThisGraph, kOutputChainOptimizedTraversal, *GetOutputNode(), isOutputChainActive)}

Would appreciate any help / ideas about this!

Thanks

like image 227
royherma Avatar asked Oct 17 '25 06:10

royherma


1 Answers

Apparently my session wasn't active and set to the correct playback mode.

It is important to do so on appDidFinishLaunching or way before you expect to show your recording/playback screen.

do {
            try AVAudioSession.sharedInstance().setActive(true, options: .notifyOthersOnDeactivation)
            try AVAudioSession.sharedInstance().setCategory(.playAndRecord)
        } catch(let error) {
            print(error.localizedDescription)
        }
like image 102
royherma Avatar answered Oct 19 '25 22:10

royherma



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!