---
title: numberOfLoops
framework: avfaudio
role: symbol
role_heading: Instance Property
path: avfaudio/avaudioplayer/numberofloops
---

# numberOfLoops

The number of times the audio repeats playback.

## Declaration

```swift
var numberOfLoops: Int { get set }
```

## Discussion

Discussion The default value of 0 results in the sound playing once. Set a positive integer value to specify the number of times to repeat the sound. For example, a value of 1 plays the sound twice: the original sound and one repetition. Set a negative integer value to loop the sound continuously until you call the stop() method.

## See Also

### Configuring playback settings

- [volume](avfaudio/avaudioplayer/volume.md)
- [setVolume(_:fadeDuration:)](avfaudio/avaudioplayer/setvolume(_:fadeduration:).md)
- [pan](avfaudio/avaudioplayer/pan.md)
- [enableRate](avfaudio/avaudioplayer/enablerate.md)
- [rate](avfaudio/avaudioplayer/rate.md)
