Music Player Stop on iPhone with CoronaApps

Hi there,

I get more and more posts from Users like this:

“When I play music through my iPhone and open the My Days app the music cuts out. Anyway this problem can be fixed?”

And I dont make anything with Music?? Is this a Corona Bug or what could it be?

thanks

chris

Hi Chris,

Throw this at the top of your main.lua (you want to call this ASAP when the app launches) and you should be good to go:

------------------------------------------------------------------------------------ -- ALLOW BACKGROUND MUSIC FROM OTHER APPS ------------------------------------------------------------------------------------ if audio.supportsSessionProperty then audio.setSessionProperty(audio.MixMode, audio.AmbientMixMode) end

(Credit where it’s due, I borrowed this from another forum post, but I can’t remember the thread or else I’d link to it). Enjoy!

Be aware that these session properties are only available on iOS.  They are not officially supported by Corona Labs.  But most people are successful using it.

Rob

Hi Chris,

Throw this at the top of your main.lua (you want to call this ASAP when the app launches) and you should be good to go:

------------------------------------------------------------------------------------ -- ALLOW BACKGROUND MUSIC FROM OTHER APPS ------------------------------------------------------------------------------------ if audio.supportsSessionProperty then audio.setSessionProperty(audio.MixMode, audio.AmbientMixMode) end

(Credit where it’s due, I borrowed this from another forum post, but I can’t remember the thread or else I’d link to it). Enjoy!

Be aware that these session properties are only available on iOS.  They are not officially supported by Corona Labs.  But most people are successful using it.

Rob