How can I get background music to restart after an interruption such as a call

Viewed 28

Background music in my game works fine and plays behind other sounds that get activated. The back ground music is in Did Move to view and is a SKAudionode. When a call is received the background music stops and does not restart even if the home button is pressed and game restarted.

I have seen some other topics but they all seem to be related to AVAudioplayer which I have tried for background music but it gave me a different set of issues so I would prefer to use SKAudionode.

The code for the background music is below. Any help would be appreciated.

var backgroundMusic: SKAudioNode!

    override func didMove(to view: SKView) {
    if let musicURL = Bundle.main.url(forResource: "playlistbj", withExtension: "mp3") {
    backgroundMusic = SKAudioNode(url: musicURL)
        addChild(backgroundMusic)}

}
0 Answers
Related