3

I start playing an audio file like this in a SceneKit app; It is playing the file surprisingly!

I can call first function to start playing again.

But at first call to start player I am having this message many times; I could not find why.

testsScene[17737:968214] throwing -10878

var backgroundAudioPlayer:SCNAudioPlayer?


func someFunction(){

  DispatchQueue.main.async { [self] in
            backgroundAudioPlayer = SCNAudioPlayer(source: "background0.mp3")
            worldNode.addAudioPlayer(backgroundAudioPlayer!)
        }

}

and stop in this way;

func someOtherFunction(){
  DispatchQueue.main.async { [self] in
                
    worldNode.removeAudioPlayer(backgroundAudioPlayer!)

               }

 }
Hope
  • 2,096
  • 3
  • 23
  • 40

0 Answers0