Interface AudioRendererEventListener

  • @Deprecated
    public interface AudioRendererEventListener
    Deprecated. is deprecated. Please migrate to androidx.media3 (which contains the same ExoPlayer code). See the migration guide for more details, including a script to help with the migration.
    Listener of audio Renderer events. All methods have no-op default implementations to allow selective overrides.
    • Method Detail

      • onAudioEnabled

        default void onAudioEnabled​(DecoderCounters counters)
        Called when the renderer is enabled.
        counters - DecoderCounters that will be updated by the renderer for as long as it remains enabled.
      • onAudioDecoderInitialized

        default void onAudioDecoderInitialized​(String decoderName,
                                               long initializedTimestampMs,
                                               long initializationDurationMs)
        Called when a decoder is created.
        decoderName - The decoder that was created.
        initializedTimestampMs - SystemClock.elapsedRealtime() when initialization finished.
        initializationDurationMs - The time taken to initialize the decoder in milliseconds.
      • onAudioInputFormatChanged

        default void onAudioInputFormatChanged​(Format format,
                                               DecoderReuseEvaluation decoderReuseEvaluation)
        Called when the format of the media being consumed by the renderer changes.
        format - The new format.
        decoderReuseEvaluation - The result of the evaluation to determine whether an existing decoder instance can be reused for the new format, or null if the renderer did not have a decoder.
      • onAudioPositionAdvancing

        default void onAudioPositionAdvancing​(long playoutStartSystemTimeMs)
        Called when the audio position has increased for the first time since the last pause or position reset.
        playoutStartSystemTimeMs - The approximate derived System.currentTimeMillis() at which playout started.
      • onAudioUnderrun

        default void onAudioUnderrun​(int bufferSize,
                                     long bufferSizeMs,
                                     long elapsedSinceLastFeedMs)
        Called when an audio underrun occurs.
        bufferSize - The size of the audio output buffer, in bytes.
        bufferSizeMs - The size of the audio output buffer, in milliseconds, if it contains PCM encoded audio. C.TIME_UNSET if the output buffer contains non-PCM encoded audio.
        elapsedSinceLastFeedMs - The time since audio was last written to the output buffer.
      • onAudioDecoderReleased

        default void onAudioDecoderReleased​(String decoderName)
        Called when a decoder is released.
        decoderName - The decoder that was released.
      • onAudioDisabled

        default void onAudioDisabled​(DecoderCounters counters)
        Called when the renderer is disabled.
        counters - DecoderCounters that were updated by the renderer.
      • onSkipSilenceEnabledChanged

        default void onSkipSilenceEnabledChanged​(boolean skipSilenceEnabled)
        Called when skipping silences is enabled or disabled in the audio stream.
        skipSilenceEnabled - Whether skipping silences in the audio stream is enabled.
      • 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. Player.Listener.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.

        audioCodecError - The error. Typically a MediaCodec.CodecException if the renderer uses MediaCodec, or a DecoderException if the renderer uses a software decoder.