Plays a system sound object.
- iOS 2.0+
- macOS 10.5+
- UIKit for Mac 13.0+Beta
- tvOS 9.0+
The system sound to play. Before using this function, call the
Audiofunction to obtain a system sound.
Services Create System Sound ID(_: _:)
This function plays a short sound (30 seconds or less in duration). Because sound might play for several seconds, this function is executed asynchronously. To know when a sound has finished playing, call the
Audio function to register a callback function.
On some iOS devices, you can pass the
k constant to invoke vibration. On other iOS devices, calling this function with that constant does nothing.
Sound files that you play using this function must be:
No longer than 30 seconds in duration
In linear PCM or IMA4 (IMA/ADPCM) format
Packaged in a
In addition, when you use the
Sounds play at the current system audio volume, with no programmatic volume control available
Sounds play immediately
Looping and stereo positioning are unavailable
Simultaneous playback is unavailable: You can play only one sound at a time
The sound is played locally on the device speakers; it does not use audio routing.