Instance Property

numberOfLoops

The number of times a sound will return to the beginning, upon reaching the end, to repeat playback.

Declaration

@property NSInteger numberOfLoops;

Discussion

A value of 0, which is the default, means to play the sound once. Set a positive integer value to specify the number of times to return to the start and play again. For example, specifying a value of 1 results in a total of two plays of the sound. Set any negative integer value to loop the sound indefinitely until you call the stop method.

See Also

Configuring and Controlling Playback

- play

Plays a sound asynchronously.

- playAtTime:

Plays a sound asynchronously, starting at a specified point in the audio output device’s timeline.

- pause

Pauses playback; sound remains ready to resume playback from where it left off.

- stop

Stops playback and undoes the setup needed for playback.

- prepareToPlay

Prepares the audio player for playback by preloading its buffers.

- setVolume:fadeDuration:

Fades to a new volume over a specific duration.

playing

A Boolean value that indicates whether the audio player is playing (YES) or not (NO).

volume

The playback volume for the audio player, ranging from 0.0 through 1.0 on a linear scale.

pan

The audio player’s stereo pan position.

rate

The audio player’s playback rate.

enableRate

A Boolean value that specifies whether playback rate adjustment is enabled for an audio player.

delegate

The delegate object for the audio player.

AVAudioPlayerDelegate

A protocol that allows a delegate to respond to audio interruptions and audio decoding errors, and to the completion of a sound’s playback.

settings

The audio player’s settings dictionary, containing information about the sound associated with the player.

Beta Software

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