I have several apps which, in certain situations, don’t continue playing their sound – or play the sound with odd delays and repeats – when being re-opened. This only happens when using UIApplicationExitsOnSuspend = false in the build.settings, i.e. when the app continues where it was left off. It happens in different versions of Corona, including very new ones. The Corona command in question is audio.play(). [import]uid: 10284 topic_id: 18552 reply_id: 318552[/import]
Hey Phillip ,
I am using exactly the setup you said does not work for you in my project.
I have set in my file (build.settings) it: [lua]UIApplicationExitsOnSuspend = false[/lua]
and so it does work nice when I live my app (pressing the Home button) and after come back to the app, the sound (.mp3 background audio) just keeps playing from where it had “stoped” before the user pressed the Home button of the iDevice.
So I believe that the problem you are having would be an issue of the [lua]audio.loadStream[/lua] API if you do use it into your code. I say this because I was having sound problems using that API right yesterday and I was pleased I got @ewing (Eric) - Ansca Staff tips to solve it right away.
So if what I`ve mentioned above make any sense regarding your problem, please have a look at this link --> http://developer.anscamobile.com/forum/2011/11/10/music-woes#comment-71116 as it would help you too.
Cheers,
Rodrigo. [import]uid: 89165 topic_id: 18552 reply_id: 71322[/import]
We have the same issue here where the sound just stops playing if you suspend and resume the app. To be clear, it works most of the time, but if you suspend and resume enough times you will eventually lose all your sound.
I looked at the link you provided and we tried adding the extra hidden parameters to the loadStream() call, but since @ewing said he had put those as the defaults back in December, I doubt this will fix anything since we will just be setting it to the values that it already uses for defaults.
Are there any other suggestions to fix this issue?
Ken [import]uid: 16734 topic_id: 18552 reply_id: 95810[/import]
@Ken, I think that too. As @Eric have implemented it “in the core” of the API so it should be setup already and anything we do out of this will be just like “masking” the “core” that is already changed. :\
PS: Looks like that “regression iOS sound bug” from Apple is coming to hurt us Corona devs again…phew! Would it be due of that maybe?
Sorry hearing that Ken,
Cheers,
Rodrigo. [import]uid: 89165 topic_id: 18552 reply_id: 95815[/import]
We are not aware of the bug you are describing, however we did recently discover what appears to be another iOS 5 bug when two OpenAL apps are backgrounded/running at the same time. We’ve seen this in both iOS 5.0 and 5.1 but not 4.3.
Suspending/resuming two different unrelated audio (OpenAL?) apps (we confirmed they don’t both have to be Corona apps) seems to crash an Apple daemon called mediaserverd. This prevents audio from playing since the Apple service that makes audio possible crashed. Force quitting your app and relaunching makes the audio come back.
Maybe you have another app backgrounded that is using audio which is triggering this? Your crash logs would show mediaserverd crashing.
Apple’s own processes should never crash. That means it is an Apple bug.
We have not received any feedback from Apple about this so we are in the dark for now. If you do have this bug, please file a bug report with Apple and refer to Bug ID:10939452. Hopefully enough bug reports will catch their attention.
[import]uid: 7563 topic_id: 18552 reply_id: 95835[/import]
I noticed something similar.
My circumstances are when I have 2 of my apps running simutaneously. I am in app #1 and hit the home button, then jump into app #2. App #2 freezes for 10-15 seconds and then both apps no longer play sound. I have to kill them and restart them to get sound back. I only noticed this in the last week because I am working on my 2nd app while also testing an update for my 1st app. So I was jumping back and forth for some reason when I noticed this.
I haven’t given it much thought because for me it only happens when switching fast between 2 corona apps. I should point out this doesn’t happen if I wait 10 seconds before jumping into app #2. Sounds like my issue is more corona isn’t done releasing the sound device in the first app before I am resuming the 2nd app. Conflict occurs and the audio crashes in both. That’s just a guess though.
However, this could be totally unrelated.
Edit: I started writing this at work and didn’t get finished until after the post above. It seems Ansca is aware of the issue I just described. [import]uid: 56820 topic_id: 18552 reply_id: 95839[/import]
I have noticed a slight difference in my situation and the one you have described. I just tested this on my iphone 4 as I layed out in my last post. My 1st and 2nd app lost sound as described. However, I jump over to Words with Friends (a game for smart people) which is in the background and it still has sound.
I then restarted my 2 apps, then jumped from my 1st app, quickly to WWF and it still had sound. I only seem to experience this with corona apps. However it could be just certain apps don’t play nice when resuming/sleeping together.
To clarify what you described, is this crashing service running per app or should sound be lost across all apps running at the time it crashes? [import]uid: 56820 topic_id: 18552 reply_id: 95841[/import]
We’ve tested with a Corona/OpenAL app and another non-Corona/OpenAL app we found off the App Store to verify it wasn’t just a Corona issue. We would lose audio in both apps I think.
We don’t know if OpenAL is actually the issue or just a coincidence of some other thing that’s being done. (Maybe it is Audio Session Services causing the crash.)
But Apple has many different audio APIs so I’m not sure what WWF uses and if it is affected by mediaserverd. These are all implementation details that are private. For some reason, I don’t think WWF would be using OpenAL.
Anyway, it shouldn’t be possible for us to crash an Apple process or another process. We should only be able to crash our own process. So there is definitely an Apple bug here.
[import]uid: 7563 topic_id: 18552 reply_id: 95843[/import]
Has there been any updates on this? In the daily builds I saw some activity on this, but wasn’t sure if it has been resolved or not. I have several users complaining about sound stopping when they resume the application, this is on build 767. [import]uid: 84258 topic_id: 18552 reply_id: 111093[/import]
Ansca says this is an iOS bug and that people should file bug reports with Apple. [import]uid: 16734 topic_id: 18552 reply_id: 111094[/import]
Build 791 has a fix for this.
(Repasted response from elsewhere:)
I think the audio bug you are describing was also introduced in iOS 5.0, but affects backgrounding/switching/resuming between multiple programs that use OpenAL. This can crash Apple’s mediaserver daemon process and cause all audio to stop working. Since nothing we do should ever be able to crash an Apple process, this is technically an Apple bug. However, there was something we weren’t doing on suspend which Apple wanted us to do (their documentation was unclear about the difference between audio interruptions and application resigning active). Apple apparently changed stuff between iOS 4 and 5 and this suddenly broke. We fixed this in a daily build within the last two months.
[import]uid: 7563 topic_id: 18552 reply_id: 111235[/import]
We made several attempts to fix this. The final commit message was this:
Audio: Additional tweak to workarounds for iOS/Mac audio suspend and resume problems when running multiple OpenAL apps. We moved the sleep into suspend instead of resume as was able to use 20ms instead of 60ms. You should still file bugs with Apple. Refer to rdar://10081775 and rdar://10929452.
[import]uid: 7563 topic_id: 18552 reply_id: 111236[/import]