Prepares the audio player for playback by preloading its buffers.
- iOS 2.2+
- macOS 10.7+
- tvOS 9.0+
- watchOS 3.2+
true on success, or
false on failure.
Calling this method preloads buffers and acquires the audio hardware needed for playback, which minimizes the lag between calling the
play() method and the start of sound output.
stop() method, or allowing a sound to finish playing, undoes this setup.
Configuring and Controlling Playback
Pauses playback; sound remains ready to resume playback from where it left off.
Stops playback and undoes the setup needed for playback.
var isPlaying: Bool
A Boolean value that indicates whether the audio player is playing (
true) or not (
var volume: Float
The playback volume for the audio player, ranging from
1.0 on a linear scale.
var enableRate: Bool
A Boolean value that specifies whether playback rate adjustment is enabled for an audio player.
var numberOfLoops: Int
The number of times a sound will return to the beginning, upon reaching the end, to repeat playback.
A protocol that allows a delegate to respond to audio interruptions and audio decoding errors, and to the completion of a sound’s playback.