Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Importing to Xcode: music still plays while app is in the background

edited November 2014 in General Posts: 557

I want to try to get my daughter's adventure games onto the app store.

I've imported my app to Xcode, and it mostly runs great.

One thing though: I play looping music in my app, and when the app goes to the background (like when you switch apps or leave an app and go to the home screen) the music keeps playing.

How do I make the music mute itself when the app is in the background, and then turn itself back on when it becomes the main app again?

Tagged:

Comments

  • @UberGoober I use music() on setup function, did you try this?

  • I call music(foo) in a different function than that. Should it matter?

  • Posts: 688

    I think it's important for Codea apps to be able to detect when this event (along with the close event) happens so we can ensure the app state is set correctly.

  • If I make that edit in Xcode will it work? Or do I have to do it in Codea and then re-import it?

  • @UberGoober , you can edit in xCode

  • edited November 2014 Posts: 300

    I just put music(filename,true,1) in setup and it works fine.

  • edited November 2014 Posts: 557

    Is it then the case that any looping music has to start from the beginning of the program and play without interruption for it to behave properly?

    If one starts it at any other time it won't behave?

  • Posts: 2,042

    @UberGoober, I use looping music in my exported projects (not called from setup), and if you exit the app it keeps playing for a few seconds, but then it fades out.

  • Hm. I'll have to test it on different ipad simulators. Maybe it's just a problem with the iPad Air Simulator.

Sign In or Register to comment.