---
title: prepareToPlay()
framework: avfaudio
role: symbol
role_heading: Instance Method
path: avfaudio/avmidiplayer/preparetoplay()
---

# prepareToPlay()

Prepares the player to play the sequence by prerolling all events.

## Declaration

```swift
func prepareToPlay()
```

## Discussion

Discussion The system automatically calls this method on playback, but calling it in advance minimizes the delay between calling play(_:) and the start of sound output.

## See Also

### Controlling playback

- [play(_:)](avfaudio/avmidiplayer/play(_:).md)
- [AVMIDIPlayerCompletionHandler](avfaudio/avmidiplayercompletionhandler.md)
- [stop()](avfaudio/avmidiplayer/stop().md)
- [isPlaying](avfaudio/avmidiplayer/isplaying.md)
