0

In my game built with SpriteKit, I have a music player in a GameScene declared as follow:

    private var backgroundMusic: SKAudioNode?

In sceneDidLoad() I instantiate it and add it to the scene:

    if let musicURL = Bundle.main.url(forResource: "GameSong", withExtension: "mp3") {
        backgroundMusic = SKAudioNode(url: musicURL)
        backgroundMusic?.run(SKAction.changeVolume(to: 0, duration: 0))
        addChild(backgroundMusic!)
        backgroundMusic?.run(SKAction.changeVolume(to: 1, duration: 3))
    }

The sound is actually played as intended when the audio node is added, but I get a lot of throwing -10878 outputs printed in the console. Running iOS 15, this occurs both on simulator and real device.

I've searched quite a bit on this site and, although there is no clear answer about why this happens, with some users guessing it is just an harmless noise, there is actually a solution posted by Vitaliy69.

The issue is that this is a lower level solution, and I don't really know how to implement it with SKAudioNode. Any way I can solve this?

Related questions

  1. SCNAudioPlayer is throwing -10878

  2. Getting "throwing -10878" when adding a source to a mixer

  3. In iOS 15, 'throwing -10878' occurs many times when connecting AVAudioPlayerNode to mainMixerNode

oneshot
  • 591
  • 1
  • 5
  • 27

0 Answers0