I have tried to play audio in my Sprite Kit game with the line:
self.run(SKAction.playSoundFileNamed("DingSoundEffect.wav", waitForCompletion: false))
However nothing seems to happen. I looked at another swift2 solution as well but it did not seem to work either.
var sound = SKAction.playSoundFileNamed("sound.mp3", waitForCompletion: false)
override func didMoveToView(view: SKView) {
playSound(sound)
//call playSound method when you want
}
func playSound(sound : SKAction)
{
runAction(sound)
}
My app does not crash, however I can not hear a sound being played. Can I use this method to play audio in Swift 3 or do I have to use the AVAudioPlayer. Thanks in advance.