PlaybackException


class PlaybackException : Exception

Known direct subclasses
ExoPlaybackException

Thrown when a non locally recoverable playback failure occurs.


Thrown when a non locally recoverable playback failure occurs.

Summary

Nested types

@Documented
@Retention(value = RetentionPolicy.SOURCE)
@Target(value = )
@IntDef(open = true, value = )
annotation PlaybackException.ErrorCode

Codes that identify causes of player errors.

Constants

const 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.

const Int

Caused by an AudioTrack initialization failure.

const Int

Caused by an AudioTrack init operation failure in offload mode.

const Int

Caused by an AudioTrack write operation failure in offload mode.

const Int

Caused by an AudioTrack write operation failure.

const Int

Caused by expired authentication.

const Int

Caused by an argument that is illegal.

const Int

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

const Int

Caused by too many concurrent streams.

const Int

Caused by a request for content that was already playing.

const Int

Caused by a decoder initialization failure.

const Int

Caused by a decoder query failure.

const Int

Caused by a failure while trying to decode media samples.

const Int

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

const Int

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

const Int

Caused by higher priority task reclaiming resources needed for decoding.

const Int

Caused by a disconnected component.

const Int

Caused by attempting to play incompatible DRM-protected content.

const Int

Caused by the device having revoked DRM privileges.

const Int

Caused by an operation being disallowed by a license policy.

const Int

Caused by a failure while trying to obtain a license.

const Int

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

const Int

Caused by a failure while provisioning the device.

const Int

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

const Int

Caused by an error in the DRM system.

const Int

Caused by an unspecified error related to DRM protection.

const Int

Caused by navigation that failed because the playlist was exhausted.

const Int

Caused by a failed runtime check.

const Int

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

const Int

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

const 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.

const Int

Caused by a non-existent file.

const Int

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

const Int

Caused by a network connection failure.

const Int

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

const Int

Caused by lack of permission to perform an IO operation.

const Int

Caused by reading data out of the data bound.

const Int

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

const Int

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

const Int

Caused by a command that is not supported.

const Int

Caused by the content being blocked due to parental controls.

const Int

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

const Int

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

const Int

Caused by a parsing error associated with a media manifest.

const Int

Caused by an unsupported feature in a media manifest.

const Int

Caused by a command that is not allowed.

const Int

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

const Int

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

const Int

Caused by playback that needs manual user intervention.

const Int

Caused by the skip limit that is exhausted.

const Int

Caused by a generic timeout.

const Int

Caused by an error whose cause could not be identified.

const Int

Caused by a failure when processing a video frame.

const Int

Caused by a failure when initializing a VideoFrameProcessor.

const Int

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

Public constructors

@UnstableApi
PlaybackException(
    message: String?,
    cause: Throwable?,
    @PlaybackException.ErrorCode errorCode: Int
)

Creates an instance.

@UnstableApi
PlaybackException(
    message: String?,
    cause: Throwable?,
    @PlaybackException.ErrorCode errorCode: Int,
    extras: Bundle!
)

Creates an instance.

Protected constructors

Creates a new instance using the fields obtained from the given Bundle.

@UnstableApi
PlaybackException(
    message: String?,
    cause: Throwable?,
    @PlaybackException.ErrorCode errorCode: Int,
    extras: Bundle!,
    timestampMs: Long
)

Creates a new instance using the given values.

Public functions

Boolean

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

java-static PlaybackException!

Restores a PlaybackException from a Bundle.

String!

Equivalent to PlaybackException.getErrorCodeName(this.errorCode).

java-static String!

Returns the name of a given errorCode.

Bundle!

Returns a Bundle representing the information stored in this exception.

Public properties

Int

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

Bundle!

An extras Bundle.

Long

The value of elapsedRealtime when this exception was created.

Constants

CUSTOM_ERROR_CODE_BASE

const val CUSTOM_ERROR_CODE_BASE = 1000000: 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.

ERROR_CODE_AUDIO_TRACK_INIT_FAILED

const val ERROR_CODE_AUDIO_TRACK_INIT_FAILED = 5001: Int

Caused by an AudioTrack initialization failure.

ERROR_CODE_AUDIO_TRACK_OFFLOAD_INIT_FAILED

const val ERROR_CODE_AUDIO_TRACK_OFFLOAD_INIT_FAILED = 5004: Int

Caused by an AudioTrack init operation failure in offload mode.

ERROR_CODE_AUDIO_TRACK_OFFLOAD_WRITE_FAILED

const val ERROR_CODE_AUDIO_TRACK_OFFLOAD_WRITE_FAILED = 5003: Int

Caused by an AudioTrack write operation failure in offload mode.

ERROR_CODE_AUDIO_TRACK_WRITE_FAILED

const val ERROR_CODE_AUDIO_TRACK_WRITE_FAILED = 5002: Int

Caused by an AudioTrack write operation failure.

ERROR_CODE_AUTHENTICATION_EXPIRED

const val ERROR_CODE_AUTHENTICATION_EXPIRED = -102: Int

Caused by expired authentication.

ERROR_CODE_BAD_VALUE

const val ERROR_CODE_BAD_VALUE = -3: Int

Caused by an argument that is illegal.

ERROR_CODE_BEHIND_LIVE_WINDOW

const val ERROR_CODE_BEHIND_LIVE_WINDOW = 1002: Int

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

ERROR_CODE_CONCURRENT_STREAM_LIMIT

const val ERROR_CODE_CONCURRENT_STREAM_LIMIT = -104: Int

Caused by too many concurrent streams.

ERROR_CODE_CONTENT_ALREADY_PLAYING

const val ERROR_CODE_CONTENT_ALREADY_PLAYING = -110: Int

Caused by a request for content that was already playing.

ERROR_CODE_DECODER_INIT_FAILED

const val ERROR_CODE_DECODER_INIT_FAILED = 4001: Int

Caused by a decoder initialization failure.

ERROR_CODE_DECODER_QUERY_FAILED

const val ERROR_CODE_DECODER_QUERY_FAILED = 4002: Int

Caused by a decoder query failure.

ERROR_CODE_DECODING_FAILED

const val ERROR_CODE_DECODING_FAILED = 4003: Int

Caused by a failure while trying to decode media samples.

ERROR_CODE_DECODING_FORMAT_EXCEEDS_CAPABILITIES

const val ERROR_CODE_DECODING_FORMAT_EXCEEDS_CAPABILITIES = 4004: Int

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

ERROR_CODE_DECODING_FORMAT_UNSUPPORTED

const val ERROR_CODE_DECODING_FORMAT_UNSUPPORTED = 4005: Int

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

ERROR_CODE_DECODING_RESOURCES_RECLAIMED

@UnstableApi
const val ERROR_CODE_DECODING_RESOURCES_RECLAIMED = 4006: Int

Caused by higher priority task reclaiming resources needed for decoding.

ERROR_CODE_DISCONNECTED

const val ERROR_CODE_DISCONNECTED = -100: Int

Caused by a disconnected component.

ERROR_CODE_DRM_CONTENT_ERROR

const val ERROR_CODE_DRM_CONTENT_ERROR = 6003: Int

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).

ERROR_CODE_DRM_DEVICE_REVOKED

const val ERROR_CODE_DRM_DEVICE_REVOKED = 6007: Int

Caused by the device having revoked DRM privileges.

ERROR_CODE_DRM_DISALLOWED_OPERATION

const val ERROR_CODE_DRM_DISALLOWED_OPERATION = 6005: Int

Caused by an operation being disallowed by a license policy.

ERROR_CODE_DRM_LICENSE_ACQUISITION_FAILED

const val ERROR_CODE_DRM_LICENSE_ACQUISITION_FAILED = 6004: Int

Caused by a failure while trying to obtain a license.

ERROR_CODE_DRM_LICENSE_EXPIRED

const val ERROR_CODE_DRM_LICENSE_EXPIRED = 6008: Int

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

ERROR_CODE_DRM_PROVISIONING_FAILED

const val ERROR_CODE_DRM_PROVISIONING_FAILED = 6002: Int

Caused by a failure while provisioning the device.

ERROR_CODE_DRM_SCHEME_UNSUPPORTED

const val ERROR_CODE_DRM_SCHEME_UNSUPPORTED = 6001: Int

Caused by a chosen DRM protection scheme not being supported by the device. Examples of DRM protection schemes are ClearKey and Widevine.

ERROR_CODE_DRM_SYSTEM_ERROR

const val ERROR_CODE_DRM_SYSTEM_ERROR = 6006: Int

Caused by an error in the DRM system.

ERROR_CODE_DRM_UNSPECIFIED

const val ERROR_CODE_DRM_UNSPECIFIED = 6000: Int

Caused by an unspecified error related to DRM protection.

ERROR_CODE_END_OF_PLAYLIST

const val ERROR_CODE_END_OF_PLAYLIST = -109: Int

Caused by navigation that failed because the playlist was exhausted.

ERROR_CODE_FAILED_RUNTIME_CHECK

const val ERROR_CODE_FAILED_RUNTIME_CHECK = 1004: Int

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.

ERROR_CODE_INVALID_STATE

const val ERROR_CODE_INVALID_STATE = -2: Int

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

ERROR_CODE_IO_BAD_HTTP_STATUS

const val ERROR_CODE_IO_BAD_HTTP_STATUS = 2004: Int

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

ERROR_CODE_IO_CLEARTEXT_NOT_PERMITTED

const val ERROR_CODE_IO_CLEARTEXT_NOT_PERMITTED = 2007: 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.

See this corresponding troubleshooting topic.

ERROR_CODE_IO_FILE_NOT_FOUND

const val ERROR_CODE_IO_FILE_NOT_FOUND = 2005: Int

Caused by a non-existent file.

ERROR_CODE_IO_INVALID_HTTP_CONTENT_TYPE

const val ERROR_CODE_IO_INVALID_HTTP_CONTENT_TYPE = 2003: Int

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".

ERROR_CODE_IO_NETWORK_CONNECTION_FAILED

const val ERROR_CODE_IO_NETWORK_CONNECTION_FAILED = 2001: Int

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 getActiveNetwork).
  • The URL's domain is misspelled or does not exist.
  • The target host is unreachable.
  • The server unexpectedly closes the connection.

ERROR_CODE_IO_NETWORK_CONNECTION_TIMEOUT

const val ERROR_CODE_IO_NETWORK_CONNECTION_TIMEOUT = 2002: Int

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

ERROR_CODE_IO_NO_PERMISSION

const val ERROR_CODE_IO_NO_PERMISSION = 2006: Int

Caused by lack of permission to perform an IO operation. For example, lack of permission to access internet or external storage.

ERROR_CODE_IO_READ_POSITION_OUT_OF_RANGE

const val ERROR_CODE_IO_READ_POSITION_OUT_OF_RANGE = 2008: Int

Caused by reading data out of the data bound.

ERROR_CODE_IO_UNSPECIFIED

const val ERROR_CODE_IO_UNSPECIFIED = 2000: Int

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

ERROR_CODE_NOT_AVAILABLE_IN_REGION

const val ERROR_CODE_NOT_AVAILABLE_IN_REGION = -106: Int

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

ERROR_CODE_NOT_SUPPORTED

const val ERROR_CODE_NOT_SUPPORTED = -6: Int

Caused by a command that is not supported.

ERROR_CODE_PARENTAL_CONTROL_RESTRICTED

const val ERROR_CODE_PARENTAL_CONTROL_RESTRICTED = -105: Int

Caused by the content being blocked due to parental controls.

ERROR_CODE_PARSING_CONTAINER_MALFORMED

const val ERROR_CODE_PARSING_CONTAINER_MALFORMED = 3001: Int

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

ERROR_CODE_PARSING_CONTAINER_UNSUPPORTED

const val ERROR_CODE_PARSING_CONTAINER_UNSUPPORTED = 3003: Int

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

ERROR_CODE_PARSING_MANIFEST_MALFORMED

const val ERROR_CODE_PARSING_MANIFEST_MALFORMED = 3002: Int

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.

ERROR_CODE_PARSING_MANIFEST_UNSUPPORTED

const val ERROR_CODE_PARSING_MANIFEST_UNSUPPORTED = 3004: Int

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.

ERROR_CODE_PERMISSION_DENIED

const val ERROR_CODE_PERMISSION_DENIED = -4: Int

Caused by a command that is not allowed.

ERROR_CODE_PREMIUM_ACCOUNT_REQUIRED

const val ERROR_CODE_PREMIUM_ACCOUNT_REQUIRED = -103: Int

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

ERROR_CODE_REMOTE_ERROR

const val ERROR_CODE_REMOTE_ERROR = 1001: Int

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

ERROR_CODE_SETUP_REQUIRED

const val ERROR_CODE_SETUP_REQUIRED = -108: Int

Caused by playback that needs manual user intervention.

ERROR_CODE_SKIP_LIMIT_REACHED

const val ERROR_CODE_SKIP_LIMIT_REACHED = -107: Int

Caused by the skip limit that is exhausted.

ERROR_CODE_TIMEOUT

const val ERROR_CODE_TIMEOUT = 1003: Int

Caused by a generic timeout.

ERROR_CODE_UNSPECIFIED

const val ERROR_CODE_UNSPECIFIED = 1000: Int

Caused by an error whose cause could not be identified.

ERROR_CODE_VIDEO_FRAME_PROCESSING_FAILED

@UnstableApi
const val ERROR_CODE_VIDEO_FRAME_PROCESSING_FAILED = 7001: Int

Caused by a failure when processing a video frame.

ERROR_CODE_VIDEO_FRAME_PROCESSOR_INIT_FAILED

@UnstableApi
const val ERROR_CODE_VIDEO_FRAME_PROCESSOR_INIT_FAILED = 7000: Int

Caused by a failure when initializing a VideoFrameProcessor.

FIELD_CUSTOM_ID_BASE

@UnstableApi
protected const val FIELD_CUSTOM_ID_BASE = 1000: Int

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

Subclasses should obtain their Bundle's field keys by applying a non-negative offset on this constant and passing the result to intToStringMaxRadix.

Public constructors

PlaybackException

@UnstableApi
PlaybackException(
    message: String?,
    cause: Throwable?,
    @PlaybackException.ErrorCode errorCode: Int
)

Creates an instance.

Parameters
message: String?

See getMessage.

cause: Throwable?

See getCause.

@PlaybackException.ErrorCode errorCode: Int

A number which identifies the cause of the error. May be one of the ErrorCodes.

PlaybackException

@UnstableApi
PlaybackException(
    message: String?,
    cause: Throwable?,
    @PlaybackException.ErrorCode errorCode: Int,
    extras: Bundle!
)

Creates an instance.

Parameters
message: String?

See getMessage.

cause: Throwable?

See getCause.

@PlaybackException.ErrorCode errorCode: Int

A number which identifies the cause of the error. May be one of the ErrorCodes.

extras: Bundle!

An optional Bundle.

Protected constructors

PlaybackException

@UnstableApi
protected PlaybackException(bundle: Bundle!)

Creates a new instance using the fields obtained from the given Bundle.

PlaybackException

@UnstableApi
protected PlaybackException(
    message: String?,
    cause: Throwable?,
    @PlaybackException.ErrorCode errorCode: Int,
    extras: Bundle!,
    timestampMs: Long
)

Creates a new instance using the given values.

Public functions

errorInfoEquals

@CallSuper
fun errorInfoEquals(other: PlaybackException?): Boolean

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
java-static fun fromBundle(bundle: Bundle!): PlaybackException!

Restores a PlaybackException from a Bundle.

getErrorCodeName

java-static fun getErrorCodeName(@PlaybackException.ErrorCode errorCode: Int): String!

Returns the name of a given errorCode.

toBundle

@UnstableApi
@CallSuper
fun toBundle(): Bundle!

Returns a Bundle representing the information stored in this exception.

Public properties

errorCode

@PlaybackException.ErrorCode
val errorCodeInt

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

extras

@UnstableApi
val extrasBundle!

An extras Bundle.

timestampMs

val timestampMsLong

The value of elapsedRealtime when this exception was created.