# DefaultLoadErrorHandlingPolicy

Artifact: [androidx.media3:media3-exoplayer](https://developer.android.com/jetpack/androidx/releases/media3) [View Source](https://cs.android.com/search?q=file:androidx/media3/exoplayer/upstream/DefaultLoadErrorHandlingPolicy.java+class:androidx.media3.exoplayer.upstream.DefaultLoadErrorHandlingPolicy)

*** ** * ** ***


```
@UnstableApi
public class DefaultLoadErrorHandlingPolicy implements LoadErrorHandlingPolicy
```

<br />

*** ** * ** ***

Default implementation of `https://developer.android.com/reference/androidx/media3/exoplayer/upstream/LoadErrorHandlingPolicy`.

## Summary

| ### Constants |
|---|---|
| `static final long` | `https://developer.android.com/reference/androidx/media3/exoplayer/upstream/DefaultLoadErrorHandlingPolicy#DEFAULT_LOCATION_EXCLUSION_MS() = 300000` The default duration for which a location is excluded in milliseconds. |
| `static final int` | `https://developer.android.com/reference/androidx/media3/exoplayer/upstream/DefaultLoadErrorHandlingPolicy#DEFAULT_MIN_LOADABLE_RETRY_COUNT() = 3` The default minimum number of times to retry loading data prior to propagating the error. |
| `static final int` | `https://developer.android.com/reference/androidx/media3/exoplayer/upstream/DefaultLoadErrorHandlingPolicy#DEFAULT_MIN_LOADABLE_RETRY_COUNT_PROGRESSIVE_LIVE() = 6` The default minimum number of times to retry loading prior to failing for progressive live streams. |
| `static final long` | `https://developer.android.com/reference/androidx/media3/exoplayer/upstream/DefaultLoadErrorHandlingPolicy#DEFAULT_TRACK_BLACKLIST_MS() = 60000` **This field is deprecated.** Use `https://developer.android.com/reference/androidx/media3/exoplayer/upstream/DefaultLoadErrorHandlingPolicy#DEFAULT_TRACK_EXCLUSION_MS()` instead. <br /> |
| `static final long` | `https://developer.android.com/reference/androidx/media3/exoplayer/upstream/DefaultLoadErrorHandlingPolicy#DEFAULT_TRACK_EXCLUSION_MS() = 60000` The default duration for which a track is excluded in milliseconds. |

| ### Public constructors |
|---|
| `https://developer.android.com/reference/androidx/media3/exoplayer/upstream/DefaultLoadErrorHandlingPolicy#DefaultLoadErrorHandlingPolicy()()` Creates an instance with default behavior. |
| `https://developer.android.com/reference/androidx/media3/exoplayer/upstream/DefaultLoadErrorHandlingPolicy#DefaultLoadErrorHandlingPolicy(int)(int minimumLoadableRetryCount)` Creates an instance with the given value for `https://developer.android.com/reference/androidx/media3/exoplayer/upstream/DefaultLoadErrorHandlingPolicy#getMinimumLoadableRetryCount(int)`. |

| ### Public methods |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/androidx/media3/exoplayer/upstream/LoadErrorHandlingPolicy.FallbackSelection` | `https://developer.android.com/reference/androidx/media3/exoplayer/upstream/DefaultLoadErrorHandlingPolicy#getFallbackSelectionFor(androidx.media3.exoplayer.upstream.LoadErrorHandlingPolicy.FallbackOptions,androidx.media3.exoplayer.upstream.LoadErrorHandlingPolicy.LoadErrorInfo)( https://developer.android.com/reference/androidx/media3/exoplayer/upstream/LoadErrorHandlingPolicy.FallbackOptions fallbackOptions, https://developer.android.com/reference/androidx/media3/exoplayer/upstream/LoadErrorHandlingPolicy.LoadErrorInfo loadErrorInfo )` Returns whether a loader should fall back to using another resource on encountering an error, and if so the duration for which the failing resource should be excluded. |
| `int` | `https://developer.android.com/reference/androidx/media3/exoplayer/upstream/DefaultLoadErrorHandlingPolicy#getMinimumLoadableRetryCount(int)(int dataType)` See `https://developer.android.com/reference/androidx/media3/exoplayer/upstream/DefaultLoadErrorHandlingPolicy#DefaultLoadErrorHandlingPolicy()` and `https://developer.android.com/reference/androidx/media3/exoplayer/upstream/DefaultLoadErrorHandlingPolicy#DefaultLoadErrorHandlingPolicy(int)` for documentation about the behavior of this method. |
| `long` | `https://developer.android.com/reference/androidx/media3/exoplayer/upstream/DefaultLoadErrorHandlingPolicy#getRetryDelayMsFor(androidx.media3.exoplayer.upstream.LoadErrorHandlingPolicy.LoadErrorInfo)( https://developer.android.com/reference/androidx/media3/exoplayer/upstream/LoadErrorHandlingPolicy.LoadErrorInfo loadErrorInfo )` Retries for any exception or exception cause that is not a subclass of `https://developer.android.com/reference/androidx/media3/common/ParserException`, `https://developer.android.com/reference/java/io/FileNotFoundException.html`, `https://developer.android.com/reference/androidx/media3/datasource/HttpDataSource.CleartextNotPermittedException` or `https://developer.android.com/reference/androidx/media3/exoplayer/upstream/Loader.UnexpectedLoaderException`, and for `https://developer.android.com/reference/androidx/media3/datasource/DataSourceException` with reasons other than `https://developer.android.com/reference/androidx/media3/common/PlaybackException#ERROR_CODE_IO_READ_POSITION_OUT_OF_RANGE()`. |

| ### Protected methods |
|---|---|
| `boolean` | `https://developer.android.com/reference/androidx/media3/exoplayer/upstream/DefaultLoadErrorHandlingPolicy#isEligibleForFallback(java.io.IOException)(https://developer.android.com/reference/java/io/IOException.html exception)` Returns whether an error should trigger a fallback if possible. |

| ### Inherited Constants |
|---|
| From [androidx.media3.exoplayer.upstream.LoadErrorHandlingPolicy](https://developer.android.com/reference/androidx/media3/exoplayer/upstream/LoadErrorHandlingPolicy) |---|---| | `static final int` | `https://developer.android.com/reference/androidx/media3/exoplayer/upstream/LoadErrorHandlingPolicy#FALLBACK_TYPE_LOCATION() = 1` Fallback to the same resource at a different location (i.e., a different URL through which the exact same data can be requested). | | `static final int` | `https://developer.android.com/reference/androidx/media3/exoplayer/upstream/LoadErrorHandlingPolicy#FALLBACK_TYPE_TRACK() = 2` Fallback to a different track (i.e., a different representation of the same content; for example the same video encoded at a different bitrate or resolution). | |

| ### Inherited methods |
|---|
| From [androidx.media3.exoplayer.upstream.LoadErrorHandlingPolicy](https://developer.android.com/reference/androidx/media3/exoplayer/upstream/LoadErrorHandlingPolicy) |---|---| | `void` | `https://developer.android.com/reference/androidx/media3/exoplayer/upstream/LoadErrorHandlingPolicy#onLoadTaskConcluded(long)(long loadTaskId)` Called once `loadTaskId` will not be associated with any more load errors. | |

## Constants

### DEFAULT_LOCATION_EXCLUSION_MS

```
public static final long DEFAULT_LOCATION_EXCLUSION_MS = 300000
```

The default duration for which a location is excluded in milliseconds.

### DEFAULT_MIN_LOADABLE_RETRY_COUNT

```
public static final int DEFAULT_MIN_LOADABLE_RETRY_COUNT = 3
```

The default minimum number of times to retry loading data prior to propagating the error.

### DEFAULT_MIN_LOADABLE_RETRY_COUNT_PROGRESSIVE_LIVE

```
public static final int DEFAULT_MIN_LOADABLE_RETRY_COUNT_PROGRESSIVE_LIVE = 6
```

The default minimum number of times to retry loading prior to failing for progressive live streams.

### DEFAULT_TRACK_BLACKLIST_MS

```
public static final long DEFAULT_TRACK_BLACKLIST_MS = 60000
```

> [!CAUTION]
> **This field is deprecated.**   
>
> Use `https://developer.android.com/reference/androidx/media3/exoplayer/upstream/DefaultLoadErrorHandlingPolicy#DEFAULT_TRACK_EXCLUSION_MS()` instead.

### DEFAULT_TRACK_EXCLUSION_MS

```
public static final long DEFAULT_TRACK_EXCLUSION_MS = 60000
```

The default duration for which a track is excluded in milliseconds.

## Public constructors

### DefaultLoadErrorHandlingPolicy

```
public DefaultLoadErrorHandlingPolicy()
```

Creates an instance with default behavior.

`https://developer.android.com/reference/androidx/media3/exoplayer/upstream/DefaultLoadErrorHandlingPolicy#getMinimumLoadableRetryCount(int)` will return `https://developer.android.com/reference/androidx/media3/exoplayer/upstream/DefaultLoadErrorHandlingPolicy#DEFAULT_MIN_LOADABLE_RETRY_COUNT_PROGRESSIVE_LIVE()` for `dataType``https://developer.android.com/reference/androidx/media3/common/C#DATA_TYPE_MEDIA_PROGRESSIVE_LIVE()`. For other `dataType` values, it will return `https://developer.android.com/reference/androidx/media3/exoplayer/upstream/DefaultLoadErrorHandlingPolicy#DEFAULT_MIN_LOADABLE_RETRY_COUNT()`.

### DefaultLoadErrorHandlingPolicy

```
public DefaultLoadErrorHandlingPolicy(int minimumLoadableRetryCount)
```

Creates an instance with the given value for `https://developer.android.com/reference/androidx/media3/exoplayer/upstream/DefaultLoadErrorHandlingPolicy#getMinimumLoadableRetryCount(int)`.

| Parameters |
|---|---|
| `int minimumLoadableRetryCount` | See `https://developer.android.com/reference/androidx/media3/exoplayer/upstream/DefaultLoadErrorHandlingPolicy#getMinimumLoadableRetryCount(int)`. |

## Public methods

### getFallbackSelectionFor

```
public @Nullable LoadErrorHandlingPolicy.FallbackSelection getFallbackSelectionFor(
    LoadErrorHandlingPolicy.FallbackOptions fallbackOptions,
    LoadErrorHandlingPolicy.LoadErrorInfo loadErrorInfo
)
```

Returns whether a loader should fall back to using another resource on encountering an error, and if so the duration for which the failing resource should be excluded.

- This policy will only specify a fallback if `https://developer.android.com/reference/androidx/media3/exoplayer/upstream/DefaultLoadErrorHandlingPolicy#isEligibleForFallback(java.io.IOException)` returns `
  true` for the error.
- If location steering is `https://developer.android.com/reference/androidx/media3/exoplayer/upstream/LoadErrorHandlingPolicy.FallbackOptions#locationSteeringActive()`, this policy will specify a track fallback rather than a location fallback if both `https://developer.android.com/reference/androidx/media3/exoplayer/upstream/LoadErrorHandlingPolicy.FallbackOptions#isFallbackAvailable(int)`. Otherwise, this policy will specify a location fallback rather than a track fallback if both are available.
- When a fallback is specified, the duration for which the failing resource will be excluded is `https://developer.android.com/reference/androidx/media3/exoplayer/upstream/DefaultLoadErrorHandlingPolicy#DEFAULT_LOCATION_EXCLUSION_MS()` or `https://developer.android.com/reference/androidx/media3/exoplayer/upstream/DefaultLoadErrorHandlingPolicy#DEFAULT_TRACK_EXCLUSION_MS()`, depending on the fallback type.

### getMinimumLoadableRetryCount

```
public int getMinimumLoadableRetryCount(int dataType)
```

See `https://developer.android.com/reference/androidx/media3/exoplayer/upstream/DefaultLoadErrorHandlingPolicy#DefaultLoadErrorHandlingPolicy()` and `https://developer.android.com/reference/androidx/media3/exoplayer/upstream/DefaultLoadErrorHandlingPolicy#DefaultLoadErrorHandlingPolicy(int)` for documentation about the behavior of this method.

### getRetryDelayMsFor

```
public long getRetryDelayMsFor(
    LoadErrorHandlingPolicy.LoadErrorInfo loadErrorInfo
)
```

Retries for any exception or exception cause that is not a subclass of `https://developer.android.com/reference/androidx/media3/common/ParserException`, `https://developer.android.com/reference/java/io/FileNotFoundException.html`, `https://developer.android.com/reference/androidx/media3/datasource/HttpDataSource.CleartextNotPermittedException` or `https://developer.android.com/reference/androidx/media3/exoplayer/upstream/Loader.UnexpectedLoaderException`, and for `https://developer.android.com/reference/androidx/media3/datasource/DataSourceException` with reasons other than `https://developer.android.com/reference/androidx/media3/common/PlaybackException#ERROR_CODE_IO_READ_POSITION_OUT_OF_RANGE()`. The retry delay is calculated as `Math.min((errorCount - 1) * 1000, 5000)`.

## Protected methods

### isEligibleForFallback

```
protected boolean isEligibleForFallback(IOException exception)
```

Returns whether an error should trigger a fallback if possible.