<!--
{
  "availability" : [
    "iOS: 27.0.0 -",
    "iPadOS: 27.0.0 -",
    "macCatalyst: -",
    "macOS: 27.0.0 -",
    "tvOS: 27.0.0 -",
    "visionOS: 27.0.0 -",
    "watchOS: 27.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "AVFoundation",
  "identifier" : "/documentation/AVFoundation/AVPlayerItemSampleBufferOutput/nextSampleBuffer()",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "AVFoundation"
    ],
    "preciseIdentifier" : "s:So30AVPlayerItemSampleBufferOutputC12AVFoundationE04nextcD0AbCE0cD10InSequenceVSgyYaF"
  },
  "title" : "nextSampleBuffer()"
}
-->

# nextSampleBuffer()

Returns next sample buffer once it becomes available.

```
nonisolated func nextSampleBuffer() async -> AVPlayerItemSampleBufferOutput.SampleBufferInSequence?
```

## Discussion

This method will wait indefinitely for the next sample buffer to become available. This method returns nil if the
current task is cancelled or if this method is called from a different task.

This method will race with [`nextAvailableSampleBuffer()`](/documentation/AVFoundation/AVPlayerItemSampleBufferOutput/nextAvailableSampleBuffer()) for grabbing the generated sample buffer.

---

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)