---
title: "flush(fromSourceTime:)"
framework: avfoundation
role: symbol
role_heading: Instance Method
path: "avfoundation/avsamplebufferaudiorenderer/receiver/flush(fromsourcetime:)"
---

# flush(fromSourceTime:)

Flushes enqueued sample buffers with presentation time stamps later than or equal to the specified time. This method suspends until the flush is completed.

## Declaration

```swift
nonisolated(nonsending) func flush(fromSourceTime sourceTime: CMTime) async -> Bool
```

## Parameters

- `sourceTime`: The source time for the flush to take effect.

## Return Value

Return Value If the flush was successful, this method returns true. Otherwise it returns false.

## Discussion

Discussion This method can be used to replace media data scheduled to be rendered in the future, without interrupting playback.  One example of this is when the data that has already been enqueued is from a sequence of two songs and the second song is swapped for a new song.  In this case, this method would be called with the time stamp of the first sample buffer from the second song.  After this method resumes returning true, media data may again be enqueued with timestamps at the specified time. If this method returns false, the flush did not succeed and the set of enqueued sample buffers remains unchanged.  A flush can fail because the source time was too close to (or earlier than) the current time or because the current configuration of the receiver does not support flushing at a particular time.  In these cases, the caller can choose to flush all enqueued media data by invoking the flush() method.

## See Also

### Flushing the receiver

- [flush()](avfoundation/avsamplebufferaudiorenderer/receiver/flush().md)
- [AVSampleBufferAudioRenderer.Receiver.SuggestedFlushReason](avfoundation/avsamplebufferaudiorenderer/receiver/suggestedflushreason.md)
