EDIT ----
ok now it works. I didn’t put the snippet on the very top of main.lua, above it still there was an istance of a loaded audio file. Now it’s finally working !!!
@jonjonsson Thank you very much!
EDIT ----
ok now it works. I didn’t put the snippet on the very top of main.lua, above it still there was an istance of a loaded audio file. Now it’s finally working !!!
@jonjonsson Thank you very much!
Hi guys,
I tried your solution to have the background music keep playing mixed with my app sounds. I put this in main:
local otherAudioIsPlaying = false -- store whether other audio is playing when app is started if (audio.supportsSessionProperty) then -- set the audio mix mode to allow sounds from the app to mix with other sounds from the device audio.setSessionProperty(audio.MixMode, audio.AmbientMixMode) if (audio.getSessionProperty(audio.OtherAudioIsPlaying) ~= 0) then otherAudioIsPlaying = true end end
and had my audio files converted to Wav format. Audio gets mixed properly BUT at the first app start the external music gets quit. If I bring up the control center it immediately gets restarted without even need to press play, but I’d like to have it playing without interruptions even at first app opening. Any idea on why this is happening and where to modify this snippet in order to prevent such behavior??
Thank you!!!
I have this top of main.lua and it works:
[lua]require(‘audio’)
if audio.supportsSessionProperty then
audio.setSessionProperty(audio.MixMode, audio.AmbientMixMode)
end [/lua]
I’m not sure if the “require” is required or not. That seems to be the only difference between this and yours though. Give it a go.
Hi @jonjonsson,
thank you for the sinppet. I tried but the same problem problem shows up: external audio quits on first app launch.
Is there something I might need to add, other than the snippet to main.lua, in build or config to make it work?
Thank you!!!
I just verified that it’s working for me. I don’t have anything in build settings pertaining to audio.
I guess I would try the following:
Remove if (audio.getSessionProperty(audio.OtherAudioIsPlaying)
perhaps it has a bug that stops audio?
If all else fails, make a blank project with only the above code and see if it works as expected or if you still have the problem.
If it still doesn’t work it may be a difference in what version of Corona you are using.
thank you @jonjonsson,
sorry could you post the snippet without the supposed to be bugged line?
I don’t have any reference to audio in settings either…
EDIT ----
ok now it works. I didn’t put the snippet on the very top of main.lua, above it still there was an istance of a loaded audio file. Now it’s finally working !!!
@jonjonsson Thank you very much!