Hey all,
I’m working on my first Corona app, and everything looks and sounds great in the simulator. On the device, however, it only looks great: no audio is playing at all. I have an animation that gets triggered when audio is played, and an oncomplete is set to flip the animation off once the audio finishes. The audio never plays and the oncomplete never fires. This is the function I use to play audio:
function playApology() if (audioCurrentlyPlaying) then return false end characters[apologyCharacter].mouth\_neutral.alpha = 0 characters[apologyCharacter].mouth\_sad.alpha = 1 characters[apologyCharacter].tear.alpha = 1 -- based on current character, randomly select a file apologyToPlay = apologies[apologyCharacter][math.floor(math.random(#apologies[apologyCharacter]))] -- currently, it always loads "bouncing.aac" from the "AudioPlayer" sample app print("Playing this file", apologyToPlay) -- load the file apologyFile = audio.loadSound(apologyToPlay, system.ResourceDirectory) print("Apology File: ", apologyFile) -- debug\_loadsound.text = apologyToPlay -- play the file local aa = audio.play(apologyFile, {onComplete=killApologyAudio}) print (aa) audioCurrentlyPlaying = true rot\_dir = -1 end
As you can see, it’s pretty straightforward. I thought it might have been an issue with my audio files, but I tried wav (16 bit uncompressed), MP3 and AAC. I am currently trying the “bouncing.aac” file that’s in the “AudioPlayer” sample app, but nothing’s working.
I’m running an iPhone 5S with iOS 7.1.2. Any ideas what’s up? Do I need to call something to get permissions to play audio on the device, or anything like that?
Thanks!