ExoPlaybackException
public final class ExoPlaybackException extends PlaybackException
| java.lang.Object | ||||
| ↳ | kotlin.Throwable | |||
| ↳ | java.lang.Exception | |||
| ↳ | androidx.media3.common.PlaybackException | |||
| ↳ | androidx.media3.exoplayer.ExoPlaybackException |
Thrown when a non locally recoverable playback failure occurs.
Summary
Nested types |
|---|
@UnstableApiThe 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 |
static final int |
The error occurred loading data from a |
static final int |
The error was an unexpected |
Public fields |
|
|---|---|
final @Nullable MediaSource.MediaPeriodId |
The |
final @Nullable Format |
If |
final int |
If |
final int |
If |
final @Nullable String |
If |
final int |
The |
Public methods |
|
|---|---|
static ExoPlaybackException |
@UnstableApiCreates an instance of type |
static ExoPlaybackException |
@UnstableApiThis method is deprecated. Use |
static ExoPlaybackException |
@UnstableApiCreates an instance of type |
static ExoPlaybackException |
@UnstableApiCreates an instance of type |
static ExoPlaybackException |
This method is deprecated. Use |
static ExoPlaybackException |
@UnstableApiCreates an instance of type |
boolean |
Returns whether the error data associated to this exception equals the error data associated to |
Exception |
Retrieves the underlying error when |
IOException |
Retrieves the underlying error when |
RuntimeException |
Retrieves the underlying error when |
Inherited Constants |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
Inherited fields |
||||||
|---|---|---|---|---|---|---|
|
Inherited methods |
||||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
||||||||||
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.
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 ExoPlaybackExceptioncreateForRenderer(
Throwable cause,
String rendererName,
int rendererIndex,
@Nullable Format rendererFormat,
@C.FormatSupport int rendererFormatSupport,
boolean isRecoverable,
@PlaybackException.ErrorCode int errorCode
)
createForRenderer
@UnstableApi
public static ExoPlaybackException createForRenderer(
Throwable cause,
String rendererName,
int rendererIndex,
@Nullable Format rendererFormat,
@C.FormatSupport int rendererFormatSupport,
@Nullable MediaSource.MediaPeriodId mediaPeriodId,
boolean isRecoverable,
@PlaybackException.ErrorCode int errorCode
)
Creates an instance of type TYPE_RENDERER.
| Parameters | |
|---|---|
Throwable cause |
The cause of the failure. |
String rendererName |
The |
int rendererIndex |
The index of the renderer in which the failure occurred. |
@Nullable Format rendererFormat |
The |
@C.FormatSupport int rendererFormatSupport |
The |
@Nullable MediaSource.MediaPeriodId mediaPeriodId |
The |
boolean isRecoverable |
If the failure can be recovered by disabling and re-enabling the renderer. |
@PlaybackException.ErrorCode int errorCode |
See |
| 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 |
| Returns | |
|---|---|
ExoPlaybackException |
The created instance. |
createForUnexpected
@UnstableApi
public static ExoPlaybackExceptioncreateForUnexpected(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 |
| 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' stack traces and extras.
getRendererException
@UnstableApi
public Exception getRendererException()
Retrieves the underlying error when type is TYPE_RENDERER.
| Throws | |
|---|---|
java.lang.IllegalStateException |
If |
getSourceException
@UnstableApi
public IOException getSourceException()
Retrieves the underlying error when type is TYPE_SOURCE.
| Throws | |
|---|---|
java.lang.IllegalStateException |
If |
getUnexpectedException
@UnstableApi
public RuntimeException getUnexpectedException()
Retrieves the underlying error when type is TYPE_UNEXPECTED.
| Throws | |
|---|---|
java.lang.IllegalStateException |
If |