# Print output for @column tags ?> AudioTrack.StreamEventCallback - Android SDK | Android Developers

Most visited


Recently visited


AudioTrack.StreamEventCallback

public static abstract class AudioTrack.StreamEventCallback
extends Object

java.lang.Object
   ↳ android.media.AudioTrack.StreamEventCallback


Abstract class to receive event notifications about the stream playback in offloaded mode. See AudioTrack#registerStreamEventCallback(Executor, StreamEventCallback) to register the callback on the given AudioTrack instance.

Summary


Public constructors

StreamEventCallback()

Public methods

void onDataRequest(AudioTrack track, int sizeInFrames)

Called when more audio data can be written without blocking on an offloaded track.

void onPresentationEnded(AudioTrack track)

Called when all the buffers of an offloaded track that were queued in the audio system (e.g. the combination of the Android audio framework and the device's audio hardware) have been played after AudioTrack#stop() has been called.

void onTearDown(AudioTrack track)

Called when an offloaded track is no longer valid and has been discarded by the system.

Inherited methods

Public constructors


StreamEventCallback

public StreamEventCallback ()

Public methods


onDataRequest

public void onDataRequest (AudioTrack track, 
                int sizeInFrames)

Called when more audio data can be written without blocking on an offloaded track.

Parameters
track AudioTrack: the AudioTrack on which the event happened. This value cannot be null.

sizeInFrames int: the number of frames available to write without blocking. Note that the frame size of a compressed stream is 1 byte. Value is 0 or greater

onPresentationEnded

public void onPresentationEnded (AudioTrack track)

Called when all the buffers of an offloaded track that were queued in the audio system (e.g. the combination of the Android audio framework and the device's audio hardware) have been played after AudioTrack#stop() has been called.

Parameters
track AudioTrack: the AudioTrack on which the event happened. This value cannot be null.

onTearDown

public void onTearDown (AudioTrack track)

Called when an offloaded track is no longer valid and has been discarded by the system. An example of this happening is when an offloaded track has been paused too long, and gets invalidated by the system to prevent any other offload.

Parameters
track AudioTrack: the AudioTrack on which the event happened. This value cannot be null.

Browse this site in English?

You requested a page in English, but your language preference for this site is English.

Would you like to change your language preference and browse this site in English? If you want to change your language preference later, use the language menu at the bottom of each page.