Playback of recorded audio not working

I’m trying to make an app that can record and playback sounds. It works exactly as I want it to in the Corona Simulator but when I put it on my phone (Galaxy S5) it does not work.
 
Here is the relevant code:

local TMP\_FILE\_NAME = "tmp.wav" --Name to store temporary file as local curStream = nil local audioHandle = nil local filePath = system.pathForFile(TMP\_FILE\_NAME, system.TemporaryDirectory) local function startCapture() curStream = media.newRecording(filePath) curStream:startRecording() end local function endCapture() if curStream then curStream:stopRecording() curStream = nil end audio.dispose(audioHandle) audioHandle = audio.loadSound(TMP\_FILE\_NAME, system.TemporaryDirectory) print(audioHandle) --Valid Object in the simulator, nil on phone! end local function playSample() audio.play(audioHandle, {channel = 1}) end local function stopSample() audio.stop(1) end

For some reason audio.loadSound returns nil on the phone but not in the simulator.

Any help? Thanks.

Many OS’s require a microphone permission.  What does your build.settings look like?  You probably need android.permission.RECORD_AUDIO

added to your build.settings.

Rob

Thanks for the reply. However, I already have this in my permissions.

I actually fixed it shortly after posting. I simply needed to update the Corona Simulator *facepalm*. I haven’t used it in a while…

Glad you got it fixed.

Many OS’s require a microphone permission.  What does your build.settings look like?  You probably need android.permission.RECORD_AUDIO

added to your build.settings.

Rob

Thanks for the reply. However, I already have this in my permissions.

I actually fixed it shortly after posting. I simply needed to update the Corona Simulator *facepalm*. I haven’t used it in a while…

Glad you got it fixed.