7

Is there a way to cancel, pause or stop a sound that started playing through a call to AudioServicesPlaySystemSound()?

openfrog
  • 40,201
  • 65
  • 225
  • 373

1 Answers1

12

Unfortunately you can't - like the name suggests, it's designed for playing sounds to be used for system alerts, where you don't need to have control over them. You can stop a sound played through AudioServicesPlaySystemSound() by calling AudioServicesDisposeSystemSoundID(), but this is a hacky and best avoided.

The best option for straightforward, simple control of audio playback is to use AVPlayer, part of AVFoundation - documentation here.

lxt
  • 31,146
  • 5
  • 78
  • 83
  • 1
    `AudioServicesDisposeSystemSoundID()` cancels nice nice, tested for `AudioServicesPlayAlertSound().` – kelin Jul 13 '17 at 07:53