<!--
{
  "availability" : [
    "iOS: 11.0.0 - 27.0.0",
    "iPadOS: 11.0.0 - 27.0.0",
    "macCatalyst: 13.1.0 - 27.0.0",
    "macOS: 10.13.0 - 27.0.0",
    "tvOS: 11.0.0 - 27.0.0",
    "visionOS: 1.0.0 - 27.0.0",
    "watchOS: 4.0.0 - 27.0.0"
  ],
  "documentType" : "symbol",
  "framework" : "AVFoundation",
  "identifier" : "/documentation/AVFoundation/AVQueuedSampleBufferRendering/requestMediaDataWhenReady(on:using:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "AVFoundation"
    ],
    "preciseIdentifier" : "c:objc(pl)AVQueuedSampleBufferRendering(im)requestMediaDataWhenReadyOnQueue:usingBlock:"
  },
  "title" : "requestMediaDataWhenReady(on:using:)"
}
-->

# requestMediaDataWhenReady(on:using:)

Tells the target to invoke a client-supplied block in order to gather sample buffers for playback.

```
func requestMediaDataWhenReady(on queue: dispatch_queue_t, using block: @escaping @Sendable () -> Void)
```

## Parameters

`queue`

The dispatch queue.

`block`

A block that enqueues sample buffers until the receiver is no longer ready or there is no more data to supply.

## Discussion

When this method is called multiple times, only the last call is implemented. Pair each call to [`requestMediaDataWhenReady(on:using:)`](/documentation/AVFoundation/AVQueuedSampleBufferRendering/requestMediaDataWhenReady(on:using:)) with a corresponding call to [`stopRequestingMediaData()`](/documentation/AVFoundation/AVQueuedSampleBufferRendering/stopRequestingMediaData()). Releasing the `AVQueuedSampleBufferRendering` object without a call to `stopRequestingMediaData` results in undefined behavior.

---

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)