AVAudioPlayerNode crashes on play

I have a very simple setup involving AVAudioEngine, and a player node, AVAudioPlayerNode.

The player node is attached to the audio engine, then connected to the engine's main mixer node.


Then, to start outputing some sound, I start the engine, and finally play the node :


NSError* err = nil;
BOOL started = [_audioEngine startAndReturnError:&err];
if(started) {
    [_playerNode play];
} else {
    // handle error
}


It happens sometimes, the app crashes (on the call to the play function) because, as the system says : "player started when engine not running".


I can't understand how this can happen, at least in the code above.

No error is returned in `err`.


Does somebody knows what happen or faced such a situation ?

I`m facing the same problem, even I check the engine is playing before play the playerNode

I have the same problem. I wish the play function could throw an exception rather than just make the app crash.

AVAudioPlayerNode crashes on play
 
 
Q