<!--
{
  "availability" : [
    "iOS: 6.0.0 -",
    "iPadOS: 6.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.8.0 -",
    "tvOS: 9.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "AVFoundation",
  "identifier" : "/documentation/AVFoundation/AVPlayer/preroll(atRate:completionHandler:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "AVFoundation"
    ],
    "preciseIdentifier" : "c:objc(cs)AVPlayer(im)prerollAtRate:completionHandler:"
  },
  "title" : "preroll(atRate:completionHandler:)"
}
-->

# preroll(atRate:completionHandler:)

Begins loading media data to prime the media pipelines for playback.

```
nonisolated func preroll(atRate rate: Float, completionHandler: (@Sendable (Bool) -> Void)? = nil)
```

## Parameters

`rate`

The playback rate to use when determining how much data to load.

`completionHandler`

A block to execute when the player finishes the load attempt. This block takes a single Boolean parameter that contains <doc://com.apple.documentation/documentation/Swift/true> if the data was loaded or <doc://com.apple.documentation/documentation/Swift/false> if there was a problem. For example, the value might be <doc://com.apple.documentation/documentation/Swift/false> if the preroll was interrupted by a time change or incompatible rate change.

## Discussion

This method loads data starting at the item’s current playback time. The current rate for the playback item should always be 0 prior to calling this method. After the method calls the completion handler, you can change the item’s playback rate to begin playback.

If the player object is not ready to play (its [`status`](/documentation/AVFoundation/AVPlayer/status-swift.property) property is not [`AVPlayer.Status.readyToPlay`](/documentation/AVFoundation/AVPlayer/Status-swift.enum/readyToPlay)), this method throws an exception.

---

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)