2

The documentation:

pause()

Creates an action that tells an audio node to pause playback.

Declaration class func pause() -> SKAction

This action may only be executed on an SKAudioNode object. The audio is paused, and if restarted, resumes at where it was paused. This action is not reversible.

Please excuse my ignorance, I simply have no idea how to use this to pause an SKAudioNode, so have not tried any code, and have no code to display, as I don't know HOW to use this, and find this barebones documentation a little too light.

Confused
  • 5,839
  • 6
  • 26
  • 65

1 Answers1

4

SKAudioNodes are SKNodes and so are able to run any SKAction. So get a pause action and ask the node to run it (in Swift):

let audio : SKAudioNode
...
let pause = SKAction.pause()
audio.run(pause) 

or shorter:

audio.run(SKAction.pause())
Jean-Baptiste Yunès
  • 30,872
  • 2
  • 40
  • 66