Package com.castlabs.android.player

## Interface StreamingEventListener

- All Known Implementing Classes:
    `AbstractStreamingEventListener`

      public interface StreamingEventListener

  You can use this listener to get callbacks about current content downloads. Note that all callbacks will be triggered on the UI thread.
  Since:
    3.0.0

- - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `void` | `onLoadCanceled​(com.google.android.exoplayer2.upstream.DataSpec dataSpec, int dataType, int trackType, int trigger, com.google.android.exoplayer2.Format format, long mediaStartTimeMs, long mediaEndTimeMs, long elapsedRealtimeMs, long bytesLoaded, long loadDurationMs, int currentAttempt, int maxAttempts, Map<String,​List<String>> responseHeaders)` | Invoked when the current upstream load operation is canceled.
    `void` | `onLoadCompleted​(com.google.android.exoplayer2.upstream.DataSpec dataSpec, int dataType, int trackType, int trigger, com.google.android.exoplayer2.Format format, long mediaStartTimeMs, long mediaEndTimeMs, long elapsedRealtimeMs, long bytesLoaded, long loadDurationMs, int currentAttempt, int maxAttempts, Map<String,​List<String>> responseHeaders)` | Invoked when a load operation completes.
    `void` | `onLoadError​(com.google.android.exoplayer2.upstream.DataSpec dataSpec, int dataType, int trackType, int trigger, com.google.android.exoplayer2.Format format, long mediaStartTimeMs, long mediaEndTimeMs, long elapsedRealtimeMs, long bytesLoaded, long loadDurationMs, int currentAttempt, int maxAttempts, Map<String,​List<String>> responseHeaders, DownloadException downloadException)` | Invoked when the current upstream load operation fails.
    `void` | `onLoadStarted​(com.google.android.exoplayer2.upstream.DataSpec dataSpec, int dataType, int trackType, int trigger, com.google.android.exoplayer2.Format format, long mediaStartTimeMs, long mediaEndTimeMs, int currentAttempt, int maxAttempts, Map<String,​List<String>> responseHeaders)` | Invoked when an upstream load is started.
    `void` | `onUpstreamDiscarded​(int trackType, long mediaStartTimeMs, long mediaEndTimeMs)` | Invoked when data is removed from the back of the buffer, typically so that it can be re-buffered using a different representation.

- - ### Method Detail

    - #### onLoadCompleted

          void onLoadCompleted​(@NonNull
                               com.google.android.exoplayer2.upstream.DataSpec dataSpec,
                               int dataType,
                               int trackType,
                               int trigger,
                               @Nullable
                               com.google.android.exoplayer2.Format format,
                               long mediaStartTimeMs,
                               long mediaEndTimeMs,
                               long elapsedRealtimeMs,
                               long bytesLoaded,
                               long loadDurationMs,
                               int currentAttempt,
                               int maxAttempts,
                               Map<String,​List<String>> responseHeaders)

      Invoked when a load operation completes.
      Parameters:
        `dataSpec` - Defines the data being loaded.
        `dataType` - One of the `C` `DATA_TYPE_*` constants defining the type of data being loaded.
        `trackType` - The type of the track that triggered the load. One of `PlayerController.VIDEO_RENDERER`, `PlayerController.AUDIO_RENDERER`, or `PlayerController.TEXT_RENDERER` or -1 if not specified
        `trigger` - One of the `C` `SELECTION_REASON_*` constants if the data belongs to a track. `C.SELECTION_REASON_UNKNOWN` otherwise.
        `format` - The particular format to which this data corresponds, or null if the loaded data does not correspond to a format.
        `mediaStartTimeMs` - The media time of the start of the loaded data, or -1 if this load was for initialization data.
        `mediaEndTimeMs` - The media time of the end of the loaded data, or -1 if this load was for initialization data.
        `elapsedRealtimeMs` - `elapsedRealtime` timestamp of when the load finished.
        `bytesLoaded` - The number of bytes that were loaded.
        `loadDurationMs` - Amount of time taken to load the data.
        `currentAttempt` - The attempt number for the load operation.
        `maxAttempts` - Maximum number of attempts for the load operation.
        `responseHeaders` - The response headers

    - #### onLoadStarted

          void onLoadStarted​(@NonNull
                             com.google.android.exoplayer2.upstream.DataSpec dataSpec,
                             int dataType,
                             int trackType,
                             int trigger,
                             @Nullable
                             com.google.android.exoplayer2.Format format,
                             long mediaStartTimeMs,
                             long mediaEndTimeMs,
                             int currentAttempt,
                             int maxAttempts,
                             Map<String,​List<String>> responseHeaders)

      Invoked when an upstream load is started.
      Parameters:
        `dataSpec` - Defines the data being loaded.
        `dataType` - One of the `C` `DATA_TYPE_*` constants defining the type of data being loaded.
        `trackType` - The type of the track that triggered the load. One of `PlayerController.VIDEO_RENDERER`, `PlayerController.AUDIO_RENDERER`, or `PlayerController.TEXT_RENDERER` or -1 if not specified
        `trigger` - One of the `C` `SELECTION_REASON_*` constants if the data belongs to a track. `C.SELECTION_REASON_UNKNOWN` otherwise.
        `format` - The particular format to which this data corresponds, or null if the loaded data does not correspond to a format.
        `mediaStartTimeMs` - The media time of the start of the loaded data, or -1 if this load was for initialization data.
        `mediaEndTimeMs` - The media time of the end of the loaded data, or -1 if this load was for
        `currentAttempt` - The attempt number for the load operation.
        `maxAttempts` - Maximum number of attempts for the load operation.
        `responseHeaders` - The response headers

    - #### onLoadCanceled

          void onLoadCanceled​(@NonNull
                              com.google.android.exoplayer2.upstream.DataSpec dataSpec,
                              int dataType,
                              int trackType,
                              int trigger,
                              @Nullable
                              com.google.android.exoplayer2.Format format,
                              long mediaStartTimeMs,
                              long mediaEndTimeMs,
                              long elapsedRealtimeMs,
                              long bytesLoaded,
                              long loadDurationMs,
                              int currentAttempt,
                              int maxAttempts,
                              Map<String,​List<String>> responseHeaders)

      Invoked when the current upstream load operation is canceled.
      Parameters:
        `dataSpec` - Defines the data being loaded.
        `dataType` - One of the `C` `DATA_TYPE_*` constants defining the type of data being loaded.
        `trackType` - The type of the track that triggered the load. One of `PlayerController.VIDEO_RENDERER`, `PlayerController.AUDIO_RENDERER`, or `PlayerController.TEXT_RENDERER` or -1 if not specified
        `trigger` - One of the `C` `SELECTION_REASON_*` constants if the data belongs to a track. `C.SELECTION_REASON_UNKNOWN` otherwise.
        `format` - The particular format to which this data corresponds, or null if the loaded data does not correspond to a format.
        `mediaStartTimeMs` - The media time of the start of the loaded data, or -1 if this load was for initialization data.
        `mediaEndTimeMs` - The media time of the end of the loaded data, or -1 if this load was for initialization data.
        `elapsedRealtimeMs` - `elapsedRealtime` timestamp of when the load finished.
        `loadDurationMs` - Amount of time taken to load the data.
        `bytesLoaded` - The number of bytes that were loaded.
        `currentAttempt` - The attempt number for the load operation.
        `maxAttempts` - Maximum number of attempts for the load operation.
        `responseHeaders` - The response headers

    - #### onLoadError

          void onLoadError​(@NonNull
                           com.google.android.exoplayer2.upstream.DataSpec dataSpec,
                           int dataType,
                           int trackType,
                           int trigger,
                           @Nullable
                           com.google.android.exoplayer2.Format format,
                           long mediaStartTimeMs,
                           long mediaEndTimeMs,
                           long elapsedRealtimeMs,
                           long bytesLoaded,
                           long loadDurationMs,
                           int currentAttempt,
                           int maxAttempts,
                           Map<String,​List<String>> responseHeaders,
                           @Nullable
                           DownloadException downloadException)

      Invoked when the current upstream load operation fails.
      Parameters:
        `dataSpec` - Defines the data being loaded.
        `dataType` - One of the `C` `DATA_TYPE_*` constants defining the type of data being loaded.
        `trackType` - The type of the track that triggered the load. One of `PlayerController.VIDEO_RENDERER`, `PlayerController.AUDIO_RENDERER`, or `PlayerController.TEXT_RENDERER` or -1 if not specified
        `trigger` - One of the `C` `SELECTION_REASON_*` constants if the data belongs to a track. `C.SELECTION_REASON_UNKNOWN` otherwise.
        `format` - The particular format to which this data corresponds, or null if the loaded data does not correspond to a format.
        `mediaStartTimeMs` - The media time of the start of the loaded data, or -1 if this load was for initialization data.
        `mediaEndTimeMs` - The media time of the end of the loaded data, or -1 if this load was for initialization data.
        `elapsedRealtimeMs` - `elapsedRealtime` timestamp of when the load finished.
        `bytesLoaded` - The number of bytes that were loaded.
        `loadDurationMs` - Amount of time taken to load the data.
        `currentAttempt` - The attempt number for the load operation.
        `maxAttempts` - Maximum number of attempts for the load operation.
        `responseHeaders` - The response headers
        `downloadException` - (optional) Download exception that caused the error. If present, the cause refers to the underlying IOException and if available, the http status code will be exposed here.

    - #### onUpstreamDiscarded

          void onUpstreamDiscarded​(int trackType,
                                   long mediaStartTimeMs,
                                   long mediaEndTimeMs)

      Invoked when data is removed from the back of the buffer, typically so that it can be re-buffered using a different representation.
      Parameters:
        `trackType` - The type of the track that triggered the load. One of `PlayerController.VIDEO_RENDERER`, `PlayerController.AUDIO_RENDERER`, or `PlayerController.TEXT_RENDERER`
        `mediaStartTimeMs` - The media time of the start of the discarded data.
        `mediaEndTimeMs` - The media time of the end of the discarded data.