spencra spencra - 3 months ago 11x
iOS Question

Let other apps play background music

I would like to add the functionality for other apps, such as Pandora or iTunes, to continue playing music while my Sprite Kit game is open.

How would I go about doing this? I apologize for the somewhat broadness of this question, I just can't find a lot of information on this.


Set your AVAudioSession category to Ambient.

import AVFoundation

    do {
        try AVAudioSession.sharedInstance().setCategory(AVAudioSessionCategoryAmbient)
        try AVAudioSession.sharedInstance().setActive(true)
    catch let error as NSError {

AVAudioSession Class Reference