Background Audio AGAIN!!

Monkey Targets Forums/iOS/Background Audio AGAIN!!

ElectricBoogaloo(Posted 2013) [#1]
*sigh*
Every single time, they make this more and more awkward.

It's a MUSIC PLAYER! Playing music should not be complicated!!

XCode5 with iOS7, with all the usual "Allow the user's current background music to keep playing when my App is run" stuff.
Doesn't work.
As per usual.

I've hunted the AppleDocs, but I can't fathom it out.

Would anyone like to figure this out for me?
Thanks, all help appreciated.


ElectricBoogaloo(Posted 2013) [#2]
Still banging my head with this one..

I think I'm slowly tracking it down.
If you hop out of the app, and back in, the app does indeed share audio, so you can load your game, flip over to Music Player, kick it back into gear, then hop back over to your game, and the audio is nicely sharing..
So, once the App's loaded, it shares nicely and behaves.

The problem occurs during App Launch.
Something, somewhere is cutting off background audio, and for the life of me I can't manage to track down what/where.
I thought it might've been something like "Initialise before Settings" so I tried flipping those around a bit, and that didn't seem to fix it.
It's really irritating me, because other games are playing nice with iOS7.. It's just MINE that aren't!

Any help appreciated..


siread(Posted 2013) [#3]
I thought this had been solved. Mark included the code in this thread:

http://www.monkeycoder.co.nz/Community/posts.php?topic=3057


ElectricBoogaloo(Posted 2013) [#4]
Something is different in iOS7.
Something Changed.

Although it does "share" if you multitask out and in, if you already have music playing before you initially launch your monkey game, it now stops the background music.
Something seems to be cutting off background audio BEFORE it gets to the stuff mentioned in that thread, because once the game's up and running, it'll share nicely.

In short, the old stuff ALMOST works, but something else is breaking it. I'm still trying to figure out what that something else might be..


skid(Posted 2013) [#5]
Maybe try opening the ALCDevice after setting the audio session properties?


ElectricBoogaloo(Posted 2013) [#6]
Tried that, didn't make a difference.

Really winding me up, this one, because everything else is running swimmingly..
Still, tonight's my deadline.
If I can't fathom it by about 10pm, I'm just going to upload my next update as-is, with this annoyingly frustrating issue in it.

Grrrr!


siread(Posted 2013) [#7]
Damn, you're right. Submitting my app today as well. This will have to wait until the next update.

Looks like some info here but I don't have time to mess about with it...
https://developer.apple.com/library/ios/documentation/Audio/Conceptual/AudioSessionProgrammingGuide/Cookbook/Cookbook.html


ElectricBoogaloo(Posted 2013) [#8]
BlastTrax uploaded with audio-stopping issue intact :/

I'll keep poking and prodding, and let you know if I figure it out.


Difference(Posted 2013) [#9]
I know that this is another issue, but maybe you can find some inspiration in this fix for another ios audio multitasking issue:

http://monkeycoder.co.nz/Community/posts.php?topic=6016