AVAudioPlayerNodeCompletionHandler

Type Alias AVAudioPlayerNodeCompletionHandler 

Source
pub type AVAudioPlayerNodeCompletionHandler = *mut DynBlock<dyn Fn(AVAudioPlayerNodeCompletionCallbackType)>;
Available on crate features AVAudioPlayerNode and block2 only.
Expand description

Buffer or file completion callback handler.

Parameter callbackType: Indicates the type of buffer or file completion when the callback is invoked.

AVAudioPlayerNode issues this callback to inform the client about the specific type of buffer or file completion. See AVAudioPlayerNodeCompletionCallbackType for more details.

Note that the AVAudioNodeCompletionHandler callback from some of the player’s scheduling methods (e.g. scheduleBuffer:completionHandler:) is equivalent to the AVAudioPlayerNodeCompletionHandler callback for AVAudioPlayerNodeCompletionDataConsumed.

In general the callbacks arrive on a non-main thread and it is the client’s responsibility to handle them in a thread-safe manner.

Setting or getting properties on an AVAudioPlayerNode while the AVAudioEngine is running requires some synchronisation between the calling threads internally. If you want to call player node API within this completion handler block, calls should be synchronised to the same thread/queue.

See also Apple’s documentation