docs/doc/reference/com/google/android/exoplayer2/upstream/Loader.html
Package com.google.android.exoplayer2.upstream
All Implemented Interfaces:LoaderErrorThrower
[@Deprecated](https://developer.android.com/reference/java/lang/Deprecated.html "class or interface in java.lang")public final classLoaderextends[Object](https://developer.android.com/reference/java/lang/Object.html "class or interface in java.lang")implements[LoaderErrorThrower](LoaderErrorThrower.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.
Manages the background loading of Loader.Loadables.
Nested Classes | Modifier and Type | Class | Description |
| --- | --- | --- |
| static interface | Loader.Callback<T extends Loader.Loadable> |
Deprecated.
A callback to be notified of Loader events.
|
| static interface | Loader.Loadable |
Deprecated.
An object that can be loaded using a Loader.
|
| static class | Loader.LoadErrorAction |
Deprecated.
Action that can be taken in response to Loader.Callback.onLoadError(Loadable, long, long, IOException, int).
|
| static interface | Loader.ReleaseCallback |
Deprecated.
A callback to be notified when a Loader has finished being released.
|
| static class | Loader.UnexpectedLoaderException |
Deprecated.
Thrown when an unexpected exception or error is encountered during loading. |
-
LoaderErrorThrower.Placeholder
Fields | Modifier and Type | Field | Description |
| --- | --- | --- |
| static Loader.LoadErrorAction | DONT_RETRY |
Deprecated.
Discards the failed Loader.Loadable and ignores any errors that have occurred.
|
| static Loader.LoadErrorAction | DONT_RETRY_FATAL |
Deprecated.
Discards the failed Loader.Loadable.
|
| static Loader.LoadErrorAction | RETRY |
Deprecated.
Retries the load using the default delay.
|
| static Loader.LoadErrorAction | RETRY_RESET_ERROR_COUNT |
Deprecated.
Retries the load using the default delay and resets the error count. |
Constructors | Constructor | Description |
| --- | --- |
| Loader(String threadNameSuffix) |
Deprecated.
|
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods | Modifier and Type | Method | Description |
| --- | --- | --- |
| void | cancelLoading() |
Deprecated.
Cancels the current load.
|
| void | clearFatalError() |
Deprecated.
Clears any stored fatal error.
|
| static Loader.LoadErrorAction | createRetryAction(boolean resetErrorCount, long retryDelayMillis) |
Deprecated.
Creates a Loader.LoadErrorAction for retrying with the given parameters.
|
| boolean | hasFatalError() |
Deprecated.
Whether the last call to startLoading(T, com.google.android.exoplayer2.upstream.Loader.Callback<T>, int) resulted in a fatal error.
|
| boolean | isLoading() |
Deprecated.
Returns whether the loader is currently loading.
|
| void | maybeThrowError() |
Deprecated.
Throws a fatal error, or a non-fatal error if loading is currently backed off and the current Loader.Loadable has incurred a number of errors greater than the Loaders default minimum number of retries.
|
| void | maybeThrowError(int minRetryCount) |
Deprecated.
Throws a fatal error, or a non-fatal error if loading is currently backed off and the current Loader.Loadable has incurred a number of errors greater than the specified minimum number of retries.
|
| void | release() |
Deprecated.
Releases the loader.
|
| void | release(Loader.ReleaseCallback callback) |
Deprecated.
Releases the loader.
|
| <T extends Loader.Loadable>long | startLoading(T loadable, Loader.Callback<T> callback, int defaultMinRetryCount) |
Deprecated.
Starts loading a Loader.Loadable.
|
-
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
public static final[Loader.LoadErrorAction](Loader.LoadErrorAction.html "class in com.google.android.exoplayer2.upstream")RETRY
Deprecated.
Retries the load using the default delay.
-
public static final[Loader.LoadErrorAction](Loader.LoadErrorAction.html "class in com.google.android.exoplayer2.upstream")RETRY_RESET_ERROR_COUNT
Deprecated.
Retries the load using the default delay and resets the error count.
-
public static final[Loader.LoadErrorAction](Loader.LoadErrorAction.html "class in com.google.android.exoplayer2.upstream")DONT_RETRY
Deprecated.
Discards the failed Loader.Loadable and ignores any errors that have occurred.
-
public static final[Loader.LoadErrorAction](Loader.LoadErrorAction.html "class in com.google.android.exoplayer2.upstream")DONT_RETRY_FATAL
Deprecated.
Discards the failed Loader.Loadable. The next call to maybeThrowError() will throw the last load error.
-
public Loader([String](https://developer.android.com/reference/java/lang/String.html "class or interface in java.lang")threadNameSuffix)
Deprecated.
Parameters:threadNameSuffix - A name suffix for the loader's thread. This should be the name of the component using the loader.
-
public static[Loader.LoadErrorAction](Loader.LoadErrorAction.html "class in com.google.android.exoplayer2.upstream")createRetryAction(boolean resetErrorCount,
long retryDelayMillis)
Deprecated.
Creates a Loader.LoadErrorAction for retrying with the given parameters.
Parameters:resetErrorCount - Whether the previous error count should be set to zero.retryDelayMillis - The number of milliseconds to wait before retrying.Returns:A Loader.LoadErrorAction for retrying with the given parameters.
-
public boolean hasFatalError()
Deprecated.
Whether the last call to startLoading(T, com.google.android.exoplayer2.upstream.Loader.Callback<T>, int) resulted in a fatal error. Calling maybeThrowError() will throw the fatal error.
-
public void clearFatalError()
Deprecated.
Clears any stored fatal error.
-
public <T extends[Loader.Loadable](Loader.Loadable.html "interface in com.google.android.exoplayer2.upstream")> long startLoading(T loadable,[Loader.Callback](Loader.Callback.html "interface in com.google.android.exoplayer2.upstream")<T> callback,
int defaultMinRetryCount)
Deprecated.
Starts loading a Loader.Loadable.
The calling thread must be a Looper thread, which is the thread on which the Loader.Callback will be called.
Type Parameters:T - The type of the loadable.Parameters:loadable - The Loader.Loadable to load.callback - A callback to be called when the load ends.defaultMinRetryCount - The minimum number of times the load must be retried before maybeThrowError() will propagate an error.Returns:SystemClock.elapsedRealtime() when the load started.Throws:IllegalStateException - If the calling thread does not have an associated Looper.
-
public boolean isLoading()
Deprecated.
Returns whether the loader is currently loading.
-
public void cancelLoading()
Deprecated.
Cancels the current load.
Throws:IllegalStateException - If the loader is not currently loading.
-
public void release()
Deprecated.
Releases the loader. This method should be called when the loader is no longer required.
-
public void release(@Nullable[Loader.ReleaseCallback](Loader.ReleaseCallback.html "interface in com.google.android.exoplayer2.upstream")callback)
Deprecated.
Releases the loader. This method should be called when the loader is no longer required.
Parameters:callback - An optional callback to be called on the loading thread once the loader has been released.
-
public void maybeThrowError()
throws[IOException](https://developer.android.com/reference/java/io/IOException.html "class or interface in java.io")
Deprecated.
Description copied from interface: LoaderErrorThrower
Throws a fatal error, or a non-fatal error if loading is currently backed off and the current Loader.Loadable has incurred a number of errors greater than the Loaders default minimum number of retries. Else does nothing.
Specified by:maybeThrowError in interface LoaderErrorThrowerThrows:IOException - The error.
-
public void maybeThrowError(int minRetryCount)
throws[IOException](https://developer.android.com/reference/java/io/IOException.html "class or interface in java.io")
Deprecated.
Description copied from interface: LoaderErrorThrower
Throws a fatal error, or a non-fatal error if loading is currently backed off and the current Loader.Loadable has incurred a number of errors greater than the specified minimum number of retries. Else does nothing.
Specified by:maybeThrowError in interface LoaderErrorThrowerParameters:minRetryCount - A minimum retry count that must be exceeded for a non-fatal error to be thrown. Should be non-negative.Throws:IOException - The error.