Delay when using StartRecording API

Calling media:startRecording on an iOS device takes 2-4 seconds now after upgrading to iOS 5. It used to take less than a second. This is causing our users issues and we need to find a fix as soon as we can.

I cannot determine if this is an Apple issue, or if the Corona SDK API call needs to be modified based on changes made by Apple. Please help.

I’ve reproduced the 2-3 second delay with build (703). Our app, SparkleFish, has worked fine since May 2011. When I install SparkleFish from the App Store onto my iPhone 4 today after upgrading to iOS5, I get the delay when recording sounds. There is much less of a delay on the iPad 2. I believe that is due to its faster processor.

To reproduce it, you can just create a new recording and then call startRecording. The delay happens on startRecording.

Note that there is no delay in the Corona simulator. However, I was able to see the delay in the iPhone sim. It’s worse on the device.

You can create the delay using the snippet from the API manual page:

[lua]local filePath = system.pathForFile( dataFileName, system.DocumentsDirectory )
r = media.newRecording( filePath)
r:startRecording( )[/lua]

Since SparkleFish is all about recording, this pretty much kills our user experience and makes our app unusable.

I’d like to get a fix out to our users, but I’m not sure what to do next. Any help is greatly appreciated.

Thanks,

Paul Osburn [import]uid: 7101 topic_id: 18847 reply_id: 318847[/import]

I could be wrong, but this post on StackOverflow sounds similar.

http://stackoverflow.com/questions/8291754/avaudiorecorder-shows-time-delay-for-recording-sound-in-ios-5

[import]uid: 7101 topic_id: 18847 reply_id: 72557[/import]

This is an iOS 5 bug. I believe our Sample Code from today’s official release (703) contains a workaround for iOS 5. Look for the SimpleAudioRecorder example. Also, please file a bug with Apple ASAP to get them to fix this before 5.1 locks down. (Bug numbers to reference should be in the comments of SimpleAudioRecorder.)

[import]uid: 7563 topic_id: 18847 reply_id: 72562[/import]

That worked! Thank you very much for responding. It turns out that while setting the mix mode to audio.PlayAndRecordMixMode fixed the recording delay issue, anything played back after that was barely audible, even with the speakers on the iOS device turned up all the way.

Setting the mix mode back to audio.MediaPlaybackMixMode seemed to fix things so playback was audible.

Also, I filed a bug with apple and referenced the two in the SimpleAudioRecorder.

Thanks,
Paul [import]uid: 7101 topic_id: 18847 reply_id: 72993[/import]