Music cut off when app starts

Monkey Targets Forums/iOS/Music cut off when app starts

Shinkiro1(Posted 2014) [#1]
Background music, such as iTunes will be cut off when the app first launches.

If it's already started it continues to play as expected (with siread's 'magic' code that is already implemented).

So how can we make it so background music is never cut off?

PS: Using monkey v78h


Shinkiro1(Posted 2014) [#2]
*push


Shinkiro1(Posted 2014) [#3]
Is everybody shipping their games with this behaviour?


Oddball(Posted 2014) [#4]
Yep. No idea to change it so it stays.


Raul(Posted 2014) [#5]
I did not even notice that. Good lord Apple doesn't make this a requirement. I think Microsoft have some rules about that.


CopperCircle(Posted 2016) [#6]
Did anyone ever find a fix for this?


ElectricBoogaloo(Posted 2016) [#7]
I was going to have a poke/prod myself, a few months ago, then iOS10 turned up and I thought "meh, leave it until that's settled.. It'll probably break something!"
I haven't bothered to even try, yet!


CopperCircle(Posted 2016) [#8]
I found a solution, but it involves a change to the target, I'll post it when I am on my main computer that has monkey.


CopperCircle(Posted 2016) [#9]
if you go to modules > native > monkeytarget.cpp you will find “didFinishLaunchingWithOptions” method. Just in the beginning of it I have added:

[[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategoryAmbient error:nil];


ElectricBoogaloo(Posted 2016) [#10]
Awesome. Thankyou. You've (hopefully) saved me a good few days of trial and error ;)


ElectricBoogaloo(Posted 2016) [#11]
Thanks again, by the way.
I finally (only just!!) got around to testing this last night, and it does indeed work a treat. So, thought I'd pop back in and say thankyou again for the advice.

Now I just need to fix the other 1,000 tweaks that Apple have made since I last compiled an iOS game.

.. Oh, joy, more icons! Woohooo!!