Back to Exoplayer

DefaultLoadErrorHandlingPolicy (ExoPlayer library)

docs/doc/reference/com/google/android/exoplayer2/upstream/DefaultLoadErrorHandlingPolicy.html

latest12.6 KB
Original Source

Package com.google.android.exoplayer2.upstream

Class DefaultLoadErrorHandlingPolicy

  • java.lang.Object

    • com.google.android.exoplayer2.upstream.DefaultLoadErrorHandlingPolicy
  • All Implemented Interfaces:LoadErrorHandlingPolicy


[@Deprecated](https://developer.android.com/reference/java/lang/Deprecated.html "class or interface in java.lang")public classDefaultLoadErrorHandlingPolicyextends[Object](https://developer.android.com/reference/java/lang/Object.html "class or interface in java.lang")implements[LoadErrorHandlingPolicy](LoadErrorHandlingPolicy.html "interface in com.google.android.exoplayer2.upstream")

Deprecated. com.google.android.exoplayer2 is deprecated. Please migrate to androidx.media3 (which contains the same ExoPlayer code). See the migration guide for more details, including a script to help with the migration.

Default implementation of LoadErrorHandlingPolicy.

Nested Class Summary

- 

Nested classes/interfaces inherited from interface com.google.android.exoplayer2.upstream.LoadErrorHandlingPolicy

LoadErrorHandlingPolicy.FallbackOptions, LoadErrorHandlingPolicy.FallbackSelection, LoadErrorHandlingPolicy.FallbackType, LoadErrorHandlingPolicy.LoadErrorInfo

Field Summary

Fields | Modifier and Type | Field | Description | | --- | --- | --- | | static long | DEFAULT_LOCATION_EXCLUSION_MS | Deprecated.

The default duration for which a location is excluded in milliseconds. | | static int | DEFAULT_MIN_LOADABLE_RETRY_COUNT | Deprecated.

The default minimum number of times to retry loading data prior to propagating the error. | | static int | DEFAULT_MIN_LOADABLE_RETRY_COUNT_PROGRESSIVE_LIVE | Deprecated.

The default minimum number of times to retry loading prior to failing for progressive live streams. | | static long | DEFAULT_TRACK_BLACKLIST_MS | Deprecated. Use DEFAULT_TRACK_EXCLUSION_MS instead.

| | static long | DEFAULT_TRACK_EXCLUSION_MS | Deprecated.

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

- 

Fields inherited from interface com.google.android.exoplayer2.upstream.LoadErrorHandlingPolicy

FALLBACK_TYPE_LOCATION, FALLBACK_TYPE_TRACK

Constructor Summary

Constructors | Constructor | Description | | --- | --- | | DefaultLoadErrorHandlingPolicy() | Deprecated.

Creates an instance with default behavior. | | DefaultLoadErrorHandlingPolicy​(int minimumLoadableRetryCount) | Deprecated.

Creates an instance with the given value for getMinimumLoadableRetryCount(int). |

Method Summary

All Methods Instance Methods Concrete Methods Deprecated Methods | Modifier and Type | Method | Description | | --- | --- | --- | | LoadErrorHandlingPolicy.FallbackSelection | getFallbackSelectionFor​(LoadErrorHandlingPolicy.FallbackOptions fallbackOptions, LoadErrorHandlingPolicy.LoadErrorInfo loadErrorInfo) | Deprecated.

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 | getMinimumLoadableRetryCount​(int dataType) | Deprecated.

See DefaultLoadErrorHandlingPolicy() and DefaultLoadErrorHandlingPolicy(int) for documentation about the behavior of this method. | | long | getRetryDelayMsFor​(LoadErrorHandlingPolicy.LoadErrorInfo loadErrorInfo) | Deprecated.

Retries for any exception that is not a subclass of ParserException, FileNotFoundException, HttpDataSource.CleartextNotPermittedException or Loader.UnexpectedLoaderException, and for which DataSourceException.isCausedByPositionOutOfRange(java.io.IOException) returns false. | | protected boolean | isEligibleForFallback​(IOException exception) | Deprecated.

Returns whether an error should trigger a fallback if possible. |

- 

Methods inherited from class java.lang.Object

clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

- 

Methods inherited from interface com.google.android.exoplayer2.upstream.LoadErrorHandlingPolicy

onLoadTaskConcluded

Field Detail

- 

DEFAULT_MIN_LOADABLE_RETRY_COUNT

public static final int DEFAULT_MIN_LOADABLE_RETRY_COUNT

Deprecated.

The default minimum number of times to retry loading data prior to propagating the error. See Also:Constant Field Values

- 

DEFAULT_MIN_LOADABLE_RETRY_COUNT_PROGRESSIVE_LIVE

public static final int DEFAULT_MIN_LOADABLE_RETRY_COUNT_PROGRESSIVE_LIVE

Deprecated.

The default minimum number of times to retry loading prior to failing for progressive live streams. See Also:Constant Field Values

- 

DEFAULT_TRACK_EXCLUSION_MS

public static final long DEFAULT_TRACK_EXCLUSION_MS

Deprecated.

The default duration for which a track is excluded in milliseconds. See Also:Constant Field Values

- 

DEFAULT_TRACK_BLACKLIST_MS

[@Deprecated](https://developer.android.com/reference/java/lang/Deprecated.html "class or interface in java.lang")public static final long DEFAULT_TRACK_BLACKLIST_MS

Deprecated. Use DEFAULT_TRACK_EXCLUSION_MS instead.

See Also:Constant Field Values

- 

DEFAULT_LOCATION_EXCLUSION_MS

public static final long DEFAULT_LOCATION_EXCLUSION_MS

Deprecated.

The default duration for which a location is excluded in milliseconds. See Also:Constant Field Values

Constructor Detail

- 

DefaultLoadErrorHandlingPolicy

public DefaultLoadErrorHandlingPolicy()

Deprecated.

Creates an instance with default behavior.

getMinimumLoadableRetryCount(int) will return DEFAULT_MIN_LOADABLE_RETRY_COUNT_PROGRESSIVE_LIVE for dataType C.DATA_TYPE_MEDIA_PROGRESSIVE_LIVE. For other dataType values, it will return DEFAULT_MIN_LOADABLE_RETRY_COUNT.

- 

DefaultLoadErrorHandlingPolicy

public DefaultLoadErrorHandlingPolicy​(int minimumLoadableRetryCount)

Deprecated.

Creates an instance with the given value for getMinimumLoadableRetryCount(int). Parameters:minimumLoadableRetryCount - See getMinimumLoadableRetryCount(int).

Method Detail

- 

getFallbackSelectionFor

@Nullable
public[LoadErrorHandlingPolicy.FallbackSelection](LoadErrorHandlingPolicy.FallbackSelection.html "class in com.google.android.exoplayer2.upstream")getFallbackSelectionFor​([LoadErrorHandlingPolicy.FallbackOptions](LoadErrorHandlingPolicy.FallbackOptions.html "class in com.google.android.exoplayer2.upstream")fallbackOptions,[LoadErrorHandlingPolicy.LoadErrorInfo](LoadErrorHandlingPolicy.LoadErrorInfo.html "class in com.google.android.exoplayer2.upstream")loadErrorInfo)

Deprecated.

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 isEligibleForFallback(java.io.IOException) returns true for the error. - This policy will always 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 DEFAULT_LOCATION_EXCLUSION_MS or DEFAULT_TRACK_EXCLUSION_MS, depending on the fallback type.

Specified by:getFallbackSelectionFor in interface LoadErrorHandlingPolicyParameters:fallbackOptions - The available fallback options.loadErrorInfo - A LoadErrorHandlingPolicy.LoadErrorInfo holding information about the load error.Returns:The selected fallback, or null if the calling loader should not fall back.

- 

getRetryDelayMsFor

public long getRetryDelayMsFor​([LoadErrorHandlingPolicy.LoadErrorInfo](LoadErrorHandlingPolicy.LoadErrorInfo.html "class in com.google.android.exoplayer2.upstream")loadErrorInfo)

Deprecated.

Retries for any exception that is not a subclass of ParserException, FileNotFoundException, HttpDataSource.CleartextNotPermittedException or Loader.UnexpectedLoaderException, and for which DataSourceException.isCausedByPositionOutOfRange(java.io.IOException) returns false. The retry delay is calculated as Math.min((errorCount - 1) * 1000, 5000). Specified by:getRetryDelayMsFor in interface LoadErrorHandlingPolicyParameters:loadErrorInfo - A LoadErrorHandlingPolicy.LoadErrorInfo holding information about the load error.Returns:The duration to wait before retrying in milliseconds, or C.TIME_UNSET if the error is fatal and should not be retried.

- 

getMinimumLoadableRetryCount

public int getMinimumLoadableRetryCount​(int dataType)

Deprecated.

See DefaultLoadErrorHandlingPolicy() and DefaultLoadErrorHandlingPolicy(int) for documentation about the behavior of this method. Specified by:getMinimumLoadableRetryCount in interface LoadErrorHandlingPolicyParameters:dataType - One of the C.DATA_TYPE_* constants indicating the type of data being loaded.Returns:The minimum number of times to retry a load before a load error that can be retried may be considered fatal.See Also:Loader.startLoading(Loadable, Callback, int)

- 

isEligibleForFallback

protected boolean isEligibleForFallback​([IOException](https://developer.android.com/reference/java/io/IOException.html "class or interface in java.io")exception)

Deprecated.

Returns whether an error should trigger a fallback if possible.