Home › Forums › OpenEars › With OpenEars on and listening, Airplay is disabled › Reply To: With OpenEars on and listening, Airplay is disabled
I did a little experimenting, and AVAudioPlayer works on the local iPad device and when Airplaying to another source, however, AVAudioPlayer has a bit of a delay (maybe 0.2 seconds) in playing the audio even after calling prepareToPlay. Seems like that’s the nature of this mechanism.
In my case that wasn’t acceptable to convert over 100%, so I’ve gone back to using AudioServicesCreateSystemSoundID which give a nice immediate sound effect when only on the iOS device (no airplay).
The workaround for anyone else reading is I look at the number of screens connected to the iOS device by calling [UIScreen screens]. If more than one (Airplay) then I configure PocketSphinx as the “Default” audioMode and use AVAudioPlayer to play my sounds. If there is only one screen then I configure PocketSphinx as the “VoiceChat” audioMode and use the AudioServicesCreateSystemSoundID method to create and play sounds.
Not a perfect solution, but I figure that a little delay on the rarely used AirPlay mirroring is acceptable. 99% of the time the users would never run into this case and they get the optimal sound performance.