Instance Method prepare To Play()
Prepares the audio player for playback by preloading its buffers.
iOS 2.2+ macOS 10.7+ UIKit for Mac 13.0+ Beta tvOS 9.0+ watchOS 3.2+ Declaration func prepareToPlay() ->
Bool Return Value
on success, or
Calling this method preloads buffers and acquires the audio hardware needed for playback, which minimizes the lag between calling the
method and the start of sound output.
method, or allowing a sound to finish playing, undoes this setup.
stop() See Also Configuring and Controlling Playback func pause ()
Pauses playback; sound remains ready to resume playback from where it left off.
func stop ()
Stops playback and undoes the setup needed for playback.
var is Playing : Bool
A Boolean value that indicates whether the audio player is playing (
) or not (
false var volume : Float
The playback volume for the audio player, ranging from
on a linear scale.
1 .0 var enable Rate : Bool
A Boolean value that specifies whether playback rate adjustment is enabled for an audio player.
var number Of Loops : Int
The number of times a sound will return to the beginning, upon reaching the end, to repeat playback.
protocol AVAudio Player Delegate
A protocol that allows a delegate to respond to audio interruptions and audio decoding errors, and to the completion of a sound’s playback.
This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.
Learn more about using Apple's beta software