---
title: "scheduleBuffer(buffer:completionCallbackType:completionHandler:)"
framework: phase
role: symbol
role_heading: Instance Method
path: "phase/phasepushstreamnode/schedulebuffer(buffer:completioncallbacktype:completionhandler:)"
---

# scheduleBuffer(buffer:completionCallbackType:completionHandler:)

Schedules audio data playback with a completion handler.

## Declaration

```swift
func scheduleBuffer(buffer: AVAudioPCMBuffer, completionCallbackType: PHASEPushStreamCompletionCallbackCondition, completionHandler: @escaping @Sendable (PHASEPushStreamCompletionCallbackCondition) -> Void)
```

```swift
func scheduleBuffer(buffer: AVAudioPCMBuffer, completionCallbackType: PHASEPushStreamCompletionCallbackCondition) async -> PHASEPushStreamCompletionCallbackCondition
```

## Parameters

- `buffer`: Data that represents one portion of a contiguous audio stream.
- `completionCallbackType`: The specific event on which to handle completion.
- `completionHandler`: Code the framework runs on completion or when the player stops.

## Discussion

Discussion important: You can call this method from synchronous code using a completion handler, as shown on this page, or you can call it as an asynchronous method that has the following declaration: func scheduleBuffer(buffer: AVAudioPCMBuffer, completionCallbackType: PHASEPushStreamCompletionCallbackCondition) async -> PHASEPushStreamCompletionCallbackCondition For information about concurrency and asynchronous code in Swift, see Calling Objective-C APIs Asynchronously.

## See Also

### Providing Audio Data

- [scheduleBuffer(buffer:)](phase/phasepushstreamnode/schedulebuffer(buffer:).md)
- [scheduleBuffer(buffer:time:options:)](phase/phasepushstreamnode/schedulebuffer(buffer:time:options:).md)
- [scheduleBuffer(buffer:time:options:completionCallbackType:completionHandler:)](phase/phasepushstreamnode/schedulebuffer(buffer:time:options:completioncallbacktype:completionhandler:).md)
- [PHASEPushStreamCompletionCallbackCondition](phase/phasepushstreamcompletioncallbackcondition.md)
