public interface

Loader.Callback<T extends Loader.Loadable>

 androidx.media3.exoplayer.upstream.Loader.Callback<T>

Subclasses:

ChunkSampleStream<T>, DefaultHlsPlaylistTracker, SsMediaSource

Overview

A callback to be notified of Loader events.

Summary

Methods
public voidonLoadCanceled(Loader.Loadable loadable, long elapsedRealtimeMs, long loadDurationMs, boolean released)

Called when a load has been canceled.

public voidonLoadCompleted(Loader.Loadable loadable, long elapsedRealtimeMs, long loadDurationMs)

Called when a load has completed.

public Loader.LoadErrorActiononLoadError(Loader.Loadable loadable, long elapsedRealtimeMs, long loadDurationMs, java.io.IOException error, int errorCount)

Called when a load encounters an error.

Methods

public void onLoadCompleted(Loader.Loadable loadable, long elapsedRealtimeMs, long loadDurationMs)

Called when a load has completed.

Note: There is guaranteed to be a memory barrier between Loader.Loadable.load() exiting and this callback being called.

Parameters:

loadable: The loadable whose load has completed.
elapsedRealtimeMs: when the load ended.
loadDurationMs: The duration in milliseconds of the load since Loader.startLoading(T, Loader.Callback, int) was called.

public void onLoadCanceled(Loader.Loadable loadable, long elapsedRealtimeMs, long loadDurationMs, boolean released)

Called when a load has been canceled.

Note: If the Loader has not been released then there is guaranteed to be a memory barrier between Loader.Loadable.load() exiting and this callback being called. If the Loader has been released then this callback may be called before Loader.Loadable.load() exits.

Parameters:

loadable: The loadable whose load has been canceled.
elapsedRealtimeMs: when the load was canceled.
loadDurationMs: The duration in milliseconds of the load since Loader.startLoading(T, Loader.Callback, int) was called up to the point at which it was canceled.
released: True if the load was canceled because the Loader was released. False otherwise.

public Loader.LoadErrorAction onLoadError(Loader.Loadable loadable, long elapsedRealtimeMs, long loadDurationMs, java.io.IOException error, int errorCount)

Called when a load encounters an error.

Note: There is guaranteed to be a memory barrier between Loader.Loadable.load() exiting and this callback being called.

Parameters:

loadable: The loadable whose load has encountered an error.
elapsedRealtimeMs: when the error occurred.
loadDurationMs: The duration in milliseconds of the load since Loader.startLoading(T, Loader.Callback, int) was called up to the point at which the error occurred.
error: The load error.
errorCount: The number of errors this load has encountered, including this one.

Returns:

The desired error handling action. One of Loader.RETRY, Loader.RETRY_RESET_ERROR_COUNT, Loader.DONT_RETRY, Loader.DONT_RETRY_FATAL or a retry action created by Loader.createRetryAction(boolean, long).