Hi all,
I have an VoIP app which uses AudioQueues for automatically playback of incoming audio even in background. Everything works fine, if another application (e.g. music player or youtube) uses the speaker, my app mutes.
The problem is that the app should restart playback automatically but is unable to open the queues and to enqueue new audio data. The same code is working in foreground, so if the app comes to the foreground, the playback starts.
OSStatus queueError = AudioQueueEnqueueBuffer(inAQ, inCompleteAQBuffer, 0, NULL);
if(queueError == -66671) {
//setup new queues
}
Q: Should this code work in background after another app has used the output device?
AudioQueueNewOutput(&mDataFormat, AQPlayer::AQBufferCallback, this, CFRunLoopGetCurrent(), kCFRunLoopCommonModes, 0, &mQueue);
UInt32 bufferByteSize = voicePacketSize;
AudioQueueAddPropertyListener(mQueue, kAudioQueueProperty_IsRunning, isRunningProc, this);
Q: Would some higher layer methods (like audio sessions) solve my problem?
Any feedback is welcome, thanks in advance
Sebastian