ExoPlaybackException


public final class ExoPlaybackException extends PlaybackException


Thrown when a non locally recoverable playback failure occurs.

Summary

Nested types

@UnstableApi
@Documented
@Retention(value = RetentionPolicy.SOURCE)
@Target(value = )
@IntDef(value = )
public annotation ExoPlaybackException.Type

The type of source that produced the error.

Constants

static final int

The error occurred in a remote component.

static final int

The error occurred in a Renderer.

static final int

The error occurred loading data from a MediaSource.

static final int

The error was an unexpected RuntimeException.

Public fields

final @Nullable MediaSource.MediaPeriodId

The MediaPeriodId of the media associated with this error, or null if undetermined.

final @Nullable Format

If type is TYPE_RENDERER, this is the Format the renderer was using at the time of the exception, or null if the renderer wasn't using a Format.

final int

If type is TYPE_RENDERER, this is the level of FormatSupport of the renderer for rendererFormat.

final int

If type is TYPE_RENDERER, this is the index of the renderer.

final @Nullable String

If type is TYPE_RENDERER, this is the name of the renderer.

final int

The Type of the playback failure.

Public methods

static ExoPlaybackException

Creates an instance of type TYPE_REMOTE.

static ExoPlaybackException
@UnstableApi
createForRenderer(
    Throwable cause,
    String rendererName,
    int rendererIndex,
    @Nullable Format rendererFormat,
    @C.FormatSupport int rendererFormatSupport,
    boolean isRecoverable,
    @PlaybackException.ErrorCode int errorCode
)

Creates an instance of type TYPE_RENDERER.

static ExoPlaybackException
@UnstableApi
createForSource(IOException cause, int errorCode)

Creates an instance of type TYPE_SOURCE.

static ExoPlaybackException

This method is deprecated.

Use createForUnexpected(RuntimeException, ERROR_CODE_UNSPECIFIED) instead.

static ExoPlaybackException

Creates an instance of type TYPE_UNEXPECTED.

boolean

Returns whether the error data associated to this exception equals the error data associated to other.

static ExoPlaybackException

Restores a ExoPlaybackException from a Bundle.

Exception

Retrieves the underlying error when type is TYPE_RENDERER.

IOException

Retrieves the underlying error when type is TYPE_SOURCE.

RuntimeException

Retrieves the underlying error when type is TYPE_UNEXPECTED.

Bundle

Returns a representing the information stored in this exception.

Inherited Constants

From androidx.media3.common.PlaybackException
static final int

Player implementations that want to surface custom errors can use error codes greater than this value, so as to avoid collision with other error codes defined in this class.

static final int

Caused by an AudioTrack initialization failure.

static final int

Caused by an AudioTrack init operation failure in offload mode.

static final int

Caused by an AudioTrack write operation failure in offload mode.

static final int

Caused by an AudioTrack write operation failure.

static final int

Caused by expired authentication.

static final int

Caused by an argument that is illegal.

static final int

Caused by the loading position falling behind the sliding window of available live content.

static final int

Caused by too many concurrent streams.

static final int

Caused by a request for content that was already playing.

static final int

Caused by a decoder initialization failure.

static final int

Caused by a decoder query failure.

static final int

Caused by a failure while trying to decode media samples.

static final int

Caused by trying to decode content whose format exceeds the capabilities of the device.

static final int

Caused by trying to decode content whose format is not supported.

static final int

Caused by higher priority task reclaiming resources needed for decoding.

static final int

Caused by a disconnected component.

static final int

Caused by attempting to play incompatible DRM-protected content.

static final int

Caused by the device having revoked DRM privileges.

static final int

Caused by an operation being disallowed by a license policy.

static final int

Caused by a failure while trying to obtain a license.

static final int

Caused by an expired DRM license being loaded into an open DRM session.

static final int

Caused by a failure while provisioning the device.

static final int

Caused by a chosen DRM protection scheme not being supported by the device.

static final int

Caused by an error in the DRM system.

static final int

Caused by an unspecified error related to DRM protection.

static final int

Caused by navigation that failed because the playlist was exhausted.

static final int

Caused by a failed runtime check.

static final int

Caused by a command that cannot be completed because the current state is not valid.

static final int

Caused by an HTTP server returning an unexpected HTTP response status code.

static final int

Caused by the player trying to access cleartext HTTP traffic (meaning http:// rather than https://) when the app's Network Security Configuration does not permit it.

static final int

Caused by a non-existent file.

static final int

Caused by a server returning a resource with an invalid "Content-Type" HTTP header value.

static final int

Caused by a network connection failure.

static final int

Caused by a network timeout, meaning the server is taking too long to fulfill a request.

static final int

Caused by lack of permission to perform an IO operation.

static final int

Caused by reading data out of the data bound.

static final int

Caused by an Input/Output error which could not be identified.

static final int

Caused by the content being blocked due to being regionally unavailable.

static final int

Caused by a command that is not supported.

static final int

Caused by the content being blocked due to parental controls.

static final int

Caused by a parsing error associated with a media container format bitstream.

static final int

Caused by attempting to extract a file with an unsupported media container format, or an unsupported media container feature.

static final int

Caused by a parsing error associated with a media manifest.

static final int

Caused by an unsupported feature in a media manifest.

static final int

Caused by a command that is not allowed.

static final int

Caused by a premium account that is required but the user is not subscribed.

static final int

Caused by an unidentified error in a remote Player, which is a Player that runs on a different host or process.

static final int

Caused by playback that needs manual user intervention.

static final int

Caused by the skip limit that is exhausted.

static final int

Caused by a generic timeout.

static final int

Caused by an error whose cause could not be identified.

static final int

Caused by a failure when processing a video frame.

static final int

Caused by a failure when initializing a VideoFrameProcessor.

static final int

Defines a minimum field ID value for subclasses to use when implementing toBundle and delegating to PlaybackException.

Inherited fields

From androidx.media3.common.PlaybackException
final int

An error code which identifies the cause of the playback failure.

final Bundle

An extras Bundle.

final long

The value of elapsedRealtime when this exception was created.

Inherited methods

From androidx.media3.common.PlaybackException
static PlaybackException

Restores a PlaybackException from a Bundle.

final String

Equivalent to PlaybackException.getErrorCodeName(this.errorCode).

static String

Returns the name of a given errorCode.

From java.lang.Throwable
synchronized final void
synchronized Throwable
synchronized Throwable
String
String
StackTraceElement[]
synchronized final Throwable[]
synchronized Throwable
void
void
setStackTrace(StackTraceElement[] stackTrace)
String

Constants

TYPE_REMOTE

@UnstableApi
public static final int TYPE_REMOTE = 3

The error occurred in a remote component.

Call getMessage to retrieve the message associated with the error.

TYPE_RENDERER

@UnstableApi
public static final int TYPE_RENDERER = 1

The error occurred in a Renderer.

Call getRendererException to retrieve the underlying cause.

TYPE_SOURCE

@UnstableApi
public static final int TYPE_SOURCE = 0

The error occurred loading data from a MediaSource.

Call getSourceException to retrieve the underlying cause.

TYPE_UNEXPECTED

@UnstableApi
public static final int TYPE_UNEXPECTED = 2

The error was an unexpected RuntimeException.

Call getUnexpectedException to retrieve the underlying cause.

Public fields

mediaPeriodId

@UnstableApi
public final @Nullable MediaSource.MediaPeriodId mediaPeriodId

The MediaPeriodId of the media associated with this error, or null if undetermined.

rendererFormat

@UnstableApi
public final @Nullable Format rendererFormat

If type is TYPE_RENDERER, this is the Format the renderer was using at the time of the exception, or null if the renderer wasn't using a Format.

rendererFormatSupport

@UnstableApi
@C.FormatSupport
public final int rendererFormatSupport

If type is TYPE_RENDERER, this is the level of FormatSupport of the renderer for rendererFormat. If rendererFormat is null, this is FORMAT_HANDLED.

rendererIndex

@UnstableApi
public final int rendererIndex

If type is TYPE_RENDERER, this is the index of the renderer.

rendererName

@UnstableApi
public final @Nullable String rendererName

If type is TYPE_RENDERER, this is the name of the renderer.

type

@UnstableApi
@ExoPlaybackException.Type
public final int type

The Type of the playback failure.

Public methods

createForRemote

@UnstableApi
public static ExoPlaybackException createForRemote(String message)

Creates an instance of type TYPE_REMOTE.

Parameters
String message

The message associated with the error.

Returns
ExoPlaybackException

The created instance.

createForRenderer

@UnstableApi
public static ExoPlaybackException createForRenderer(
    Throwable cause,
    String rendererName,
    int rendererIndex,
    @Nullable Format rendererFormat,
    @C.FormatSupport int rendererFormatSupport,
    boolean isRecoverable,
    @PlaybackException.ErrorCode int errorCode
)

Creates an instance of type TYPE_RENDERER.

Parameters
Throwable cause

The cause of the failure.

String rendererName

The name of the renderer in which the failure occurred.

int rendererIndex

The index of the renderer in which the failure occurred.

@Nullable Format rendererFormat

The Format the renderer was using at the time of the exception, or null if the renderer wasn't using a Format.

@C.FormatSupport int rendererFormatSupport

The FormatSupport of the renderer for rendererFormat. Ignored if rendererFormat is null.

boolean isRecoverable

If the failure can be recovered by disabling and re-enabling the renderer.

@PlaybackException.ErrorCode int errorCode

See errorCode.

Returns
ExoPlaybackException

The created instance.

createForSource

@UnstableApi
public static ExoPlaybackException createForSource(IOException cause, int errorCode)

Creates an instance of type TYPE_SOURCE.

Parameters
IOException cause

The cause of the failure.

int errorCode

See errorCode.

Returns
ExoPlaybackException

The created instance.

createForUnexpected

@UnstableApi
public static ExoPlaybackException createForUnexpected(RuntimeException cause)

createForUnexpected

@UnstableApi
public static ExoPlaybackException createForUnexpected(
    RuntimeException cause,
    @PlaybackException.ErrorCode int errorCode
)

Creates an instance of type TYPE_UNEXPECTED.

Parameters
RuntimeException cause

The cause of the failure.

@PlaybackException.ErrorCode int errorCode

See errorCode.

Returns
ExoPlaybackException

The created instance.

errorInfoEquals

public boolean errorInfoEquals(@Nullable PlaybackException that)

Returns whether the error data associated to this exception equals the error data associated to other.

Note that this method does not compare the exceptions' stacktraces.

fromBundle

@UnstableApi
public static ExoPlaybackException fromBundle(Bundle bundle)

Restores a ExoPlaybackException from a Bundle.

getRendererException

@UnstableApi
public Exception getRendererException()

Retrieves the underlying error when type is TYPE_RENDERER.

getSourceException

@UnstableApi
public IOException getSourceException()

Retrieves the underlying error when type is TYPE_SOURCE.

getUnexpectedException

@UnstableApi
public RuntimeException getUnexpectedException()

Retrieves the underlying error when type is TYPE_UNEXPECTED.

toBundle

@UnstableApi
public Bundle toBundle()

Returns a representing the information stored in this exception.

It omits the mediaPeriodId field. The mediaPeriodId of an instance restored by fromBundle will always be null.