Package com.castlabs.android.player

# Class AudioTrackListener

java.lang.Object
com.castlabs.android.player.AudioTrackListener

All Implemented Interfaces:
  `MediaTrackEventListener`, `com.google.android.exoplayer2.audio.AudioRendererEventListener`

public class AudioTrackListener extends Object implements com.google.android.exoplayer2.audio.AudioRendererEventListener, MediaTrackEventListener
This is an implementation of the `MediaTrackEventListener` and `AudioRendererEventListener` that is used to delegate events from the track renderer to the `PlayerListener` instances that are registered with the current `PlayerController`.

Since:
  3.0.0

- ## Nested Class Summary

  ## Nested classes/interfaces inherited from interface com.google.android.exoplayer2.audio.AudioRendererEventListener

  `com.google.android.exoplayer2.audio.AudioRendererEventListener.EventDispatcher`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `AudioTrackListener(PlayerListeners playerListeners)`
  Creates a new instance.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `onAudioDecoderInitialized(String decoderName, long elapsedRealtimeMs, long initializationDurationMs)`
  `void`
  `onAudioDisabled(com.google.android.exoplayer2.decoder.DecoderCounters counters)`
  `void`
  `onAudioEnabled(com.google.android.exoplayer2.decoder.DecoderCounters counters)`
  `void`
  `onAudioInputFormatChanged(com.google.android.exoplayer2.Format format)`
  `void`
  `onAudioSessionId(int audioSessionId)`
  `void`
  `onAudioSinkUnderrun(int bufferSize, long bufferSizeMs, long elapsedSinceLastFeedMs)`
  `void`
  `onAudioTrackConfigurationError(com.google.android.exoplayer2.audio.AudioSink.ConfigurationException e)`
  Called when an error occurs configuring an `AudioSink`.
  `void`
  `onAudioTrackInitializationError(com.google.android.exoplayer2.audio.AudioSink.InitializationException e)`
  Called when an error occurs initializing an `AudioSink`.
  `void`
  `onAudioTrackWriteError(com.google.android.exoplayer2.audio.AudioSink.WriteException e)`
  Called when an error occurs writing data to an `AudioSink`.
  `void`
  `onCryptoError(MediaCodec.CryptoException e)`
  Invoked when a decoder operation raises a `DecryptionException`.
  `void`
  `onDecoderInitializationError(com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.DecoderInitializationException e)`
  Invoked when a decoder fails to initialize.

  ### Methods inherited from class java.lang.Object

  `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### AudioTrackListener

    public AudioTrackListener(@NonNull PlayerListeners playerListeners)
    Creates a new instance.
    Parameters:
      `playerListeners` - The `PlayerListeners` to delegate events to.

- ## Method Details

  - ### onAudioTrackInitializationError

    public void onAudioTrackInitializationError(@NonNull com.google.android.exoplayer2.audio.AudioSink.InitializationException e)
    Called when an error occurs initializing an `AudioSink`.
    Parameters:
      `e` - The error that occurred.

  - ### onAudioTrackConfigurationError

    public void onAudioTrackConfigurationError(@NonNull com.google.android.exoplayer2.audio.AudioSink.ConfigurationException e)
    Called when an error occurs configuring an `AudioSink`.
    Parameters:
      `e` - The error that occurred.

  - ### onAudioTrackWriteError

    public void onAudioTrackWriteError(@NonNull com.google.android.exoplayer2.audio.AudioSink.WriteException e)
    Called when an error occurs writing data to an `AudioSink`.
    Parameters:
      `e` - The error that occurred.

  - ### onAudioSinkUnderrun

    public void onAudioSinkUnderrun(int bufferSize, long bufferSizeMs, long elapsedSinceLastFeedMs)
    Specified by:
      `onAudioSinkUnderrun` in interface `com.google.android.exoplayer2.audio.AudioRendererEventListener`

  - ### onAudioEnabled

    public void onAudioEnabled(com.google.android.exoplayer2.decoder.DecoderCounters counters)
    Specified by:
      `onAudioEnabled` in interface `com.google.android.exoplayer2.audio.AudioRendererEventListener`

  - ### onAudioSessionId

    public void onAudioSessionId(int audioSessionId)
    Specified by:
      `onAudioSessionId` in interface `com.google.android.exoplayer2.audio.AudioRendererEventListener`

  - ### onAudioInputFormatChanged

    public void onAudioInputFormatChanged(com.google.android.exoplayer2.Format format)
    Specified by:
      `onAudioInputFormatChanged` in interface `com.google.android.exoplayer2.audio.AudioRendererEventListener`

  - ### onAudioDisabled

    public void onAudioDisabled(com.google.android.exoplayer2.decoder.DecoderCounters counters)
    Specified by:
      `onAudioDisabled` in interface `com.google.android.exoplayer2.audio.AudioRendererEventListener`

  - ### onDecoderInitializationError

    public void onDecoderInitializationError(@NonNull com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.DecoderInitializationException e)
    Description copied from interface: `MediaTrackEventListener`
    Invoked when a decoder fails to initialize.
    Specified by:
      `onDecoderInitializationError` in interface `MediaTrackEventListener`
    Parameters:
      `e` - The corresponding exception.

  - ### onCryptoError

    public void onCryptoError(@NonNull MediaCodec.CryptoException e)
    Description copied from interface: `MediaTrackEventListener`
    Invoked when a decoder operation raises a `DecryptionException`.
    Specified by:
      `onCryptoError` in interface `MediaTrackEventListener`
    Parameters:
      `e` - The corresponding exception.

  - ### onAudioDecoderInitialized

    public void onAudioDecoderInitialized(String decoderName, long elapsedRealtimeMs, long initializationDurationMs)
    Specified by:
      `onAudioDecoderInitialized` in interface `com.google.android.exoplayer2.audio.AudioRendererEventListener`