How to Play Audio using Corona SDK ?

By | April 28, 2012

Hi,

For playing audio – background music or sound effects – using Corona SDK, do the following,

1. Load the audio stream (background music or sound effects)

 backgroundMusic = audio.loadStream("bgm.mp3") 

2. Play the audio

backgroundMusicChannel = audio.play( backgroundMusic, { channel=1, loops=-1, fadein=5000 }  )  

It will play the background music on channel 1, loop infinitely, and fadein over 5 seconds. Loop 1 will set it to play once!

🙂

Leave a Reply

Your email address will not be published. Required fields are marked *