build.settings
-- Supported values for orientation: -- portrait, portraitUpsideDown, landscapeLeft, landscapeRight settings = { orientation = { default = "landscapeRight", supported = { "landscapeRight", } }, iphone = { plist = { UIStatusBarHidden = false, UIPrerenderedIcon = true, -- set to false for "shine" overlay UIApplicationExitsOnSuspend = true, UIAppFonts = { "happy\_sans.ttf" }, } }, --[[For Android: androidPermissions = { "android.permission.INTERNET", },]]-- }
the code for playing the background music
function init() handles = { } musicStream = nil musicVolume = 0.75 soundVolume = 0.75 audio.reserveChannels(25) -- load sounds handles["bark1"] = audio.loadSound("audio/bark1.mp3") ... more sound effects } function playMusic() if musicStream==nil then musicStream = audio.loadStream("audio/whatever.mp3") end if audio.isChannelPlaying(1)==false then stopMusic() audio.setVolume(musicVolume, {channel=1}) audio.play(musicStream, {channel=1, loops=-1}) end end function fadeOutMusic() audio.fadeOut({channel=1, time=200}) end function stopMusic() audio.stop(1) end
audiolib.init() is called in scene:createScene(event) of the first scene of the app.
audiolib.playMusic() is called in the same method a few lines below.
during the game sometimes fadeOutMusic() is called, then playMusic() again.
hope that helps