How to cancel the playback of sound started with AudioServicesPlaySystemSound?

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

+7
source share
1 answer

Unfortunately, you cannot, as the name suggests, it is designed to play sounds that will be used for system alerts, where you do not need to control them. You can stop the sound played through AudioServicesPlaySystemSound() by calling AudioServicesDisposeSystemSoundID() , but this is hacked and best avoided.

The best option for simple and easy audio playback control is to use AVPlayer , part of AVFoundation is the documentation here .

+9
source

All Articles