Interface AudioSink.Listener

  • Enclosing interface:
    AudioSink

    public static interface AudioSink.Listener
    Listener for audio sink events.
    • Method Detail

      • onPositionDiscontinuity

        void onPositionDiscontinuity()
        Called when the audio sink handles a buffer whose timestamp is discontinuous with the last buffer handled since it was reset.
      • 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:
        playoutStartSystemTimeMs - The approximate derived System.currentTimeMillis() at which playout started. Only valid if the audio track has not underrun.
      • onUnderrun

        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:
        bufferSize - The size of the sink's buffer, in bytes.
        bufferSizeMs - The size of the sink's buffer, in milliseconds, if it is configured for PCM output. C.TIME_UNSET if it is configured for encoded audio output, as the buffered media can have a variable bitrate so the duration may be unknown.
        elapsedSinceLastFeedMs - The time since the sink was last fed data, in milliseconds.
      • onSkipSilenceEnabledChanged

        void onSkipSilenceEnabledChanged​(boolean skipSilenceEnabled)
        Called when skipping silences is enabled or disabled.
        Parameters:
        skipSilenceEnabled - Whether skipping silences is enabled.
      • 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.
      • onAudioCapabilitiesChanged

        default void onAudioCapabilitiesChanged()
        Called when audio capabilities changed.