Class DefaultLoadErrorHandlingPolicy
- java.lang.Object
-
- com.google.android.exoplayer2.upstream.DefaultLoadErrorHandlingPolicy
-
- All Implemented Interfaces:
LoadErrorHandlingPolicy
@Deprecated public class DefaultLoadErrorHandlingPolicy extends Object implements LoadErrorHandlingPolicy
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 ofLoadErrorHandlingPolicy
.
-
-
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.UseDEFAULT_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 forgetMinimumLoadableRetryCount(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.SeeDefaultLoadErrorHandlingPolicy()
andDefaultLoadErrorHandlingPolicy(int)
for documentation about the behavior of this method.long
getRetryDelayMsFor(LoadErrorHandlingPolicy.LoadErrorInfo loadErrorInfo)
Deprecated.Retries for any exception that is not a subclass ofParserException
,FileNotFoundException
,HttpDataSource.CleartextNotPermittedException
orLoader.UnexpectedLoaderException
, and for whichDataSourceException.isCausedByPositionOutOfRange(java.io.IOException)
returnsfalse
.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 public static final long DEFAULT_TRACK_BLACKLIST_MS
Deprecated.UseDEFAULT_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 returnDEFAULT_MIN_LOADABLE_RETRY_COUNT_PROGRESSIVE_LIVE
fordataType
C.DATA_TYPE_MEDIA_PROGRESSIVE_LIVE
. For otherdataType
values, it will returnDEFAULT_MIN_LOADABLE_RETRY_COUNT
.
-
DefaultLoadErrorHandlingPolicy
public DefaultLoadErrorHandlingPolicy(int minimumLoadableRetryCount)
Deprecated.Creates an instance with the given value forgetMinimumLoadableRetryCount(int)
.- Parameters:
minimumLoadableRetryCount
- SeegetMinimumLoadableRetryCount(int)
.
-
-
Method Detail
-
getFallbackSelectionFor
@Nullable public 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.- This policy will only specify a fallback if
isEligibleForFallback(java.io.IOException)
returnstrue
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
orDEFAULT_TRACK_EXCLUSION_MS
, depending on the fallback type.
- Specified by:
getFallbackSelectionFor
in interfaceLoadErrorHandlingPolicy
- Parameters:
fallbackOptions
- The available fallback options.loadErrorInfo
- ALoadErrorHandlingPolicy.LoadErrorInfo
holding information about the load error.- Returns:
- The selected fallback, or
null
if the calling loader should not fall back.
- This policy will only specify a fallback if
-
getRetryDelayMsFor
public long getRetryDelayMsFor(LoadErrorHandlingPolicy.LoadErrorInfo loadErrorInfo)
Deprecated.Retries for any exception that is not a subclass ofParserException
,FileNotFoundException
,HttpDataSource.CleartextNotPermittedException
orLoader.UnexpectedLoaderException
, and for whichDataSourceException.isCausedByPositionOutOfRange(java.io.IOException)
returnsfalse
. The retry delay is calculated asMath.min((errorCount - 1) * 1000, 5000)
.- Specified by:
getRetryDelayMsFor
in interfaceLoadErrorHandlingPolicy
- Parameters:
loadErrorInfo
- ALoadErrorHandlingPolicy.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.SeeDefaultLoadErrorHandlingPolicy()
andDefaultLoadErrorHandlingPolicy(int)
for documentation about the behavior of this method.- Specified by:
getMinimumLoadableRetryCount
in interfaceLoadErrorHandlingPolicy
- Parameters:
dataType
- One of theC.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 exception)
Deprecated.Returns whether an error should trigger a fallback if possible.
-
-