Allow external music

I can’t educate the users to launch my app, put it into sleep, start music, and relaunch my app in order to listen to the background music.

I am hoping Corona can add some function to make this work. Is it possible? 

For example, if my app does not play any music/sound, it’s weird/unfriendly that my app turns off users music they are listening to.

Besides, I think there are many cases they like to listen to their music while using apps (most apps provide muting feature so no sounds from the apps and the user can listen to their music while playing them).

By the way, from my testing, Android works even without calling “audio.setSessionProperty(audio.MixMode, audio.AmbientMixMode)”

have to totally agree with joe528 (hence the feature request) - I see my 11 year daughter not interested in games where she can’t run her music in the background…

This used to work, for example in recent daily version 2115. We verified in this thread that something has changed now. 

Edit: just to clarify, I mean that the sound from music players does not mute during first launch in version 2115 but does so in latest daily.

Filed a bug repot, Case 30208

Hope Corona can fix this regression bug asap. Already got several user complaints for the same case that my app turns off their music (There was none before this month)

I am pretty sure it’s a regression bug.

Many users of my app complains that they can listen to background music before but after they upgraded to my new release (built with latest Corona daily builds), they cannot listen to background music because my app kills it.

Could you please give this bug a higher priority?

If you have no plan to fix this issue in next 2 daily builds, please let me know right now.

I will build & publish my app with CoronaSDK 2014.2126 right away instead of waiting.

If 2126 works, I would publish with it.  I brought it to their attention yesterday, but there is enough work already assigned for the next couple of daily builds.

I’ve published my app with daily build 2126.

But I hope Corona can help to fix this regression bug ASAP, otherwise it’s holding me to upgrade my app to use the latest Corona build.

For example, the latest fix for webView is something I really like to be included in my app, but I can’t due to this bug (which gives me the most number of my user complaints) 

Thanks.

I filed a bug report for this 10 days ago and it’s case #30208

Got a response from Corona earlier today

This will be fixed in the next daily build (2179 or after)

So it should be fixed soon.

Looking forward to it.

fantastic - will it be fully fixed per the feature request I put in? (link below) - i.e. when asking app not to cut off music it shouldn’t cut if off for both (a) initial start up of app, or (b) subsequent return to app…

http://feedback.coronalabs.com/forums/188732-corona-sdk-feature-requests-feedback/suggestions/5416670-allow-external-music-audio-to-keep-playing-in-back

@greg886

I think (a) is all about the bug report. And this should be fixed of course.

And (b ) should come with (a), otherwise this bug shouldn’t be considered as being fixed.

We will find out soon. 

This bug has been fixed in the latest build 2179

  • Core/iOS/Audio: Fixes casenum: 30208. Background music from other apps were being stopped when a Corona app launches.

I have tested it and verified I can listen to the background music while my app is launched initially or from the sleeping mode.

I have commented out this block of code, by the way.

--[[if audio.supportsSessionProperty == true then print("\n\naudio.supportsSessionProperty == true\n\n") audio.setSessionProperty(audio.OverrideMixWithOthers, audio.MediaPlaybackMixMode) end]]--

You may want to give it a try to see if you need any additional code to make it work for your case.

Rob/Brent/others - I’m after the same direction/advice too - any update here?  

Basically same a beernathan, but to re-iterate:

a) iTunes Music/Podcasts - ability to have background music/audio to keep playing when you launch your app (i.e. corona sdk built)

b) Other Apps (e.g. audible.com app for audiobooks) - ability to have audio from such an app continuing when you launch your app (i.e. corona sdk built)

I’m guessing (b) may not be possible, but at least how do you implement (a)?   I know there are apps out there (well I’ve seen IOS ones at least) which offer the ability for your background music to keep playing, but need to find out how to do this with Corona SDK?  or if it’s not yet possible just to understand this.   

EDIT: Have just checked, and for example I note that Candy Crush satisfies both (a) and (b) from above.  That is music keeps playing in the background, but also my Audible Audiobook app keeps playing the audiobook so I can listen to this whilst in Candy Crush (which itself still produces sound effects).

Note, my app was intending to just play short audio clips (e.g. menu button pushes) on top of the background music/audio.  That is wasn’t planning to stream music in my app

Hello, I have the same question -
is it possible to to have background music/audio (from iTunes, Podcasts) to keep playing when you launch your app?

Thanks

@Rob/Brent - can I get some feedback from Coronalabs on this please?  

(I have a small app ready to go, but wanted to wait and see if I could incorporate something before releasing it to solve/implement this)

There are two answers here.

1.  Can you Corona based app play audio while it’s in the background.  On iOS you can set a background mode for audio that Apple allows, however Engineering has told me on many occasions that we (Corona Labs) do not officially support these background modes and they are “use at your own risk”.  We do not test these modes.  We may make changes in the future that may break it and if we do, you’ve been told it’s unsupported, so no complaining if we do.  On Android, this simply will not work.  You can search for UIBackgroundModes in the forums

  1. Can other App’s audio that has been backgrounded play while my Corona SDK app is in the Foreground.  Yes.  There is an audio flag that you have to set that allows the music to play.  I think this is part of the undocumented audio features:

        – Set the audio mix mode to allow sounds from the app to mix with other sounds from the device
        if audio.supportsSessionProperty == true then
                print(“supportsSessionProperty is true”)
                audio.setSessionProperty(audio.MixMode, audio.AmbientMixMode)
        end

Since this is part of the undocumented audio features, it’s subject to change without notice as well and probably should also be classified as unsupported. 

thanks Rob - your response 2 was exactly what I was interested in - can I clarify, re the approach you put forward in your dot point 2:

a) this would work for both using streaming and non-streaming audio in your Corona app?  (assume yes, but just checking)

b) re “may be subject to change” - ummm - I guess the question is what is the risk of it changing?  would you use the approach in one of your apps?  Actually is the risk here would I be correct in saying:

 - once your app is built and deployed there is no risk to that version right?

 - when you rebuild (on a later Corona release) for an upgrade would be where the risk is, but if you test before releasing the upgrade you can mitigate the risk (i.e. pull out the property worst case)

Update - Tested this Rob.  Unfortunately does not work when you launch your app, i.e. background musics drops off.  I do note if your app was already in the background and then you comeback from “sleep” mode (forget correct term) then it works in this case.

I’ll stick in a feature request as I think this is now a fairly important item to have.  My daughter won’t play games that don’t allow her to keep playing her music in the background :slight_smile:

Created a feature request here:

http://feedback.coronalabs.com/forums/188732-corona-sdk-feature-requests-feedback/suggestions/5416670-allow-external-music-audio-to-keep-playing-in-back

Are you using audio.* calls to play audio or the media.playEventSound()?