AudioSink.Listener
interface AudioSink.Listener
Listener for audio sink events.
Summary
Public functions |
|
|---|---|
Unit |
Called when audio capabilities changed. |
Unit |
onAudioSessionIdChanged(audioSessionId: Int)Called when the audio session ID changed internally. |
Unit |
onAudioSinkError(audioSinkError: Exception!)Called when |
Unit |
onAudioTrackInitialized(audioTrackConfig: AudioSink.AudioTrackConfig!)Called when an |
Unit |
onAudioTrackReleased(audioTrackConfig: AudioSink.AudioTrackConfig!)Called when an |
Unit |
Called when the offload buffer has been partially emptied. |
Unit |
Called when the offload buffer has been filled completely. |
Unit |
onPositionAdvancing(playoutStartSystemTimeMs: Long)Called when the audio sink's position has increased for the first time since it was last paused or flushed. |
Unit |
Called when the audio sink handles a buffer whose timestamp is discontinuous with the last buffer handled since it was reset. |
Unit |
Called when a period of silence has been skipped. |
Unit |
onSkipSilenceEnabledChanged(skipSilenceEnabled: Boolean)Called when skipping silences is enabled or disabled. |
Unit |
onUnderrun(Called when the audio sink runs out of data. |
Public functions
onAudioCapabilitiesChanged
fun onAudioCapabilitiesChanged(): Unit
Called when audio capabilities changed.
onAudioSessionIdChanged
fun onAudioSessionIdChanged(audioSessionId: Int): Unit
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 | |
|---|---|
audioSessionId: Int |
The new audio session ID. |
onAudioSinkError
fun onAudioSinkError(audioSinkError: Exception!): Unit
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 | |
|---|---|
audioSinkError: Exception! |
The error that occurred. Typically an |
onAudioTrackInitialized
fun onAudioTrackInitialized(audioTrackConfig: AudioSink.AudioTrackConfig!): Unit
Called when an AudioTrack has been initialized.
| Parameters | |
|---|---|
audioTrackConfig: AudioSink.AudioTrackConfig! |
The |
onAudioTrackReleased
fun onAudioTrackReleased(audioTrackConfig: AudioSink.AudioTrackConfig!): Unit
Called when an AudioTrack has been released.
| Parameters | |
|---|---|
audioTrackConfig: AudioSink.AudioTrackConfig! |
The |
onOffloadBufferEmptying
fun onOffloadBufferEmptying(): Unit
Called when the offload buffer has been partially emptied.
onOffloadBufferFull
fun onOffloadBufferFull(): Unit
Called when the offload buffer has been filled completely.
onPositionAdvancing
fun onPositionAdvancing(playoutStartSystemTimeMs: Long): Unit
Called when the audio sink's position has increased for the first time since it was last paused or flushed.
| Parameters | |
|---|---|
playoutStartSystemTimeMs: Long |
The approximate derived |
onPositionDiscontinuity
fun onPositionDiscontinuity(): Unit
Called when the audio sink handles a buffer whose timestamp is discontinuous with the last buffer handled since it was reset.
onSkipSilenceEnabledChanged
fun onSkipSilenceEnabledChanged(skipSilenceEnabled: Boolean): Unit
Called when skipping silences is enabled or disabled.
| Parameters | |
|---|---|
skipSilenceEnabled: Boolean |
Whether skipping silences is enabled. |
onUnderrun
fun onUnderrun(
bufferSize: Int,
bufferSizeMs: Long,
elapsedSinceLastFeedMs: Long
): Unit
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 | |
|---|---|
bufferSize: Int |
The size of the sink's buffer, in bytes. |
bufferSizeMs: Long |
The size of the sink's buffer, in milliseconds, if it is configured for PCM output. |
elapsedSinceLastFeedMs: Long |
The time since the sink was last fed data, in milliseconds. |