# 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
class DefaultLoadErrorHandlingPolicy : LoadErrorHandlingPolicy
```

<br />

*** ** * ** ***

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

## Summary

| ### Constants |
|---|---|
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/upstream/DefaultLoadErrorHandlingPolicy#DEFAULT_LOCATION_EXCLUSION_MS() = 300000` The default duration for which a location is excluded in milliseconds. |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/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. |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/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. |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/upstream/DefaultLoadErrorHandlingPolicy#DEFAULT_TRACK_BLACKLIST_MS() = 60000` **This property is deprecated.** Use `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/upstream/DefaultLoadErrorHandlingPolicy#DEFAULT_TRACK_EXCLUSION_MS()` instead. <br /> |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html` | `https://developer.android.com/reference/kotlin/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/kotlin/androidx/media3/exoplayer/upstream/DefaultLoadErrorHandlingPolicy#DefaultLoadErrorHandlingPolicy()()` Creates an instance with default behavior. |
| `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/upstream/DefaultLoadErrorHandlingPolicy#DefaultLoadErrorHandlingPolicy(int)(minimumLoadableRetryCount: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` Creates an instance with the given value for `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/upstream/DefaultLoadErrorHandlingPolicy#getMinimumLoadableRetryCount(int)`. |

| ### Public functions |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/upstream/LoadErrorHandlingPolicy.FallbackSelection?` | `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/upstream/DefaultLoadErrorHandlingPolicy#getFallbackSelectionFor(androidx.media3.exoplayer.upstream.LoadErrorHandlingPolicy.FallbackOptions,androidx.media3.exoplayer.upstream.LoadErrorHandlingPolicy.LoadErrorInfo)( fallbackOptions: https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/upstream/LoadErrorHandlingPolicy.FallbackOptions!, loadErrorInfo: https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/upstream/LoadErrorHandlingPolicy.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. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/upstream/DefaultLoadErrorHandlingPolicy#getMinimumLoadableRetryCount(int)(dataType: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` See `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/upstream/DefaultLoadErrorHandlingPolicy#DefaultLoadErrorHandlingPolicy()` and `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/upstream/DefaultLoadErrorHandlingPolicy#DefaultLoadErrorHandlingPolicy(int)` for documentation about the behavior of this method. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/upstream/DefaultLoadErrorHandlingPolicy#getRetryDelayMsFor(androidx.media3.exoplayer.upstream.LoadErrorHandlingPolicy.LoadErrorInfo)( loadErrorInfo: https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/upstream/LoadErrorHandlingPolicy.LoadErrorInfo! )` Retries for any exception or exception cause that is not a subclass of `https://developer.android.com/reference/kotlin/androidx/media3/common/ParserException`, `https://developer.android.com/reference/java/io/FileNotFoundException.html`, `https://developer.android.com/reference/kotlin/androidx/media3/datasource/HttpDataSource.CleartextNotPermittedException` or `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/upstream/Loader.UnexpectedLoaderException`, and for `https://developer.android.com/reference/kotlin/androidx/media3/datasource/DataSourceException` with reasons other than `https://developer.android.com/reference/kotlin/androidx/media3/common/PlaybackException#ERROR_CODE_IO_READ_POSITION_OUT_OF_RANGE()`. |

| ### Protected functions |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/upstream/DefaultLoadErrorHandlingPolicy#isEligibleForFallback(java.io.IOException)(exception: https://developer.android.com/reference/java/io/IOException.html!)` Returns whether an error should trigger a fallback if possible. |

| ### Inherited Constants |
|---|
| From [androidx.media3.exoplayer.upstream.LoadErrorHandlingPolicy](https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/upstream/LoadErrorHandlingPolicy) |---|---| | `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/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). | | `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/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 functions |
|---|
| From [androidx.media3.exoplayer.upstream.LoadErrorHandlingPolicy](https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/upstream/LoadErrorHandlingPolicy) |---|---| | `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/upstream/LoadErrorHandlingPolicy#onLoadTaskConcluded(long)(loadTaskId: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html)` Called once `loadTaskId` will not be associated with any more load errors. | |

## Constants

### DEFAULT_LOCATION_EXCLUSION_MS

```
const val DEFAULT_LOCATION_EXCLUSION_MS = 300000: Long
```

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

### DEFAULT_MIN_LOADABLE_RETRY_COUNT

```
const val DEFAULT_MIN_LOADABLE_RETRY_COUNT = 3: Int
```

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

### DEFAULT_MIN_LOADABLE_RETRY_COUNT_PROGRESSIVE_LIVE

```
const val DEFAULT_MIN_LOADABLE_RETRY_COUNT_PROGRESSIVE_LIVE = 6: Int
```

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

### DEFAULT_TRACK_BLACKLIST_MS

```
const val DEFAULT_TRACK_BLACKLIST_MS = 60000: Long
```

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

### DEFAULT_TRACK_EXCLUSION_MS

```
const val DEFAULT_TRACK_EXCLUSION_MS = 60000: Long
```

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

## Public constructors

### DefaultLoadErrorHandlingPolicy

```
DefaultLoadErrorHandlingPolicy()
```

Creates an instance with default behavior.

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

### DefaultLoadErrorHandlingPolicy

```
DefaultLoadErrorHandlingPolicy(minimumLoadableRetryCount: Int)
```

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

| Parameters |
|---|---|
| `minimumLoadableRetryCount: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | See `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/upstream/DefaultLoadErrorHandlingPolicy#getMinimumLoadableRetryCount(int)`. |

## Public functions

### getFallbackSelectionFor

```
fun getFallbackSelectionFor(
    fallbackOptions: LoadErrorHandlingPolicy.FallbackOptions!,
    loadErrorInfo: LoadErrorHandlingPolicy.LoadErrorInfo!
): LoadErrorHandlingPolicy.FallbackSelection?
```

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/kotlin/androidx/media3/exoplayer/upstream/DefaultLoadErrorHandlingPolicy#isEligibleForFallback(java.io.IOException)` returns `
  true` for the error.
- If location steering is `https://developer.android.com/reference/kotlin/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/kotlin/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/kotlin/androidx/media3/exoplayer/upstream/DefaultLoadErrorHandlingPolicy#DEFAULT_LOCATION_EXCLUSION_MS()` or `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/upstream/DefaultLoadErrorHandlingPolicy#DEFAULT_TRACK_EXCLUSION_MS()`, depending on the fallback type.

### getMinimumLoadableRetryCount

```
fun getMinimumLoadableRetryCount(dataType: Int): Int
```

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

### getRetryDelayMsFor

```
fun getRetryDelayMsFor(
    loadErrorInfo: LoadErrorHandlingPolicy.LoadErrorInfo!
): Long
```

Retries for any exception or exception cause that is not a subclass of `https://developer.android.com/reference/kotlin/androidx/media3/common/ParserException`, `https://developer.android.com/reference/java/io/FileNotFoundException.html`, `https://developer.android.com/reference/kotlin/androidx/media3/datasource/HttpDataSource.CleartextNotPermittedException` or `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/upstream/Loader.UnexpectedLoaderException`, and for `https://developer.android.com/reference/kotlin/androidx/media3/datasource/DataSourceException` with reasons other than `https://developer.android.com/reference/kotlin/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 functions

### isEligibleForFallback

```
protected fun isEligibleForFallback(exception: IOException!): Boolean
```

Returns whether an error should trigger a fallback if possible.