Class PlaybackException
- java.lang.Object
-
- java.lang.Throwable
-
- java.lang.Exception
-
- com.google.android.exoplayer2.PlaybackException
-
- All Implemented Interfaces:
Bundleable
,Serializable
- Direct Known Subclasses:
ExoPlaybackException
public class PlaybackException 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 interface
PlaybackException.ErrorCode
Codes that identify causes of player errors.protected static interface
PlaybackException.FieldNumber
Identifiers for fields in aBundle
which represents a playback exception.-
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<PlaybackException>
CREATOR
Object that can create aPlaybackException
from aBundle
.static int
CUSTOM_ERROR_CODE_BASE
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 int
ERROR_CODE_AUDIO_TRACK_INIT_FAILED
Caused by an AudioTrack initialization failure.static int
ERROR_CODE_AUDIO_TRACK_WRITE_FAILED
Caused by an AudioTrack write operation failure.static int
ERROR_CODE_BEHIND_LIVE_WINDOW
Caused by the loading position falling behind the sliding window of available live content.static int
ERROR_CODE_DECODER_INIT_FAILED
Caused by a decoder initialization failure.static int
ERROR_CODE_DECODER_QUERY_FAILED
Caused by a decoder query failure.static int
ERROR_CODE_DECODING_FAILED
Caused by a failure while trying to decode media samples.static int
ERROR_CODE_DECODING_FORMAT_EXCEEDS_CAPABILITIES
Caused by trying to decode content whose format exceeds the capabilities of the device.static int
ERROR_CODE_DECODING_FORMAT_UNSUPPORTED
Caused by trying to decode content whose format is not supported.static int
ERROR_CODE_DRM_CONTENT_ERROR
Caused by attempting to play incompatible DRM-protected content.static int
ERROR_CODE_DRM_DEVICE_REVOKED
Caused by the device having revoked DRM privileges.static int
ERROR_CODE_DRM_DISALLOWED_OPERATION
Caused by an operation being disallowed by a license policy.static int
ERROR_CODE_DRM_LICENSE_ACQUISITION_FAILED
Caused by a failure while trying to obtain a license.static int
ERROR_CODE_DRM_LICENSE_EXPIRED
Caused by an expired DRM license being loaded into an open DRM session.static int
ERROR_CODE_DRM_PROVISIONING_FAILED
Caused by a failure while provisioning the device.static int
ERROR_CODE_DRM_SCHEME_UNSUPPORTED
Caused by a chosen DRM protection scheme not being supported by the device.static int
ERROR_CODE_DRM_SYSTEM_ERROR
Caused by an error in the DRM system.static int
ERROR_CODE_DRM_UNSPECIFIED
Caused by an unspecified error related to DRM protection.static int
ERROR_CODE_FAILED_RUNTIME_CHECK
Caused by a failed runtime check.static int
ERROR_CODE_IO_BAD_HTTP_STATUS
Caused by an HTTP server returning an unexpected HTTP response status code.static int
ERROR_CODE_IO_CLEARTEXT_NOT_PERMITTED
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 int
ERROR_CODE_IO_FILE_NOT_FOUND
Caused by a non-existent file.static int
ERROR_CODE_IO_INVALID_HTTP_CONTENT_TYPE
Caused by a server returning a resource with an invalid "Content-Type" HTTP header value.static int
ERROR_CODE_IO_NETWORK_CONNECTION_FAILED
Caused by a network connection failure.static int
ERROR_CODE_IO_NETWORK_CONNECTION_TIMEOUT
Caused by a network timeout, meaning the server is taking too long to fulfill a request.static int
ERROR_CODE_IO_NO_PERMISSION
Caused by lack of permission to perform an IO operation.static int
ERROR_CODE_IO_READ_POSITION_OUT_OF_RANGE
Caused by reading data out of the data bound.static int
ERROR_CODE_IO_UNSPECIFIED
Caused by an Input/Output error which could not be identified.static int
ERROR_CODE_PARSING_CONTAINER_MALFORMED
Caused by a parsing error associated with a media container format bitstream.static int
ERROR_CODE_PARSING_CONTAINER_UNSUPPORTED
Caused by attempting to extract a file with an unsupported media container format, or an unsupported media container feature.static int
ERROR_CODE_PARSING_MANIFEST_MALFORMED
Caused by a parsing error associated with a media manifest.static int
ERROR_CODE_PARSING_MANIFEST_UNSUPPORTED
Caused by an unsupported feature in a media manifest.static int
ERROR_CODE_REMOTE_ERROR
Caused by an unidentified error in a remote Player, which is a Player that runs on a different host or process.static int
ERROR_CODE_TIMEOUT
Caused by a generic timeout.static int
ERROR_CODE_UNSPECIFIED
Caused by an error whose cause could not be identified.@com.google.android.exoplayer2.PlaybackException.ErrorCode int
errorCode
An error code which identifies the cause of the playback failure.protected static int
FIELD_CUSTOM_ID_BASE
Defines a minimum field id value for subclasses to use when implementingtoBundle()
andBundleable.Creator
.long
timestampMs
The value ofSystemClock.elapsedRealtime()
when this exception was created.
-
Constructor Summary
Constructors Modifier Constructor Description protected
PlaybackException(Bundle bundle)
Creates a new instance using the fields obtained from the givenBundle
.PlaybackException(String message, Throwable cause, @com.google.android.exoplayer2.PlaybackException.ErrorCode int errorCode)
Creates an instance.protected
PlaybackException(String message, Throwable cause, @com.google.android.exoplayer2.PlaybackException.ErrorCode int errorCode, long timestampMs)
Creates a new instance using the given values.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
errorInfoEquals(PlaybackException other)
Returns whether the error data associated to this exception equals the error data associated toother
.String
getErrorCodeName()
Equivalent toPlaybackException.getErrorCodeName(this.errorCode)
.static String
getErrorCodeName(@com.google.android.exoplayer2.PlaybackException.ErrorCode int errorCode)
Returns the name of a givenerrorCode
.protected static String
keyForField(int field)
Converts the givenPlaybackException.FieldNumber
to a string which can be used as a field key when implementingtoBundle()
andBundleable.Creator
.Bundle
toBundle()
Returns aBundle
representing 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
-
ERROR_CODE_UNSPECIFIED
public static final int ERROR_CODE_UNSPECIFIED
Caused by an error whose cause could not be identified.- See Also:
- Constant Field Values
-
ERROR_CODE_REMOTE_ERROR
public static final int ERROR_CODE_REMOTE_ERROR
Caused by an unidentified error in a remote Player, which is a Player that runs on a different host or process.- See Also:
- Constant Field Values
-
ERROR_CODE_BEHIND_LIVE_WINDOW
public static final int ERROR_CODE_BEHIND_LIVE_WINDOW
Caused by the loading position falling behind the sliding window of available live content.- See Also:
- Constant Field Values
-
ERROR_CODE_TIMEOUT
public static final int ERROR_CODE_TIMEOUT
Caused by a generic timeout.- See Also:
- Constant Field Values
-
ERROR_CODE_FAILED_RUNTIME_CHECK
public static final int ERROR_CODE_FAILED_RUNTIME_CHECK
Caused by a failed runtime check.This can happen when the application fails to comply with the player's API requirements (for example, by passing invalid arguments), or when the player reaches an invalid state.
- See Also:
- Constant Field Values
-
ERROR_CODE_IO_UNSPECIFIED
public static final int ERROR_CODE_IO_UNSPECIFIED
Caused by an Input/Output error which could not be identified.- See Also:
- Constant Field Values
-
ERROR_CODE_IO_NETWORK_CONNECTION_FAILED
public static final int ERROR_CODE_IO_NETWORK_CONNECTION_FAILED
Caused by a network connection failure.The following is a non-exhaustive list of possible reasons:
- There is no network connectivity (you can check this by querying
ConnectivityManager.getActiveNetwork()
). - The URL's domain is misspelled or does not exist.
- The target host is unreachable.
- The server unexpectedly closes the connection.
- See Also:
- Constant Field Values
- There is no network connectivity (you can check this by querying
-
ERROR_CODE_IO_NETWORK_CONNECTION_TIMEOUT
public static final int ERROR_CODE_IO_NETWORK_CONNECTION_TIMEOUT
Caused by a network timeout, meaning the server is taking too long to fulfill a request.- See Also:
- Constant Field Values
-
ERROR_CODE_IO_INVALID_HTTP_CONTENT_TYPE
public static final int ERROR_CODE_IO_INVALID_HTTP_CONTENT_TYPE
Caused by a server returning a resource with an invalid "Content-Type" HTTP header value.For example, this can happen when the player is expecting a piece of media, but the server returns a paywall HTML page, with content type "text/html".
- See Also:
- Constant Field Values
-
ERROR_CODE_IO_BAD_HTTP_STATUS
public static final int ERROR_CODE_IO_BAD_HTTP_STATUS
Caused by an HTTP server returning an unexpected HTTP response status code.- See Also:
- Constant Field Values
-
ERROR_CODE_IO_FILE_NOT_FOUND
public static final int ERROR_CODE_IO_FILE_NOT_FOUND
Caused by a non-existent file.- See Also:
- Constant Field Values
-
ERROR_CODE_IO_NO_PERMISSION
public static final int ERROR_CODE_IO_NO_PERMISSION
Caused by lack of permission to perform an IO operation. For example, lack of permission to access internet or external storage.- See Also:
- Constant Field Values
-
ERROR_CODE_IO_CLEARTEXT_NOT_PERMITTED
public static final int ERROR_CODE_IO_CLEARTEXT_NOT_PERMITTED
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.- See Also:
- Constant Field Values
-
ERROR_CODE_IO_READ_POSITION_OUT_OF_RANGE
public static final int ERROR_CODE_IO_READ_POSITION_OUT_OF_RANGE
Caused by reading data out of the data bound.- See Also:
- Constant Field Values
-
ERROR_CODE_PARSING_CONTAINER_MALFORMED
public static final int ERROR_CODE_PARSING_CONTAINER_MALFORMED
Caused by a parsing error associated with a media container format bitstream.- See Also:
- Constant Field Values
-
ERROR_CODE_PARSING_MANIFEST_MALFORMED
public static final int ERROR_CODE_PARSING_MANIFEST_MALFORMED
Caused by a parsing error associated with a media manifest. Examples of a media manifest are a DASH or a SmoothStreaming manifest, or an HLS playlist.- See Also:
- Constant Field Values
-
ERROR_CODE_PARSING_CONTAINER_UNSUPPORTED
public static final int ERROR_CODE_PARSING_CONTAINER_UNSUPPORTED
Caused by attempting to extract a file with an unsupported media container format, or an unsupported media container feature.- See Also:
- Constant Field Values
-
ERROR_CODE_PARSING_MANIFEST_UNSUPPORTED
public static final int ERROR_CODE_PARSING_MANIFEST_UNSUPPORTED
Caused by an unsupported feature in a media manifest. Examples of a media manifest are a DASH or a SmoothStreaming manifest, or an HLS playlist.- See Also:
- Constant Field Values
-
ERROR_CODE_DECODER_INIT_FAILED
public static final int ERROR_CODE_DECODER_INIT_FAILED
Caused by a decoder initialization failure.- See Also:
- Constant Field Values
-
ERROR_CODE_DECODER_QUERY_FAILED
public static final int ERROR_CODE_DECODER_QUERY_FAILED
Caused by a decoder query failure.- See Also:
- Constant Field Values
-
ERROR_CODE_DECODING_FAILED
public static final int ERROR_CODE_DECODING_FAILED
Caused by a failure while trying to decode media samples.- See Also:
- Constant Field Values
-
ERROR_CODE_DECODING_FORMAT_EXCEEDS_CAPABILITIES
public static final int ERROR_CODE_DECODING_FORMAT_EXCEEDS_CAPABILITIES
Caused by trying to decode content whose format exceeds the capabilities of the device.- See Also:
- Constant Field Values
-
ERROR_CODE_DECODING_FORMAT_UNSUPPORTED
public static final int ERROR_CODE_DECODING_FORMAT_UNSUPPORTED
Caused by trying to decode content whose format is not supported.- See Also:
- Constant Field Values
-
ERROR_CODE_AUDIO_TRACK_INIT_FAILED
public static final int ERROR_CODE_AUDIO_TRACK_INIT_FAILED
Caused by an AudioTrack initialization failure.- See Also:
- Constant Field Values
-
ERROR_CODE_AUDIO_TRACK_WRITE_FAILED
public static final int ERROR_CODE_AUDIO_TRACK_WRITE_FAILED
Caused by an AudioTrack write operation failure.- See Also:
- Constant Field Values
-
ERROR_CODE_DRM_UNSPECIFIED
public static final int ERROR_CODE_DRM_UNSPECIFIED
Caused by an unspecified error related to DRM protection.- See Also:
- Constant Field Values
-
ERROR_CODE_DRM_SCHEME_UNSUPPORTED
public static final int ERROR_CODE_DRM_SCHEME_UNSUPPORTED
Caused by a chosen DRM protection scheme not being supported by the device. Examples of DRM protection schemes are ClearKey and Widevine.- See Also:
- Constant Field Values
-
ERROR_CODE_DRM_PROVISIONING_FAILED
public static final int ERROR_CODE_DRM_PROVISIONING_FAILED
Caused by a failure while provisioning the device.- See Also:
- Constant Field Values
-
ERROR_CODE_DRM_CONTENT_ERROR
public static final int ERROR_CODE_DRM_CONTENT_ERROR
Caused by attempting to play incompatible DRM-protected content.For example, this can happen when attempting to play a DRM protected stream using a scheme (like Widevine) for which there is no corresponding license acquisition data (like a pssh box).
- See Also:
- Constant Field Values
-
ERROR_CODE_DRM_LICENSE_ACQUISITION_FAILED
public static final int ERROR_CODE_DRM_LICENSE_ACQUISITION_FAILED
Caused by a failure while trying to obtain a license.- See Also:
- Constant Field Values
-
ERROR_CODE_DRM_DISALLOWED_OPERATION
public static final int ERROR_CODE_DRM_DISALLOWED_OPERATION
Caused by an operation being disallowed by a license policy.- See Also:
- Constant Field Values
-
ERROR_CODE_DRM_SYSTEM_ERROR
public static final int ERROR_CODE_DRM_SYSTEM_ERROR
Caused by an error in the DRM system.- See Also:
- Constant Field Values
-
ERROR_CODE_DRM_DEVICE_REVOKED
public static final int ERROR_CODE_DRM_DEVICE_REVOKED
Caused by the device having revoked DRM privileges.- See Also:
- Constant Field Values
-
ERROR_CODE_DRM_LICENSE_EXPIRED
public static final int ERROR_CODE_DRM_LICENSE_EXPIRED
Caused by an expired DRM license being loaded into an open DRM session.- See Also:
- Constant Field Values
-
CUSTOM_ERROR_CODE_BASE
public static final int CUSTOM_ERROR_CODE_BASE
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.- See Also:
- Constant Field Values
-
errorCode
@ErrorCode public final @com.google.android.exoplayer2.PlaybackException.ErrorCode int errorCode
An error code which identifies the cause of the playback failure.
-
timestampMs
public final long timestampMs
The value ofSystemClock.elapsedRealtime()
when this exception was created.
-
FIELD_CUSTOM_ID_BASE
protected static final int FIELD_CUSTOM_ID_BASE
Defines a minimum field id value for subclasses to use when implementingtoBundle()
andBundleable.Creator
.Subclasses should obtain their
Bundle's
field keys by applying a non-negative offset on this constant and passing the result tokeyForField(int)
.- See Also:
- Constant Field Values
-
CREATOR
public static final Bundleable.Creator<PlaybackException> CREATOR
Object that can create aPlaybackException
from aBundle
.
-
-
Constructor Detail
-
PlaybackException
public PlaybackException(@Nullable String message, @Nullable Throwable cause, @ErrorCode @com.google.android.exoplayer2.PlaybackException.ErrorCode int errorCode)
Creates an instance.- Parameters:
errorCode
- A number which identifies the cause of the error. May be one of theErrorCodes
.cause
- SeeThrowable.getCause()
.message
- SeeThrowable.getMessage()
.
-
PlaybackException
protected PlaybackException(Bundle bundle)
Creates a new instance using the fields obtained from the givenBundle
.
-
PlaybackException
protected PlaybackException(@Nullable String message, @Nullable Throwable cause, @ErrorCode @com.google.android.exoplayer2.PlaybackException.ErrorCode int errorCode, long timestampMs)
Creates a new instance using the given values.
-
-
Method Detail
-
getErrorCodeName
public static String getErrorCodeName(@ErrorCode @com.google.android.exoplayer2.PlaybackException.ErrorCode int errorCode)
Returns the name of a givenerrorCode
.
-
getErrorCodeName
public final String getErrorCodeName()
Equivalent toPlaybackException.getErrorCodeName(this.errorCode)
.
-
errorInfoEquals
@CallSuper public boolean errorInfoEquals(@Nullable PlaybackException other)
Returns whether the error data associated to this exception equals the error data associated toother
.Note that this method does not compare the exceptions' stacktraces.
-
toBundle
@CallSuper public Bundle toBundle()
Description copied from interface:Bundleable
Returns aBundle
representing the information stored in this object.- Specified by:
toBundle
in interfaceBundleable
-
keyForField
protected static String keyForField(@FieldNumber int field)
Converts the givenPlaybackException.FieldNumber
to a string which can be used as a field key when implementingtoBundle()
andBundleable.Creator
.
-
-