<!--
{
  "availability" : [
    "iOS: 2.2.0 -",
    "iPadOS: 2.2.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.7.0 -",
    "tvOS: 9.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 3.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "AVFAudio",
  "identifier" : "/documentation/AVFAudio/AVAudioPlayer/prepareToPlay()",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "AVFAudio"
    ],
    "preciseIdentifier" : "c:objc(cs)AVAudioPlayer(im)prepareToPlay"
  },
  "title" : "prepareToPlay()"
}
-->

# prepareToPlay()

Prepares the player for audio playback.

```
func prepareToPlay() -> Bool
```

## Return Value

<doc://com.apple.documentation/documentation/Swift/true> if the system successfully prepares the player; otherwise, <doc://com.apple.documentation/documentation/Swift/false>.

## Discussion

Calling this method preloads audio buffers and acquires the audio hardware necessary for playback. This method activates the audio session, so pass <doc://com.apple.documentation/documentation/Swift/false> to [`setActive:error:`](/documentation/AVFAudio/AVAudioSession/setActive:error:) if immediate playback isn’t necessary. For example, when using the category option [`duckOthers`](/documentation/AVFAudio/AVAudioSession/CategoryOptions-swift.struct/duckOthers), this method lowers the audio outside of the app.

The system calls this method when using the method [`play()`](/documentation/AVFAudio/AVAudioPlayer/play()), but calling it in advance minimizes the delay between calling `play()` and the start of sound output.

Calling [`stop()`](/documentation/AVFAudio/AVAudioPlayer/stop()), or allowing a sound to finish playing, undoes this setup.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)