Package com.google.android.exoplayer2.upstream

## Interface LoadErrorHandlingPolicy

- All Known Implementing Classes:
    `DefaultLoadErrorHandlingPolicy`

      public interface LoadErrorHandlingPolicy

  Defines how errors encountered by loaders are handled.

  A loader that can choose between one of a number of resources can exclude a resource when a load error occurs. In this case, `getBlacklistDurationMsFor(int, long, IOException, int)` defines whether the resource should be excluded. Exclusion will succeed unless all of the alternatives are already excluded.

  When exclusion does not take place, `getRetryDelayMsFor(int, long, IOException, int)` defines whether the load is retried. An error that's not retried will always be propagated. An error that is retried will be propagated according to `getMinimumLoadableRetryCount(int)`.

  Methods are invoked on the playback thread.

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Interface | Description
    --- | --- | ---
    `static class` | `LoadErrorHandlingPolicy.LoadErrorInfo` | Holds information about a load task error.

  - ### Method Summary

    All Methods Instance Methods Abstract Methods Default Methods Deprecated Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `default long` | `getBlacklistDurationMsFor​(int dataType, long loadDurationMs, IOException exception, int errorCount)` | Deprecated. Implement `getBlacklistDurationMsFor(LoadErrorInfo)` instead.
    `default long` | `getBlacklistDurationMsFor​(LoadErrorHandlingPolicy.LoadErrorInfo loadErrorInfo)` | Returns the number of milliseconds for which a resource associated to a provided load error should be excluded, or `C.TIME_UNSET` if the resource should not be excluded.
    `int` | `getMinimumLoadableRetryCount​(int dataType)` | Returns the minimum number of times to retry a load in the case of a load error, before propagating the error.
    `default long` | `getRetryDelayMsFor​(int dataType, long loadDurationMs, IOException exception, int errorCount)` | Deprecated. Implement `getRetryDelayMsFor(LoadErrorInfo)` instead.
    `default long` | `getRetryDelayMsFor​(LoadErrorHandlingPolicy.LoadErrorInfo loadErrorInfo)` | Returns the number of milliseconds to wait before attempting the load again, or `C.TIME_UNSET` if the error is fatal and should not be retried.
    `default void` | `onLoadTaskConcluded​(long loadTaskId)` | Called once `loadTaskId` will not be associated with any more load errors.

- - ### Method Detail

    - #### getBlacklistDurationMsFor

          @Deprecated
          default long getBlacklistDurationMsFor​(int dataType,
                                                 long loadDurationMs,
                                                 IOException exception,
                                                 int errorCount)

      Deprecated.
      Implement `getBlacklistDurationMsFor(LoadErrorInfo)` instead.

    - #### getBlacklistDurationMsFor

          default long getBlacklistDurationMsFor​(LoadErrorHandlingPolicy.LoadErrorInfo loadErrorInfo)

      Returns the number of milliseconds for which a resource associated to a provided load error should be excluded, or `C.TIME_UNSET` if the resource should not be excluded.
      Parameters:
        `loadErrorInfo` - A `LoadErrorHandlingPolicy.LoadErrorInfo` holding information about the load error.
      Returns:
        The exclusion duration in milliseconds, or `C.TIME_UNSET` if the resource should not be excluded.

    - #### getRetryDelayMsFor

          @Deprecated
          default long getRetryDelayMsFor​(int dataType,
                                          long loadDurationMs,
                                          IOException exception,
                                          int errorCount)

      Deprecated.
      Implement `getRetryDelayMsFor(LoadErrorInfo)` instead.

    - #### getRetryDelayMsFor

          default long getRetryDelayMsFor​(LoadErrorHandlingPolicy.LoadErrorInfo loadErrorInfo)

      Returns the number of milliseconds to wait before attempting the load again, or `C.TIME_UNSET` if the error is fatal and should not be retried.

      Loaders may ignore the retry delay returned by this method in order to wait for a specific event before retrying. However, the load is retried if and only if this method does not return `C.TIME_UNSET`.

      Parameters:
        `loadErrorInfo` - A `LoadErrorHandlingPolicy.LoadErrorInfo` holding information about the load error.
      Returns:
        The number of milliseconds to wait before attempting the load again, or `C.TIME_UNSET` if the error is fatal and should not be retried.

    - #### onLoadTaskConcluded

          default void onLoadTaskConcluded​(long loadTaskId)

      Called once `loadTaskId` will not be associated with any more load errors.

      Implementations should clean up any resources associated with `loadTaskId` when this method is called.

    - #### getMinimumLoadableRetryCount

          int getMinimumLoadableRetryCount​(int dataType)

      Returns the minimum number of times to retry a load in the case of a load error, before propagating the error.
      Parameters:
        `dataType` - One of the `C.DATA_TYPE_*` constants indicating the type of data to load.
      Returns:
        The minimum number of times to retry a load in the case of a load error, before propagating the error.
      See Also:
        `Loader.startLoading(Loadable, Callback, int)`