Audio stops on suspend

We’re developing a number of apps with long sections of audio but have run into a fundamental problem. I don’t know if this should be classified as a bug or a feature request.

When the device goes into the suspend state, either from pressing the suspend button or via timeout, the audio stops playing. This is a serious problem when the user is expecting to be able to listen to the audio continuously without interacting with the screen.

Is there any way of coding around this e.g. to keep the app active? Or does it require a change to the way Corona managing audio (and probably multi-tasking too)?

Stefan [import]uid: 2646 topic_id: 8075 reply_id: 308075[/import]

I am having this exact same issue, did you ever find an answer Stefan or anybody else?

Alan [import]uid: 20217 topic_id: 8075 reply_id: 35338[/import]

I haven’t found a totally satisfactory solution. I have found that if you use a web popup with the HTML

Yikes, that’s unfortunate. Well, I guess its back to Objective-C on this app for me. Maybe I can use Corona on the next one… [import]uid: 20217 topic_id: 8075 reply_id: 35442[/import]

I’ve found a solution to this!

In the Info.plist file you can have a key called UIBackgroundModes with an array of values, one of which is “audio”. It’s purpose is to allow audio to continue to play in the background when an app is suspended! The other possible values are “location” and “voip”.

I thought at first it didn’t work, and indeed it doesn’t with the audio.play functions, but discovered that it does work with media.playSound. I haven’t done a device build yet but it works OK on both the Corona and Xcode simulators.

Just put this in the build.settings file …

  
 plist =  
 {  
 UIBackgroundModes =   
 {  
 "audio",  
 },  
 UIApplicationExitsOnSuspend = false,   
 }  
  

Stefan [import]uid: 2646 topic_id: 8075 reply_id: 37473[/import]

Wow, that’s great! To tell the truth, it seems like the plist settings aren’t coming through on the device for me so far! I must be doing something wrong… but its good to know that there might be a solution for this :slight_smile:

I wonder what the settings would be for Android? [import]uid: 20217 topic_id: 8075 reply_id: 37484[/import]