AudioSink.Listener
public interface AudioSink.Listener
Listener for audio sink events.
Summary
Public methods |
|
|---|---|
default void |
Called when audio capabilities changed. |
default void |
onAudioSessionIdChanged(int audioSessionId)Called when the audio session ID changed internally. |
default void |
onAudioSinkError(Exception audioSinkError)Called when |
default void |
onAudioTrackInitialized(AudioSink.AudioTrackConfig audioTrackConfig)Called when an |
default void |
onAudioTrackReleased(AudioSink.AudioTrackConfig audioTrackConfig)Called when an |
default void |
Called when the offload buffer has been partially emptied. |
default void |
Called when the offload buffer has been filled completely. |
default void |
onPositionAdvancing(long playoutStartSystemTimeMs)Called when the audio sink's position has increased for the first time since it was last paused or flushed. |
abstract void |
Called when the audio sink handles a buffer whose timestamp is discontinuous with the last buffer handled since it was reset. |
default void |
Called when a period of silence has been skipped. |
abstract void |
onSkipSilenceEnabledChanged(boolean skipSilenceEnabled)Called when skipping silences is enabled or disabled. |
abstract void |
onUnderrun(Called when the audio sink runs out of data. |
Public methods
onAudioCapabilitiesChanged
default void onAudioCapabilitiesChanged()
Called when audio capabilities changed.
onAudioSessionIdChanged
default void onAudioSessionIdChanged(int audioSessionId)
Called when the audio session ID changed internally.
The audio sink will ignore new externally set audio session IDs until this ID has been acknowledged with setAudioSessionId.
| Parameters | |
|---|---|
int audioSessionId |
The new audio session ID. |
onAudioSinkError
default void onAudioSinkError(Exception audioSinkError)
Called when AudioSink has encountered an error.
If the sink writes to a platform AudioTrack, this will called for all AudioTrack errors.
This method being called does not indicate that playback has failed, or that it will fail. The player may be able to recover from the error (for example by recreating the AudioTrack, possibly with different settings) and continue. Hence applications should not implement this method to display a user visible error or initiate an application level retry (onPlayerError is the appropriate place to implement such behavior). This method is called to provide the application with an opportunity to log the error if it wishes to do so.
Fatal errors that cannot be recovered will be reported wrapped in a ExoPlaybackException by onPlayerError.
| Parameters | |
|---|---|
Exception audioSinkError |
The error that occurred. Typically an |
onAudioTrackInitialized
default void onAudioTrackInitialized(AudioSink.AudioTrackConfig audioTrackConfig)
Called when an AudioTrack has been initialized.
| Parameters | |
|---|---|
AudioSink.AudioTrackConfig audioTrackConfig |
The |
onAudioTrackReleased
default void onAudioTrackReleased(AudioSink.AudioTrackConfig audioTrackConfig)
Called when an AudioTrack has been released.
| Parameters | |
|---|---|
AudioSink.AudioTrackConfig audioTrackConfig |
The |
onOffloadBufferEmptying
default void onOffloadBufferEmptying()
Called when the offload buffer has been partially emptied.
onOffloadBufferFull
default void onOffloadBufferFull()
Called when the offload buffer has been filled completely.
onPositionAdvancing
default void onPositionAdvancing(long playoutStartSystemTimeMs)
Called when the audio sink's position has increased for the first time since it was last paused or flushed.
| Parameters | |
|---|---|
long playoutStartSystemTimeMs |
The approximate derived |
onPositionDiscontinuity
abstract void onPositionDiscontinuity()
Called when the audio sink handles a buffer whose timestamp is discontinuous with the last buffer handled since it was reset.
onSkipSilenceEnabledChanged
abstract void onSkipSilenceEnabledChanged(boolean skipSilenceEnabled)
Called when skipping silences is enabled or disabled.
| Parameters | |
|---|---|
boolean skipSilenceEnabled |
Whether skipping silences is enabled. |
onUnderrun
abstract void onUnderrun(
int bufferSize,
long bufferSizeMs,
long elapsedSinceLastFeedMs
)
Called when the audio sink runs out of data.
An audio sink implementation may never call this method (for example, if audio data is consumed in batches rather than based on the sink's own clock).
| Parameters | |
|---|---|
int bufferSize |
The size of the sink's buffer, in bytes. |
long bufferSizeMs |
The size of the sink's buffer, in milliseconds, if it is configured for PCM output. |
long elapsedSinceLastFeedMs |
The time since the sink was last fed data, in milliseconds. |