---
title: nextSampleBuffer()
framework: avfoundation
role: symbol
role_heading: Instance Method
path: avfoundation/avplayeritemsamplebufferoutput/nextsamplebuffer()
---

# nextSampleBuffer()

Returns next sample buffer once it becomes available.

## Declaration

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

## Discussion

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() for grabbing the generated sample buffer.

## See Also

### Retrieving sample buffers

- [nextAvailableSampleBuffer()](avfoundation/avplayeritemsamplebufferoutput/nextavailablesamplebuffer().md)
- [AVPlayerItemSampleBufferOutput.SampleBufferInSequence](avfoundation/avplayeritemsamplebufferoutput/samplebufferinsequence.md)
