---
title: copyNextSampleBuffer()
framework: avfoundation
role: symbol
role_heading: Instance Method
path: avfoundation/avassetreaderoutput/copynextsamplebuffer()
---

# copyNextSampleBuffer()

Copies the next sample buffer from the output.

## Declaration

```swift
func copyNextSampleBuffer() -> CMSampleBuffer?
```

## Return Value

Return Value The output sample buffer, or nil if you’ve read all samples or an error occurs.

## Discussion

Discussion This method returns nil when you’ve read all available sample buffers, or if there’s an error. Check the value of the asset reader’s status property to determine the reason.

## See Also

### Copying sample buffers

- [AVAssetReaderOutput.Provider](avfoundation/avassetreaderoutput/provider.md)
- [AVAssetReaderOutput.RandomAccessController](avfoundation/avassetreaderoutput/randomaccesscontroller.md)
- [AVAssetReaderOutput.SupportedPayload](avfoundation/avassetreaderoutput/supportedpayload.md)
