Package com.google.android.exoplayer2
Class ExoPlaybackException
- java.lang.Object
-
- java.lang.Throwable
-
- java.lang.Exception
-
- com.google.android.exoplayer2.ExoPlaybackException
-
- All Implemented Interfaces:
Bundleable,Serializable
public final class ExoPlaybackException extends Exception implements Bundleable
Thrown when a non locally recoverable playback failure occurs.- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceExoPlaybackException.TypeThe type of source that produced the error.-
Nested classes/interfaces inherited from interface com.google.android.exoplayer2.Bundleable
Bundleable.Creator<T extends Bundleable>
-
-
Field Summary
Fields Modifier and Type Field Description static Bundleable.Creator<ExoPlaybackException>CREATORObject that can restoreExoPlaybackExceptionfrom aBundle.MediaPeriodIdmediaPeriodIdTheMediaPeriodIdof the media associated with this error, or null if undetermined.FormatrendererFormatIftypeisTYPE_RENDERER, this is theFormatthe renderer was using at the time of the exception, or null if the renderer wasn't using aFormat.intrendererFormatSupportintrendererIndexStringrendererNameIftypeisTYPE_RENDERER, this is the name of the renderer, or null if unknown.longtimestampMsThe value ofSystemClock.elapsedRealtime()when this exception was created.inttypeTheExoPlaybackException.Typeof the playback failure.static intTYPE_REMOTEThe error occurred in a remote component.static intTYPE_RENDERERThe error occurred in aRenderer.static intTYPE_SOURCEThe error occurred loading data from aMediaSource.static intTYPE_UNEXPECTEDThe error was an unexpectedRuntimeException.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static ExoPlaybackExceptioncreateForRemote(String message)Creates an instance of typeTYPE_REMOTE.static ExoPlaybackExceptioncreateForRenderer(Exception cause)Creates an instance of typeTYPE_RENDERERfor an unknown renderer.static ExoPlaybackExceptioncreateForRenderer(Throwable cause, String rendererName, int rendererIndex, Format rendererFormat, int rendererFormatSupport)Creates an instance of typeTYPE_RENDERER.static ExoPlaybackExceptioncreateForRenderer(Throwable cause, String rendererName, int rendererIndex, Format rendererFormat, int rendererFormatSupport, boolean isRecoverable)Creates an instance of typeTYPE_RENDERER.static ExoPlaybackExceptioncreateForSource(IOException cause)Creates an instance of typeTYPE_SOURCE.static ExoPlaybackExceptioncreateForUnexpected(RuntimeException cause)Creates an instance of typeTYPE_UNEXPECTED.ExceptiongetRendererException()Retrieves the underlying error whentypeisTYPE_RENDERER.IOExceptiongetSourceException()Retrieves the underlying error whentypeisTYPE_SOURCE.RuntimeExceptiongetUnexpectedException()Retrieves the underlying error whentypeisTYPE_UNEXPECTED.BundletoBundle()Returns aBundlerepresenting the information stored in this object.-
Methods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
-
-
-
Field Detail
-
TYPE_SOURCE
public static final int TYPE_SOURCE
The error occurred loading data from aMediaSource.Call
getSourceException()to retrieve the underlying cause.- See Also:
- Constant Field Values
-
TYPE_RENDERER
public static final int TYPE_RENDERER
The error occurred in aRenderer.Call
getRendererException()to retrieve the underlying cause.- See Also:
- Constant Field Values
-
TYPE_UNEXPECTED
public static final int TYPE_UNEXPECTED
The error was an unexpectedRuntimeException.Call
getUnexpectedException()to retrieve the underlying cause.- See Also:
- Constant Field Values
-
TYPE_REMOTE
public static final int TYPE_REMOTE
The error occurred in a remote component.Call
Throwable.getMessage()to retrieve the message associated with the error.- See Also:
- Constant Field Values
-
type
@Type public final int type
TheExoPlaybackException.Typeof the playback failure.
-
rendererName
@Nullable public final String rendererName
IftypeisTYPE_RENDERER, this is the name of the renderer, or null if unknown.
-
rendererIndex
public final int rendererIndex
-
rendererFormat
@Nullable public final Format rendererFormat
IftypeisTYPE_RENDERER, this is theFormatthe renderer was using at the time of the exception, or null if the renderer wasn't using aFormat.
-
rendererFormatSupport
@FormatSupport public final int rendererFormatSupport
IftypeisTYPE_RENDERER, this is the level ofC.FormatSupportof the renderer forrendererFormat. IfrendererFormatis null, this isC.FORMAT_HANDLED.
-
timestampMs
public final long timestampMs
The value ofSystemClock.elapsedRealtime()when this exception was created.
-
mediaPeriodId
@Nullable public final MediaPeriodId mediaPeriodId
TheMediaPeriodIdof the media associated with this error, or null if undetermined.
-
CREATOR
public static final Bundleable.Creator<ExoPlaybackException> CREATOR
Object that can restoreExoPlaybackExceptionfrom aBundle.
-
-
Method Detail
-
createForSource
public static ExoPlaybackException createForSource(IOException cause)
Creates an instance of typeTYPE_SOURCE.- Parameters:
cause- The cause of the failure.- Returns:
- The created instance.
-
createForRenderer
public static ExoPlaybackException createForRenderer(Exception cause)
Creates an instance of typeTYPE_RENDERERfor an unknown renderer.- Parameters:
cause- The cause of the failure.- Returns:
- The created instance.
-
createForRenderer
public static ExoPlaybackException createForRenderer(Throwable cause, String rendererName, int rendererIndex, @Nullable Format rendererFormat, @FormatSupport int rendererFormatSupport)
Creates an instance of typeTYPE_RENDERER.- Parameters:
cause- The cause of the failure.rendererIndex- The index of the renderer in which the failure occurred.rendererFormat- TheFormatthe renderer was using at the time of the exception, or null if the renderer wasn't using aFormat.rendererFormatSupport- TheC.FormatSupportof the renderer forrendererFormat. Ignored ifrendererFormatis null.- Returns:
- The created instance.
-
createForRenderer
public static ExoPlaybackException createForRenderer(Throwable cause, String rendererName, int rendererIndex, @Nullable Format rendererFormat, @FormatSupport int rendererFormatSupport, boolean isRecoverable)
Creates an instance of typeTYPE_RENDERER.- Parameters:
cause- The cause of the failure.rendererIndex- The index of the renderer in which the failure occurred.rendererFormat- TheFormatthe renderer was using at the time of the exception, or null if the renderer wasn't using aFormat.rendererFormatSupport- TheC.FormatSupportof the renderer forrendererFormat. Ignored ifrendererFormatis null.isRecoverable- If the failure can be recovered by disabling and re-enabling the renderer.- Returns:
- The created instance.
-
createForUnexpected
public static ExoPlaybackException createForUnexpected(RuntimeException cause)
Creates an instance of typeTYPE_UNEXPECTED.- Parameters:
cause- The cause of the failure.- Returns:
- The created instance.
-
createForRemote
public static ExoPlaybackException createForRemote(String message)
Creates an instance of typeTYPE_REMOTE.- Parameters:
message- The message associated with the error.- Returns:
- The created instance.
-
getSourceException
public IOException getSourceException()
Retrieves the underlying error whentypeisTYPE_SOURCE.- Throws:
IllegalStateException- Iftypeis notTYPE_SOURCE.
-
getRendererException
public Exception getRendererException()
Retrieves the underlying error whentypeisTYPE_RENDERER.- Throws:
IllegalStateException- Iftypeis notTYPE_RENDERER.
-
getUnexpectedException
public RuntimeException getUnexpectedException()
Retrieves the underlying error whentypeisTYPE_UNEXPECTED.- Throws:
IllegalStateException- Iftypeis notTYPE_UNEXPECTED.
-
toBundle
public Bundle toBundle()
Returns aBundlerepresenting the information stored in this object.It omits the
mediaPeriodIdfield. ThemediaPeriodIdof an instance restored byCREATORwill always benull.- Specified by:
toBundlein interfaceBundleable
-
-