591 - Background music stops playing when i change it (iOS 5 Betas 4 and above)

Do you think that is critical to spend more than 2000$ in music for a game, and the music just doesn’t play? i do. Betas are intended for solve the problems before the launch of a system, and, even if I know that IOS5 is not official, i have an issue with the music that is playing in the background (since beta 4), that maybe can be interesting to fix before the upcoming launch of IOS 5.

My game has 4 different “worlds”, with many levels in each world, and every world have his own music.

When the player changes from one world to another, music changes and keeps reproducing until it changes to another world.

I use a global variable to know what music is playing, and in function of that, the game automatically changes the “splash screen” and the level selector to the world that is in play.

I use director to control the game, so, the code of the function that i use to change the music is the following:

--\> MÚSICA  
-- Analiza qué música está sonando, y si no suena la música que le corresponde al nivel  
-- detiene el audio y carga el que le corresponde. (Música y fondo, CANALES 1 y 2)  
local sonando = \_G["global"].sonando  
  
if sonando == "viajeplanetario" then  
 audio.fade( { channel = 1, time = 500, volume = 0.5 } )  
else  
 audio.stop( 1 )  
 local backgroundMusic = audio.loadStream( "musica/planeta2.mp3")  
 audio.play( backgroundMusic, { channel = 1, loops = -1 } )  
 \_G["global"].sonando = "viajeplanetario"  
end  
  
audio.setVolume( 0.5, { channel = 1 } )  
  
--\> Fin de música  

Notes:

  • i have reserved the channel 1 to the music from the main.lua code.

  • The game loads by default the music from the world 1, and if i play to the levels of the world 1 music keeps playing without problem. When i change te world, music starts playing (for only 2 or 3 seconds) while it’s loading the level (just as expected) and when the level is shown in the screen, music stops (the rest of the sound effects plays as normally). This makes me think that maybe the problem is in this portion of the code atached bellow:

else  
 audio.stop( 1 )  
 local backgroundMusic = audio.loadStream( "musica/planeta2.mp3")  
 audio.play( backgroundMusic, { channel = 1, loops = -1 } )  
 \_G["global"].sonando = "viajeplanetario"  
end  
  
audio.setVolume( 0.5, { channel = 1 } )  
  • And the most important of all: music plays well and as expected on iOS 4.3, and on the first betas of ios 5. Is since the iOS 5 BETA 4 that i’m having this problem with the music.

PD: additionally, i have found another small issue: the pre-rendered icons since iOS 5 beta 4 are not working. This means that, even if i specify that my icon is pre-rendered in the “bulid.settings” (UIPrerenderedIcon = true,), iOS 5 treats my icon as not pre-rendered. I know this is a general “new feature” of iOS 5, because very much applications (not related with corona) are having the same issue. [import]uid: 14235 topic_id: 13844 reply_id: 313844[/import]

Have you raised a support request for this? I’m having similar problems with iOS5 betas and have raised it with support. No response yet, but hopefully they’ll get back to me ASAP. [import]uid: 26769 topic_id: 13844 reply_id: 53354[/import]

can you enter a bug number and let us know here so we can track it.

bugs.anscamobile.com

thanks
.c
[import]uid: 24 topic_id: 13844 reply_id: 53595[/import]

lordmooch - did you end up creating a bug for this? I’m experience the *exact* same phenomenon as you with iOS 5 beta test devices.

SR [import]uid: 31041 topic_id: 13844 reply_id: 56590[/import]

Update - I didn’t see a bug - Created a new one # 8186.
SR
[import]uid: 31041 topic_id: 13844 reply_id: 56593[/import]

Thanks for creating the bug report scott0. I hope that Ansca fix this behavior as soon as possible in iOS 5, because is a critical bug (almost for me, that i consider that music is a really important part of the game experience). [import]uid: 14235 topic_id: 13844 reply_id: 56986[/import]

If you are finding bugs in iOS betas, please file bug reports with Apple. That’s why they put out betas. Otherwise they won’t know about the problem and can’t fix it. And if it’s truly an Apple bug, we might not be able to do anything it. Also file a bug with us so we know about it, but the type of problem you describe really sounds like something Apple must fix.

iOS 5 beta 7 has been out for awhile now, do you still experience the problem? [import]uid: 7563 topic_id: 13844 reply_id: 57013[/import]

Hi - Thanks for the reply.
Yes, the bug has exhibited itself in all iOS betas since 4, including 7.
I am not experiencing this bug in objective-C code, and I do not know what system calls the Corona audio() package is making, so I’m not sure what kind of bug I would file with Apple. I don’t doubt that it is a bug in iOS 5 based on the console error message, but I don’t have the information necessary to reproduce the bug in objective-C code.
Seems like if 3 corona developers experienced the bug, then at least that many objective-C devs have would have come across it as well, and hopefully filed a report with Apple. [import]uid: 31041 topic_id: 13844 reply_id: 57016[/import]

If it works in older versions of iOS, then it is an Apple regression bug unless they tell you otherwise. You have to file the bug for them to tell you otherwise.

Always file bugs with Apple. Apple counts the number of duplicates to prioritize. Never assume somebody else filed it. Most of the time, nobody else files it.

The Corona audio system is based on OpenAL. Apple implements their OpenAL on top of Core Audio/Audio Units. Apple does not provide an Obj-C API to OpenAL. They continuously make changes to their OpenAL implementation so regression bugs are possible. (I know this because I file bugs and they tell me I’m one of the few people who do.)

Send Apple all information you can. You can even tell them how to run Corona. I think you can also send them binaries and they might be able to debug from them. (Not sure about this one, but it won’t hurt.) You can also tell us what your Apple bug number is so if we learn new things, we can file our own bug reports and refer to your bug number for their convenience.

And we at Ansca internally have not experienced your bug, though now that somebody filed a bug in our Ansca system, we are at least aware of this issue now. Don’t assume we see all the messages on the forums.

[import]uid: 7563 topic_id: 13844 reply_id: 57043[/import]

We’ve filed a bug report with Apple. They’ve requested our app so they can try to replicate the bug. More news as we get it! [import]uid: 26769 topic_id: 13844 reply_id: 57052[/import]

Ok, at this point i think that we (all) need to be helpful and not to discuss on where we need to fire a bug.

I understand that is difficult to the Ansca staff, find a bug that you are not reproducing. But understand to us too: Corona is practically opaque, a sandbox, when the game or app runs in the device. We don´t get standard error messages (related to OUR app, because the error messages we get in xcode are related to the entire app, including the Corona part).

The fact here is that we need to be practical and not to discuss:

How to reproduce the issue:

  1. Reserve the channel 1
  2. Play a LONG sound in the channel 1 previously reserved
  3. Stop the sound in the channel 1
  4. Play another LONG sound in the channel 1
  5. The sound in the channel 1 will stop after 1 or 2 seconds.
  6. If you have the phone connected to the XCODE ORGANIZER, you’ll get an ERROR code in the CONSOLE just when the sound STOPS itself (not when you stop it manually). I mean, you get an ERROR in the step 5.

The KEYS:

Note that no matter how many channels you reserve. The key here is that when you STOP a channel, it won’t play again long sounds. I don’t know if the problem is with Corona + iOS 5, only iOS 5, Corona + Director + iOS 5.

If you use a different channel to reproduce a song, it reproduces with no problem. When you STOP manually this new channel, you get the same problem again.

This can be helpful for APPLE: this problem appears ONLY since iOS 5 BETA 4 and above. Previous betas doesn’t show this behavior, so this can be the result of a change introduced in this iOS 5 BETA 4. [import]uid: 14235 topic_id: 13844 reply_id: 57088[/import]

Several important points. For Apple betas (Mac and iOS), it is critical you file bugs with Apple due to the short time window. Once they lock down the golden master for release, you are stuck with the bug forever. I mean forever in that even if Apple eventually fixes it, you still have to worry about supporting customers that don’t upgrade their OS which is a real pain for everybody. That’s why you must file early and file often.

By all means, file bugs with us too, but particularly for things that look like Apple bugs (e.g. regression behavior), you increase your chances of getting the bugs fixed if you also submit to Apple. We are a small staff at Ansca responsible for working on new features and not just bugs, so it can sometimes take us extra time to test/confirm your specific bug and take appropriate action. For an Apple bug, this makes us a middleman and a bottleneck. With such a narrow time window before Apple locks down their golden master, it is imperative that the bug be delivered to Apple ASAP.

Yes, Corona is mostly opaque so I understand figuring out who is responsible for the bug can be difficult sometimes. We have to do that ourselves because Apple’s OS is opaque and users don’t always send us simple reproducible test cases. And for things like Director, users can at least help out and strip out Director or any other complicated/unrelated things.

Also, you should be aware that the Corona OpenAL based audio is built on top of an open source library called ALmixer. http://playcontrol.net/opensource/ALmixer. Unlike many other parts of Corona, you can actually see how this one is implemented and use it directly. So if you want to help further isolate bugs, you can write some native iOS programs that call ALmixer (like when you were testing native Obj-C APIs) and see what’s going on. In some of my bug reports to Apple, I include ALmixer with the bug report as part of a reproducible example they can build and run.

Most of ALmixer’s debug error messages have some number followed by TestingError, e.g.
59TestingError. I didn’t recognize the error message reported in the bug report, but I don’t think it came from ALmixer.

Also, be aware that the same ALmixer code is used for all our platforms: Mac, iOS, Windows, Android (with a few differences mostly limited to the audio file decoders.) So if the same code works on one platform, then the problem is usually an OpenAL implementation bug which in Apple’s case means an Apple bug since they provide the implementation to OpenAL.
[import]uid: 7563 topic_id: 13844 reply_id: 57124[/import]

I am seeing something similar. I am really new to Corona, so I thought I was doing something wrong. Anyway, WHen my app started to play streamed music , it plays for about 2 - 3 seconds then stops. It runs fine on the Mac, but not on the iPad or iPhone. I have not tried on 4.3.3 yet.

I am loving Corona, this little thing is driving me a little nuts.

Bmrpeal, did you get it working yet?

Blade
[import]uid: 10801 topic_id: 13844 reply_id: 57547[/import]

Hi.

This problem is currently driving us mad. We’re close to submitting but are wary that once iOS 5 rolls around in a week or two people on it will face this bug with our game too.

The music literally stops after 2 seconds, on any iOS 5 device running the later beta versions. Recent betas haven’t fixed anything so can’t see how the final version would.

Bugs have been submitted to Apple, but it wouldn’t take too much for Ansca to try this for themselves IMO, as it’s a really nasty bug that’ll affect (I assume) every game that’s using Corona once people start to upgrade to iOS 5.

Thanks. [import]uid: 28474 topic_id: 13844 reply_id: 57939[/import]

Please folks. I have asked for additional information on these bugs and nobody has provided the additional information I’ve requested. I have tried to reproduce internally, but have not experienced the problem. Obviously you people are doing things differently than me which is why I’m not experiencing the problem. This is why it is necessary for you to submit simple reproducible test cases (with media assets included) so we can just run the case. If you have submitted this information to us, post your bug numbers here because those reports have not reached me.

I’ve also asked people to test builds 606 and 608. We made some big changes to workaround Android problems and those changes could have exasperated iOS.

Also, I want to know, does the same problem exist on Mac (Lion) or just iOS? And does it exist on Windows or Android? Our audio code is pretty much identical on all platforms, so if it breaks on all platforms, that tells us something useful. If it breaks on only one platform, that tells us something else.
[import]uid: 7563 topic_id: 13844 reply_id: 58033[/import]

I’m not running Lion so I can’t comment on that, but the problem doesn’t exist on Snow Leopard.

Interestingly, the iPhone 4 running iOS 4 is the only phone that music works consistently on. That is, until we switched to AAC files to see if they worked. Then the bug appeared on iPhone 4 too.

@ewing: we’re happy to give you access to our files (can zip and send 'em over) or you can have access to our Dropbox area. You could see our source, build the app etc then if that’d help. If, indeed, I am doing something differently then I’d love to know what it is so that I can do it the right way :slight_smile: [import]uid: 26769 topic_id: 13844 reply_id: 58042[/import]

@ewing:

I have created a very simplified piece of code, with assets, to reproduce the problem. I had previously created bug 8186, but I can’t find a way to add new content to that bug – Should I create a new bug, or send the files via another method?

The problem does not occur on OSX Lion, only, as far as I have encountered, on devices running any iOS5 beta.

I download and test the daily builds as they are released, and began observing this problem prior to 608/609. I don’t have a windows or android system readily available to test on, but could get a corona installed on a windows system pretty quickly. I have not attempted to test the code in the xcode iphone simulator 5.0 yet; I’m not sure if the results of this would provide useful information or not.
Thanks-
Scott

[import]uid: 31041 topic_id: 13844 reply_id: 58050[/import]

Terrific! File a new bug and mention 8186 inside the bug report. I’ll cross-refer them or something.

Attach the files (zip) to the bug report unless it is too big in which case I recommend something like posting source code on Google Code or some other code hosting service that also allows you to post binaries.

If you could test 606, that would be a big help. That was the build right before the big audio changes I believe. That will tell me if our new changes are related to the problem.

Don’t worry about the Xcode simulator. Windows would be nice, but if it doesn’t occur on Mac, then I will probably assume it is an iOS specific issue.
[import]uid: 7563 topic_id: 13844 reply_id: 58053[/import]

@ewing: New bug report has been filed (#8401) with attached sample code/assets.

I downloaded 606 and confirmed that the problem still happens when built for iOS with that version.

Thanks,
Scott

[import]uid: 31041 topic_id: 13844 reply_id: 58055[/import]

As we are using very small loops for music, we decided to try loadSound() instead of loadStream(). So far this has fixed the problem on iOS 5. Still waiting to hear back from our 3G/3GS testers, but fingers crossed. [import]uid: 26769 topic_id: 13844 reply_id: 58058[/import]