<!--
{
  "availability" : [
    "iOS: -",
    "iPadOS: -",
    "macCatalyst: 15.4.0 -",
    "macOS: 12.3.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "CoreMediaIO",
  "identifier" : "/documentation/CoreMediaIO/CMIOExtensionStream/consumeSampleBuffer(from:completionHandler:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Core Media I/O"
    ],
    "preciseIdentifier" : "c:objc(cs)CMIOExtensionStream(im)consumeSampleBufferFromClient:completionHandler:"
  },
  "title" : "consumeSampleBuffer(from:completionHandler:)"
}
-->

# consumeSampleBuffer(from:completionHandler:)

Consumes a sample buffer from a client.

```
func consumeSampleBuffer(from client: CMIOExtensionClient, completionHandler: @escaping @Sendable (CMSampleBuffer?, UInt64, CMIOExtensionStream.DiscontinuityFlags, Bool, (any Error)?) -> Void)
```

```
func consumeSampleBuffer(from client: CMIOExtensionClient) async throws -> (CMSampleBuffer, UInt64, CMIOExtensionStream.DiscontinuityFlags, Bool)
```

## Parameters

`client`

The client with a sample to process.

`completionHandler`

A callback the system invokes with the following data:

- `sampleBuffer`: A sample buffer that contains the media sample to consume, or `nil` if an error occurs.
- `sampleBufferSequenceNumber`: The sequence number of the current sample.
- `discontinuity`: A flag that indicates if there’s a discontinuity in the stream.
- `hasMoreSampleBuffers`: A Boolean value that indicates whether there are more buffers available.
- `error`: An optional error. If an error occurs, it contains the details of the failure.

---

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)