Apple ReplayKit. Getting a contact FMOD support message.

Hello,

I’m using FMOD Studio Programmer’s API with iOS (tested version 1.06.07 and 1.06.10) and I get this error:
FMOD error! (28) An error occurred that wasn’t supposed to. Contact support.

This started happening when I tried implementing Apple’s ReplayKit. It happens right after calling RPScreenRecorder::startRecordingWithMicrophoneEnabled. Audio skips and then cuts out completely and doesn’t return until I restart the application. Apple’s RPScreenRecorder also fails and stops recording.

Any ideas?

Thank you,

Luigi

Log1:

2015-09-29 09:23:25.726 Apocalypse Meow[1464:685917] STARTED REPLAY KIT RECORDING
[LOG] SoundI::release                          : menu.m4a (0x15b50f158)
[LOG] SoundI::release                          : remove stream samples. (0x15b50f158)
[LOG] SoundI::release                          :      (0x15b50f8a8)
[LOG] SoundI::release                          : release codec. (0x15b50f158)
[LOG] SystemI::createSoundInternal             : filename = /var/mobile/Containers/Bundle/Apocalypse Meow.app/Audio/Level_2_song.m4a : mode 0000008a
[ERR] CodecFSB5::headerReadCheck               : Header check failed. Not an FSB5
[ERR] CodecVAG::openInternal                   : 'VAG' ID check failed [[ERR] CodecOggVorbis::openInternal             : failed to open as ogg
[ERR] CodecMOD::openInternal                   : 'M.K.' etc ID check failed [v??]
[ERR] CodecS3M::openInternal                   : 'SCRM' ID check failed [????]
[ERR] CodecXM::openInternal                    : 'Extended Module: ' ID check failed [???]
[ERR] CodecIT::openInternal                    : 'IMPM' etc ID check failed [???]
[ERR] CodecMIDI::openInternal                  : 'HThd' ID check failed [???]
[LOG] SystemI::createSoundInternal             : Format has 0 subsounds.
[LOG] SystemI::createSoundInternal             : Create as FMOD_CREATESTREAM
[LOG] System::createSoundInternal              : decode buffersize = 17408 : blocksize = 256 : format = 2
[LOG] SystemI::createSample                    : mode 0000008a length 17408 samples, lengthbytes 1249859
[LOG] SystemI::createSample                    : subsamples = 1, channels = 2
[LOG] SystemI::createSample                    : subsample 0.  output = 0x15b34f478
[LOG] OutputSoftware::createSample             : lengthpcm 17408, lengthbytes 1249859, channels 2, format 2, freq 44100, mode 0000008a
[LOG] System::createSoundInternal              : Seek stream to start
[LOG] System::createSoundInternal              : flush stream buffer
[ERR] CodecAudioQueue::readInternal            : Cannot offline render audio queue. (err: -308)
[LOG] SoundI::release                          :  (0x15b472ec8)
[LOG] SoundI::release                          : remove stream samples. (0x15b472ec8)
[LOG] SoundI::release                          :      (0x15b473198)
[LOG] SoundI::release                          : release codec. (0x15b472ec8)
[ERR] CodecAudioQueue::closeInternal           : Cannot dispose audio queue. (err: -66671)
FMOD error! (28) An error occurred that wasn't supposed to.  Contact support.

Log2:

Wed Sep 30 09:11:51 2015 - Level::load - suspending audio mixer.
[LOG] SystemI::mixerSuspend                    : Suspending output.
LOADING COMPRESSED SAMPLE
[LOG] SystemI::createSoundInternal             : filename = /var/mobile/Containers/Bundle/Application/670ACF38-1565-4D2F-8A78-9C93A9FFCCD7/Apocalypse Meow.app/Audio/human_detected.fsb : mode 00000088
[LOG] SystemI::createSoundInternal             : Format has 1 subsounds.
[LOG] SystemI::createSoundInternal             : Create as FMOD_CREATESTREAM
[LOG] System::createSoundInternal              : decode buffersize = 17408 : blocksize = 256 : format = 2
[LOG] SystemI::createSample                    : mode 0000008a length 17408 samples, lengthbytes 91840
[LOG] SystemI::createSample                    : subsamples = 1, channels = 2
[LOG] SystemI::createSample                    : subsample 0.  output = 0x139990be8
[LOG] OutputSoftware::createSample             : lengthpcm 17408, lengthbytes 91840, channels 2, format 2, freq 44100, mode 0000008a
[LOG] System::createSoundInternal              : 1 subsounds detected.
[LOG] System::createSoundInternal              : Seek stream to start
[LOG] System::createSoundInternal              : flush stream buffer
[LOG] System::createSoundInternal              : flush successful.
[LOG] System::createSoundInternal              : switch file handle from small blocking single buffered to large nonblocking doublebuffered.
[LOG] SystemI::createSoundInternal             : done.  OpenState now = FMOD_OPENSTATE_READY.
... trimmed, a bunch more audio files are loaded ...
LOAD TIME IN SECONDS SECONDS: 0.281481
Wed Sep 30 09:11:56 2015 - Level::initialize - Starting replay record.
2015-09-30 09:11:56.835 Apocalypse Meow[2258:967808] STARTED RECORDING
[LOG] SoundI::release                          : menu.m4a (0x1399e66a8)
[LOG] SoundI::release                          : remove stream samples. (0x1399e66a8)
[LOG] SoundI::release                          :      (0x1399e6978)
[LOG] SoundI::release                          : release codec. (0x1399e66a8)
[LOG] SystemI::createSoundInternal             : filename = /var/mobile/Containers/Bundle/Application/670ACF38-1565-4D2F-8A78-9C93A9FFCCD7/Apocalypse Meow.app/Audio/Level_2_song.m4a : mode 0000008a
[ERR] CodecFSB5::headerReadCheck               : Header check failed. Not an FSB5
[ERR] CodecVAG::openInternal                   : 'VAG' ID check failed [[ERR] CodecOggVorbis::openInternal             : failed to open as ogg
[ERR] CodecMOD::openInternal                   : 'M.K.' etc ID check failed [v??]
[ERR] CodecS3M::openInternal                   : 'SCRM' ID check failed [????]
[ERR] CodecXM::openInternal                    : 'Extended Module: ' ID check failed [???]
[ERR] CodecIT::openInternal                    : 'IMPM' etc ID check failed [???]
[ERR] CodecMIDI::openInternal                  : 'HThd' ID check failed [???]
[LOG] SystemI::createSoundInternal             : Format has 0 subsounds.
[LOG] SystemI::createSoundInternal             : Create as FMOD_CREATESTREAM
[LOG] System::createSoundInternal              : decode buffersize = 17408 : blocksize = 256 : format = 2
[LOG] SystemI::createSample                    : mode 0000008a length 17408 samples, lengthbytes 1249859
[LOG] SystemI::createSample                    : subsamples = 1, channels = 2
[LOG] SystemI::createSample                    : subsample 0.  output = 0x139990be8
[LOG] OutputSoftware::createSample             : lengthpcm 17408, lengthbytes 1249859, channels 2, format 2, freq 44100, mode 0000008a
[LOG] System::createSoundInternal              : Seek stream to start
[LOG] System::createSoundInternal              : flush stream buffer
[ERR] CodecAudioQueue::readInternal            : Cannot offline render audio queue. (err: -308)
[LOG] SoundI::release                          :  (0x139a92d88)
[LOG] SoundI::release                          : remove stream samples. (0x139a92d88)
[LOG] SoundI::release                          :      (0x139a93058)
[LOG] SoundI::release                          : release codec. (0x139a92d88)
[ERR] CodecAudioQueue::closeInternal           : Cannot dispose audio queue. (err: -66671)
FMOD error! (28) An error occurred that wasn't supposed to.  Contact support.
FMOD error! (31) An invalid parameter was passed to this function.
2015-09-30 09:11:57.882 Apocalypse Meow[2258:967913] The operation couldn’t be completed. (com.apple.ReplayKit.RPRecordingErrorDomain error -5804.)
2015-09-30 09:12:00.044 Apocalypse Meow[2258:967917] NSURLSession/NSURLConnection HTTP load failed (kCFStreamErrorDomainSSL, -9802)
Wed Sep 30 09:12:01 2015 - Level::startGame - resuming audio mixer.
[LOG] SystemI::mixerResume                     : Resuming output.
[ERR] OutputCoreAudio::suspend                 : Cannot start audio unit. (err: -50)
LOADING COMPRESSED SAMPLE
[LOG] SystemI::createSoundInternal             : filename = /var/mobile/Containers/Bundle/Application/670ACF38-1565-4D2F-8A78-9C93A9FFCCD7/Apocalypse Meow.app/Audio/Dialog/stay alert only a hero can survive.fsb : mode 00000088
[LOG] SystemI::createSoundInternal             : Format has 1 subsounds.
[LOG] SystemI::createSoundInternal             : Create as FMOD_CREATESTREAM
[LOG] System::createSoundInternal              : decode buffersize = 17408 : blocksize = 256 : format = 2
[LOG] SystemI::createSample                    : mode 0000008a length 17408 samples, lengthbytes 211136
[LOG] SystemI::createSample                    : subsamples = 1, channels = 2
[LOG] SystemI::createSample                    : subsample 0.  output = 0x139990be8
[LOG] OutputSoftware::createSample             : lengthpcm 17408, lengthbytes 211136, channels 2, format 2, freq 44100, mode 0000008a
[LOG] System::createSoundInternal              : 1 subsounds detected.
[LOG] System::createSoundInternal              : Seek stream to start
[LOG] System::createSoundInternal              : flush stream buffer
[LOG] System::createSoundInternal              : flush successful.
[LOG] System::createSoundInternal              : switch file handle from small blocking single buffered to large nonblocking doublebuffered.
[LOG] SystemI::createSoundInternal             : done.  OpenState now = FMOD_OPENSTATE_READY.

[LOG] SoundI::getSubSound                      : sound 0x139b44f88.  Subsound index 0 / 1
[LOG] SoundI::release                          : thruster_flyby (0x139b1ab68)
[LOG] SoundI::release                          : remove stream samples. (0x139b1ab68)
[LOG] SoundI::release                          :     thruster_flyby (0x139b1ae38)
[LOG] SoundI::release                          : release subsounds. (0x139b1ab68)
[LOG] SoundI::release                          :     thruster_flyby (0x139b1b1e8)
[LOG] SoundI::release                          : release codec. (0x139b1ab68)

Log 3 (PlayAndRecord)

SUSPEND
[LOG] SystemI::mixerSuspend                    : Suspending output.
RECORD
2015-09-30 15:10:28.553 Apocalypse Meow[2462:1053844] STARTED RECORDING
RESUME
[LOG] SystemI::mixerResume                     : Resuming output.
[ERR] CodecAudioQueue::setPositionInternal     : Cannot start audio queue. (err: -308)
2015-09-30 15:10:30.810 Apocalypse Meow[2462:1053886] The operation couldn’t be completed. (com.apple.ReplayKit.RPRecordingErrorDomain error -5804.)
2015-09-30 15:10:31.250 Apocalypse Meow[2462:1053950] NSURLSession/NSURLConnection HTTP load failed (kCFStreamErrorDomainSSL, -9802)
COMPLETE LEVEL LOAD
HttpRequest::run(http://www.google-analytics.com/collect)
[LOG] SoundI::release                          : menu.m4a (0x1583b2d08)
[LOG] SoundI::release                          : remove stream samples. (0x1583b2d08)
[LOG] SoundI::release                          :      (0x1583b30b8)
[LOG] SoundI::release                          : release codec. (0x1583b2d08)
[ERR] CodecAudioQueue::closeInternal           : Cannot dispose audio queue. (err: -66671)
[LOG] SystemI::createSoundInternal             : filename = /var/mobile/Containers/Bundle/Application/AA9E42A0-0147-41E7-BE70-F7443FD2C898/Apocalypse Meow.app/Audio/Level_2_song.m4a : mode 0000008a
[ERR] CodecFSB5::headerReadCheck               : Header check failed. Not an FSB5
[ERR] CodecVAG::openInternal                   : 'VAG' ID check failed [[ERR] CodecOggVorbis::openInternal             : failed to open as ogg
[ERR] CodecMOD::openInternal                   : 'M.K.' etc ID check failed [v??]
[ERR] CodecS3M::openInternal                   : 'SCRM' ID check failed [????]
[ERR] CodecXM::openInternal                    : 'Extended Module: ' ID check failed [???]
[ERR] CodecIT::openInternal                    : 'IMPM' etc ID check failed [???]
[ERR] CodecMIDI::openInternal                  : 'HThd' ID check failed [???]
[LOG] SystemI::createSoundInternal             : Format has 0 subsounds.
[LOG] SystemI::createSoundInternal             : Create as FMOD_CREATESTREAM
[LOG] System::createSoundInternal              : decode buffersize = 17408 : blocksize = 256 : format = 2
[LOG] SystemI::createSample                    : mode 0000008a length 17408 samples, lengthbytes 1249859
[LOG] SystemI::createSample                    : subsamples = 1, channels = 2
[LOG] SystemI::createSample                    : subsample 0.  output = 0x1545bcb88
[LOG] OutputSoftware::createSample             : lengthpcm 17408, lengthbytes 1249859, channels 2, format 2, freq 44100, mode 0000008a
[LOG] System::createSoundInternal              : Seek stream to start
[LOG] System::createSoundInternal              : flush stream buffer
[LOG] System::createSoundInternal              : flush successful.
[LOG] System::createSoundInternal              : switch file handle from small blocking single buffered to large nonblocking doublebuffered.
[LOG] SystemI::createSoundInternal             : No name found in file, use filename.
[LOG] SystemI::createSoundInternal             : done.  OpenState now = FMOD_OPENSTATE_READY.

2015-09-30 15:10:46.292 Apocalypse Meow[2462:1053950] NSURLSession/NSURLConnection HTTP load failed (kCFStreamErrorDomainSSL, -9802)
2015-09-30 15:11:01.244 Apocalypse Meow[2462:1053950] NSURLSession/NSURLConnection HTTP load failed (kCFStreamErrorDomainSSL, -9802)
2015-09-30 15:11:16.411 Apocalypse Meow[2462:1053950] NSURLSession/NSURLConnection HTTP load failed (kCFStreamErrorDomainSSL, -9802)
2015-09-30 15:11:31.263 Apocalypse Meow[2462:1053950] NSURLSession/NSURLConnection HTTP load failed (kCFStreamErrorDomainSSL, -9802)
2015-09-30 15:11:46.316 Apocalypse Meow[2462:1053950] NSURLSession/NSURLConnection HTTP load failed (kCFStreamErrorDomainSSL, -9802)
2015-09-30 15:12:01.282 Apocalypse Meow[2462:1053950] NSURLSession/NSURLConnection HTTP load failed (kCFStreamErrorDomainSSL, -9802)
2015-09-30 15:12:16.420 Apocalypse Meow[2462:1053950] NSURLSession/NSURLConnection HTTP load failed (kCFStreamErrorDomainSSL, -9802)
2015-09-30 15:12:32.419 Apocalypse Meow[2462:1053950] NSURLSession/NSURLConnection HTTP load failed (kCFStreamErrorDomainSSL, -9802)
2015-09-30 15:12:46.335 Apocalypse Meow[2462:1053950] NSURLSession/NSURLConnection HTTP load failed (kCFStreamErrorDomainSSL, -9802)
2015-09-30 15:13:01.371 Apocalypse Meow[2462:1053950] NSURLSession/NSURLConnection HTTP load failed (kCFStreamErrorDomainSSL, -9802)
2015-09-30 15:13:16.321 Apocalypse Meow[2462:1053950] NSURLSession/NSURLConnection HTTP load failed (kCFStreamErrorDomainSSL, -9802)
2015-09-30 15:13:31.373 Apocalypse Meow[2462:1053950] NSURLSession/NSURLConnection HTTP load failed (kCFStreamErrorDomainSSL, -9802)

Log 4 (PlayAndRecord)

SUSPEND
[LOG] SystemI::mixerSuspend                    : Suspending output.
[ERR] CodecAudioQueue::processAudioQueue       : Cannot enqueue buffer for audio queue. (err: -66632)
RECORD
2015-09-30 15:07:33.152 ApocalypseMeow[2446:1051816] STARTED RECORDING
RESUME
[LOG] SystemI::mixerResume                     : Resuming output.
2015-09-30 15:07:33.780 ApocalypseMeow[2446:1051897] The operation couldn’t be completed. (com.apple.ReplayKit.RPRecordingErrorDomain error -5804.)
COMPLETE LEVEL LOAD
HttpRequest::run(http://www.google-analytics.com/collect)
[LOG] SoundI::release                          : menu.m4a (0x1621f55b8)
[LOG] SoundI::release                          : remove stream samples. (0x1621f55b8)
[LOG] SoundI::release                          :      (0x16241dd48)
[LOG] SoundI::release                          : release codec. (0x1621f55b8)
[ERR] CodecAudioQueue::closeInternal           : Cannot dispose audio queue. (err: -66671)
[LOG] SystemI::createSoundInternal             : filename = /var/mobile/Containers/Bundle/Application/A1F9FCA9-550C-4DE8-BE66-BA84641A498D/ApocalypseMeow.app/Audio/Level_2_song.m4a : mode 0000008a
[ERR] CodecFSB5::headerReadCheck               : Header check failed. Not an FSB5
[ERR] CodecVAG::openInternal                   : 'VAG' ID check failed [[ERR] CodecOggVorbis::openInternal             : failed to open as ogg
[ERR] CodecMOD::openInternal                   : 'M.K.' etc ID check failed [v??]
[ERR] CodecS3M::openInternal                   : 'SCRM' ID check failed [????]
[ERR] CodecXM::openInternal                    : 'Extended Module: ' ID check failed [???]
[ERR] CodecIT::openInternal                    : 'IMPM' etc ID check failed [???]
[ERR] CodecMIDI::openInternal                  : 'HThd' ID check failed [???]
[LOG] SystemI::createSoundInternal             : Format has 0 subsounds.
[LOG] SystemI::createSoundInternal             : Create as FMOD_CREATESTREAM
[LOG] System::createSoundInternal              : decode buffersize = 17408 : blocksize = 256 : format = 2
[LOG] SystemI::createSample                    : mode 0000008a length 17408 samples, lengthbytes 1249859
[LOG] SystemI::createSample                    : subsamples = 1, channels = 2
[LOG] SystemI::createSample                    : subsample 0.  output = 0x15f8c1378
[LOG] OutputSoftware::createSample             : lengthpcm 17408, lengthbytes 1249859, channels 2, format 2, freq 44100, mode 0000008a
[LOG] System::createSoundInternal              : Seek stream to start
[LOG] System::createSoundInternal              : flush stream buffer
[LOG] System::createSoundInternal              : flush successful.
[LOG] System::createSoundInternal              : switch file handle from small blocking single buffered to large nonblocking doublebuffered.
[LOG] SystemI::createSoundInternal             : No name found in file, use filename.
[LOG] SystemI::createSoundInternal             : done.  OpenState now = FMOD_OPENSTATE_READY.

2015-09-30 15:07:40.418 ApocalypseMeow[2446:1051916] NSURLSession/NSURLConnection HTTP load failed (kCFStreamErrorDomainSSL, -9802)
2015-09-30 15:07:55.358 ApocalypseMeow[2446:1051916] NSURLSession/NSURLConnection HTTP load failed (kCFStreamErrorDomainSSL, -9802)

Log 5 (Ambient, probably these errors are expected, but just in case)

2015-09-30 15:05:48.728 ApocalypseMeow[2438:1050586] STARTED RECORDING
RESUME
[LOG] SystemI::mixerResume                     : Resuming output.
2015-09-30 15:05:49.364 ApocalypseMeow[2438:1050692] The operation couldn’t be completed. (com.apple.ReplayKit.RPRecordingErrorDomain error -5804.)
COMPLETE LEVEL LOAD
2015-09-30 15:05:49.395 ApocalypseMeow[2438:1050586] 15:05:49.395 ERROR:    [0x1a0ce1000] AVAudioSessionUtilities.h:111: GetProperty: AudioSessionGetProperty ('othr') failed with error: '!ini'
2015-09-30 15:05:49.395 ApocalypseMeow[2438:1050586] 15:05:49.395 ERROR:    [0x1a0ce1000] AVAudioSessionUtilities.h:124: GetProperty_DefaultToZero: AudioSessionGetProperty ('othr') failed with error: '!ini'
2015-09-30 15:05:49.410 ApocalypseMeow[2438:1050586] 15:05:49.410 ERROR:    [0x1a0ce1000] AVAudioSessionUtilities.h:111: GetProperty: AudioSessionGetProperty ('othr') failed with error: '!ini'
2015-09-30 15:05:49.410 ApocalypseMeow[2438:1050586] 15:05:49.410 ERROR:    [0x1a0ce1000] AVAudioSessionUtilities.h:124: GetProperty_DefaultToZero: AudioSessionGetProperty ('othr') failed with error: '!ini'

Log 6

2015-09-30 15:55:42.093 Apocalypse Meow[2488:1064169] NSURLSession/NSURLConnection HTTP load failed (kCFStreamErrorDomainSSL, -9802)
SUSPEND
[LOG] SystemI::mixerSuspend                    : Suspending output.
RECORD
2015-09-30 15:55:54.720 Apocalypse Meow[2488:1064036] STARTED RECORDING
2015-09-30 15:55:57.068 Apocalypse Meow[2488:1064169] NSURLSession/NSURLConnection HTTP load failed (kCFStreamErrorDomainSSL, -9802)
RESUME
[LOG] SystemI::mixerResume                     : Resuming output.
2015-09-30 15:56:04.828 Apocalypse Meow[2488:1064141] The operation couldn’t be completed. (com.apple.ReplayKit.RPRecordingErrorDomain error -5804.)
2015-09-30 15:56:12.067 Apocalypse Meow[2488:1064169] NSURLSession/NSURLConnection HTTP load failed (kCFStreamErrorDomainSSL, -9802)
COMPLETE LEVEL LOAD
HttpRequest::run(http://www.google-analytics.com/collect)
[LOG] SoundI::release                          : menu.m4a (0x140d00728)
[LOG] SoundI::release                          : remove stream samples. (0x140d00728)
[LOG] SoundI::release                          :      (0x140c1d8f8)
[LOG] SoundI::release                          : release codec. (0x140d00728)
[ERR] CodecAudioQueue::closeInternal           : Cannot dispose audio queue. (err: -66671)
[LOG] SystemI::createSoundInternal             : filename = /var/mobile/Containers/Bundle/Application/284AF2DD-0D04-41F0-A6FA-341239BD9A15/Apocalypse Meow.app/Audio/Level_2_song.m4a : mode 0000008a
[ERR] CodecFSB5::headerReadCheck               : Header check failed. Not an FSB5
[ERR] CodecVAG::openInternal                   : 'VAG' ID check failed [[ERR] CodecOggVorbis::openInternal             : failed to open as ogg
[ERR] CodecMOD::openInternal                   : 'M.K.' etc ID check failed [v??]
[ERR] CodecS3M::openInternal                   : 'SCRM' ID check failed [????]
[ERR] CodecXM::openInternal                    : 'Extended Module: ' ID check failed [???]
[ERR] CodecIT::openInternal                    : 'IMPM' etc ID check failed [???]
[ERR] CodecMIDI::openInternal                  : 'HThd' ID check failed [???]
[LOG] SystemI::createSoundInternal             : Format has 0 subsounds.
[LOG] SystemI::createSoundInternal             : Create as FMOD_CREATESTREAM
[LOG] System::createSoundInternal              : decode buffersize = 17408 : blocksize = 256 : format = 2
[LOG] SystemI::createSample                    : mode 0000008a length 17408 samples, lengthbytes 1249859
[LOG] SystemI::createSample                    : subsamples = 1, channels = 2
[LOG] SystemI::createSample                    : subsample 0.  output = 0x140b6c638
[LOG] OutputSoftware::createSample             : lengthpcm 17408, lengthbytes 1249859, channels 2, format 2, freq 44100, mode 0000008a
[LOG] System::createSoundInternal              : Seek stream to start
[LOG] System::createSoundInternal              : flush stream buffer
[LOG] System::createSoundInternal              : flush successful.
[LOG] System::createSoundInternal              : switch file handle from small blocking single buffered to large nonblocking doublebuffered.
[LOG] SystemI::createSoundInternal             : No name found in file, use filename.
[LOG] SystemI::createSoundInternal             : done.  OpenState now = FMOD_OPENSTATE_READY.

If you are using an API that requires microphone access you will need to ensure you are setting the appropriate AudioSession, in your case “PlayAndRecord”.

You can read more about the AudioSession API here. For best results, make sure you set these preferences before initializing FMOD.

EDIT:
Based on your log output it looks like the AudioQueue got killed. This seems like a bug in iOS, however one possible work around would be to suspend FMOD before you start recording, and resume FMOD once the recording begins. You can do this via System::mixerSuspend, System::mixerResume.

Sorry not sure what’s up with the formatting, it’s not respecting my line breaks.

Thanks for the quick reply Mathew.

Unfortunately this doesn’t seem to make a difference.

I get the same result regardless of which AVAudioSession category my app is set to. I’ve tried AVAudioSessionCategoryPlayAndRecord and a few others (previously my App was on AVAudioSessionCategoryAmbient). I confirmed that setCategory call is not returning an error and is returning success.

I’m going to attach the output log below from when my game invokes startRecordingWithMicrophoneEnabled. You can see that STARTED REPLAY KIT RECORDING happens and then my game switches from the menu music to the in game music (menu.m4a to Level_2_song.m4a). If I don’t try to record with ReplayKit, everything plays back fine.

(Log1 added to question)

I also confirmed that my AVAudioSession category gets set before FMOD gets initialized.

I’ve updated my answer with a potential work around.

This seems to help a little as apparently the replay actually starts recording and then fails shortly after.

I now get the following error from iOS: The operation couldn’t be completed. (com.apple.ReplayKit.RPRecordingErrorDomain error -5804.)

This just seems to indicate some generic recording error.

However, my audio still does not return after resuming and I still get the contact FMOD support error. I put the suspend/resume a little before/after the recording call as I suspect many of these calls are asynchronous.

Here’s a trimmed log, let me know if you’d like the full one (it’s quite long):
(Log2 added to question)

It looks like you have some FMOD calls after suspend but before resume, can you move those after the resume?

I’ll try. Are the suspend/resume calls synchronous?

Yes, they are synchronous.

Thanks for all the help Mathew.

Alright, so here are three different logs from three different runs. The first two are using the PlayAndRecord AudioSession and the final one is with Ambient (I tried this because PlayAndRecord greatly lowers the output volume, but I can tackle that separately). The first two are slightly different second one has this error: CodecAudioQueue::processAudioQueue : Cannot enqueue buffer for audio queue. (err: -66632)

(Logs 3, 4 and 5 added to question)

Sorry didn’t specify: result is the same, audio does not return and recording stops.

It looks like startRecordingWithMicrophoneEnabled has a handler block for when it completes. Can you try suspending FMOD before the call to startRecording, then call resume in the handler block? If that doesn’t work can you try resuming FMOD much later after starting the record? I suspect that ReplayKit is doing some internal reconfiguration of the audio stack so I want to make sure that is well and truly done before bringing FMOD back.

The STARTED RECORDING log entry is in fact from the handler when no error is passed in. I’ll add a 10 second delay and write back…

I added 10 second delays on top of every operation we introduced. It waits 10 seconds after calling suspend, 10 seconds after record, and 10 seconds after resume before it tries to do anything else.

It’s quite clear that as soon as FMOD resumes ReplayKit stops recording with that RPRecordingErrorDomain error -5804.

(Log 6 added to question)

Unfortunately this is looking like a bug with ReplayKit. My understanding is it should transparently record what’s happening in the game, but it seems there is some mutual exclusion going on.

Thanks Mathew, I started a thread on Apple’s ReplayKit forum too. Hopefully someone from Apple will chime in. Here’s the link, if you’d like to follow: https://forums.developer.apple.com/thread/20791

I haven’t been able to get anyone from Apple to look into it, I unfortunately don’t have any contact there. If you hear of an answer to this through another thread (or have a contact you could ask), could you please follow up here? Thanks again for all the help.

I have this -5804 error too with FMOD EX and ReplayKit. Since 7 months have been passed, I wonder if there is any progress on this problem? Does the mixerSuspend/mixerResume work around works?

Unfortunately there have been no developments on this to my knowledge. I’d recommend re-testing with the last Xcode / iOS SDK, if the bug still persists follow up with Apple.