O'Reilly logo

Corona SDK Mobile Game Development by Michelle M. Fernandez

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Time for action – controlling audio

Let's simulate our own little music player by creating user interface buttons that will control the audio calls:

  1. In the Chapter 6 folder, copy the Controlling Audio project folder to your desktop. You will notice several art assets, a ui.lua library and a song2.mp3 file inside. You can download the project files accompanying this book from the Packt website:
    Time for action – controlling audio
  2. In the same project folder, create a brand new main.lua file.
  3. Load the audio file via loadStream(), name it backgroundSound, and call the UI library. Also add in a local variable called myMusic:
    local ui = require("ui") local backgroundSound = audio.loadStream("song2.mp3") ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required