AudioRendererEventListener
@UnstableApi
public interface AudioRendererEventListener
Listener of audio Renderer
events. All methods have no-op default implementations to allow selective overrides.
Summary
Nested types |
---|
public final class AudioRendererEventListener.EventDispatcher Dispatches events to an |
Public methods |
|
---|---|
default void |
onAudioCodecError(Exception audioCodecError) Called when an audio decoder encounters an error. |
default void |
onAudioDecoderInitialized( Called when a decoder is created. |
default void |
onAudioDecoderReleased(String decoderName) Called when a decoder is released. |
default void |
onAudioDisabled(DecoderCounters counters) Called when the renderer is disabled. |
default void |
onAudioEnabled(DecoderCounters counters) Called when the renderer is enabled. |
default void |
onAudioInputFormatChanged( Called when the format of the media being consumed by the renderer changes. |
default void |
onAudioPositionAdvancing(long playoutStartSystemTimeMs) Called when the audio position has increased for the first time since the last pause or position reset. |
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 |
onAudioUnderrun( Called when an audio underrun occurs. |
default void |
onSkipSilenceEnabledChanged(boolean skipSilenceEnabled) Called when skipping silences is enabled or disabled in the audio stream. |
Public methods
onAudioCodecError
default void onAudioCodecError(Exception audioCodecError)
Called when an audio decoder encounters an error.
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. 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.
Parameters | |
---|---|
Exception audioCodecError |
The error. Typically a |
onAudioDecoderInitialized
default void onAudioDecoderInitialized(
String decoderName,
long initializedTimestampMs,
long initializationDurationMs
)
Called when a decoder is created.
Parameters | |
---|---|
String decoderName |
The decoder that was created. |
long initializedTimestampMs |
|
long initializationDurationMs |
The time taken to initialize the decoder in milliseconds. |
onAudioDecoderReleased
default void onAudioDecoderReleased(String decoderName)
Called when a decoder is released.
Parameters | |
---|---|
String decoderName |
The decoder that was released. |
onAudioDisabled
default void onAudioDisabled(DecoderCounters counters)
Called when the renderer is disabled.
Parameters | |
---|---|
DecoderCounters counters |
|
onAudioEnabled
default void onAudioEnabled(DecoderCounters counters)
Called when the renderer is enabled.
Parameters | |
---|---|
DecoderCounters counters |
|
onAudioInputFormatChanged
default void onAudioInputFormatChanged(
Format format,
@Nullable DecoderReuseEvaluation decoderReuseEvaluation
)
Called when the format of the media being consumed by the renderer changes.
Parameters | |
---|---|
Format format |
The new format. |
@Nullable DecoderReuseEvaluation decoderReuseEvaluation |
The result of the evaluation to determine whether an existing decoder instance can be reused for the new format, or |
onAudioPositionAdvancing
default void onAudioPositionAdvancing(long playoutStartSystemTimeMs)
Called when the audio position has increased for the first time since the last pause or position reset.
Parameters | |
---|---|
long playoutStartSystemTimeMs |
The approximate derived |
onAudioSinkError
default void onAudioSinkError(Exception audioSinkError)
Called when AudioSink
has encountered an error.
If the sink writes to a platform AudioTrack
, this will be called for all 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. 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.
Parameters | |
---|---|
Exception audioSinkError |
The error that occurred. Typically an , a |
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 |
onAudioUnderrun
default void onAudioUnderrun(
int bufferSize,
long bufferSizeMs,
long elapsedSinceLastFeedMs
)
Called when an audio underrun occurs.
Parameters | |
---|---|
int bufferSize |
The size of the audio output buffer, in bytes. |
long bufferSizeMs |
The size of the audio output buffer, in milliseconds, if it contains PCM encoded audio. |
long elapsedSinceLastFeedMs |
The time since audio was last written to the output buffer. |
onSkipSilenceEnabledChanged
default void onSkipSilenceEnabledChanged(boolean skipSilenceEnabled)
Called when skipping silences is enabled or disabled in the audio stream.
Parameters | |
---|---|
boolean skipSilenceEnabled |
Whether skipping silences in the audio stream is enabled. |