---
title: next()
framework: avfoundation
role: symbol
role_heading: Instance Method
path: avfoundation/avassetreaderoutput/provider/next()
---

# next()

Returns the next piece of media data.

## Declaration

```swift
nonisolated(nonsending) func next() async throws -> Payload?
```

## Return Value

Return Value Returns the next piece of media data with the specified Payload type. If no more media data is available, this method returns nil.

## Discussion

Discussion note: If the underlying reader encountered an error.

## See Also

### Reading media data

- [captionsNotPresentInPreviousGroups(in:)](avfoundation/avassetreaderoutput/provider/captionsnotpresentinpreviousgroups(in:).md)
