Class CastlabsPlayerException
java.lang.Object
java.lang.Throwable
java.lang.Exception
com.castlabs.android.player.exceptions.CastlabsPlayerException
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
FilterException
Exception that represents a player error and wraps the cause and an optional
error code. This class provides detailed information about playback errors,
including severity levels, error types, and additional error data.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic @interfaceDefines the severity of an error.static @interfaceDefines the type of an error. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringError code associated with the errorstatic final StringHTTP response code associated with the errorstatic final StringMessage reported by exceptions of typeTYPE_MANIFEST_LOADING_FAILEDstatic final StringMessage reported by exceptions of typeTYPE_VIDEO_DECODER_INITIALIZATIONstatic final StringResponse body associated with the errorstatic final StringSeverity level of the errorstatic final intError severity.static final intInfo severity.static final intWarning severity.static final StringThe value of the key is the track type, one ofPlayerController.VIDEO_RENDERER,PlayerController.AUDIO_RENDERER,PlayerController.TEXT_RENDERERorPlayerController.METADATA_RENDERERstatic final intThis error is raised when a general error occurs at initializing or during an Ad.static final intError raised when trying to play Ads but the current Player setup doesn't support it.static final intThis error is raised if a method is called that is not supported on the current API level.static final intError raised when the audio decoder can not be initialized.static final intRaised when an error occurs while decrypting audio data.static final intError raised when the track can not be initialized.static final intThis error is raised if all audio tracks are filtered out as unsupported.static final intRaised when an error occurs while writing to the audio track.static final intError raised when the current playback position is behind the live edge in a live stream.static final intThis exception is raised after the player lost connectivity (TYPE_CONNECTIVITY_LOST_ERROR), once connectivity was re-gained.static final intThis error is raised if an exception occurred while downloading playback and no network connectivity is available.static final intError raised when concurrent stream limiting reaches maximum clientsstatic final intError raised when there's a network error with the concurrent stream limiting servicestatic final intThis error is raised if an exception occurred while downloading data.static final intThis error is raised when a DNS server error occurs.static final intThis error is raised if an exception occurred while downloading playback data.static final intThis error is raised if an exception occurred while the player was communicating with DRM server to fetch a license.static final intThis error is raised if a DRM key could not be fetched successfully.static final intError raised during device provisioningstatic final intThis error is raised if an exception occurred while the player was communicating with DRMToday to fetch a license.static final intThis exception is raised after the player sees changes in HDCP connectivity.static final intError raised when the castLabs player license is invalid or expired.static final intThis error is raised if a DRM key expires during playback.static final intThis error happens when the player found a semantic issue with a Manifest.static final intThis error type is raised when loading the player manifest (i.e.static final intThis error type is raised when parsing the player manifest (i.e.static final intError raised when the applied filters were not able to find any viable content that can be displayed on the current device.static final intError raised when no plugin was found that can be used to create a renderer to playback a given DRM and content combination.static final intError raised when the ExoPlayer reports a general playback error.static final intError raised when the SDK could not be initialised successfully.static final intError raised when the SDK was not initialized using one ofPlayerSDK.init(Context)orPlayerSDK.init(Context, LicenseLoader).static final intThis error is raised if a secondary display is detected and the current configuration does not permit playback on that display.static final intThis error is raised if all text tracks are filtered out as unsupported.static final intThis error is raised when a timeout error occurs.static final intThis error happens when tunneling mode can not be enabled on a device and the playback in non-tunneling mode continues.static final intError raised with an unknown typestatic final intThis error is raised if you are trying to use a DRM system that is not supported by the device.static final intError raised when the userID is mandatory and has not been provided.static final intThis error is raised when video quality blocklisting fails as the current quality is the only video quality left for playback.static final intRaised when the video decoder can not be initialized.static final intRaised when an error occurs while decrypting audio data.static final intThis error is raised if all video tracks are filtered out as unsupported.static final StringURL associated with the error -
Constructor Summary
ConstructorsConstructorDescriptionCastlabsPlayerException(int severity, int type, String message) Creates a new CastlabsPlayerException with the specified severity, type, and message.CastlabsPlayerException(int severity, int type, String message, Throwable cause) Creates a new CastlabsPlayerException with the specified severity, type, message, and cause.CastlabsPlayerException(int severity, int type, String message, Throwable cause, String explicitCauseMessage) Creates a new CastlabsPlayerException with the specified severity, type, message, cause, and explicit cause message. -
Method Summary
Modifier and TypeMethodDescriptionstatic CastlabsPlayerExceptioncreateError(int severity, String message, com.google.android.exoplayer2.upstream.HttpDataSource.HttpDataSourceException e) Creates an error exception for an HTTP data source error.static CastlabsPlayerExceptioncreateError(int severity, String message, com.google.android.exoplayer2.upstream.HttpDataSource.InvalidResponseCodeException e) Creates an error exception for an invalid HTTP response code.static CastlabsPlayerExceptioncreateFatal(DownloadException downloadException) Creates a fatal exception for a download error.static CastlabsPlayerExceptioncreateFatal(com.google.android.exoplayer2.source.dash.DashPeriodNotFoundException exception) Creates a fatal exception for a DASH period not found error.static CastlabsPlayerExceptioncreateFatal(com.google.android.exoplayer2.upstream.HttpDataSource.HttpDataSourceException exception, int type) Creates a fatal exception for an HTTP data source error.Returns the cause message of this exception.Returns aBundlewith error-specific error data.getInteger(String key) Returns the value for the given key out of theerrorDataMap.intReturns the severity of this issue.Returns the value for the given key out of theerrorDataMap.intgetType()Returns the type of this error.voidlog()Logs this exception using its severity to choose the log leveltoString()static StringtypeString(int type) Translates an error type to a human readable stringMethods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace
-
Field Details
-
SEVERITY_INFO
public static final int SEVERITY_INFOInfo severity.- See Also:
-
SEVERITY_WARNING
public static final int SEVERITY_WARNINGWarning severity.- See Also:
-
SEVERITY_ERROR
public static final int SEVERITY_ERRORError severity.- See Also:
-
TYPE_UNKNOWN
public static final int TYPE_UNKNOWNError raised with an unknown type- See Also:
-
TYPE_AUDIO_TRACK_INITIALIZATION
public static final int TYPE_AUDIO_TRACK_INITIALIZATIONError raised when the track can not be initialized. The cause of this error is aAudioSink.InitializationExceptionthat contains the audio track state reported byAudioTrack.getState(). This is reported asSEVERITY_ERRORsince this means that no audio playback will be possible.- See Also:
-
TYPE_AUDIO_DECODER_INITIALIZATION
public static final int TYPE_AUDIO_DECODER_INITIALIZATIONError raised when the audio decoder can not be initialized. The cause of this error is aMediaCodecRenderer.DecoderInitializationException. This is reported asSEVERITY_ERRORsince this means that no audio playback will be possible.- See Also:
-
TYPE_AUDIO_WRITE_ERROR
public static final int TYPE_AUDIO_WRITE_ERRORRaised when an error occurs while writing to the audio track. The cause of this error is aAudioSink.WriteExceptionthat exposes theAudioSink.WriteException.errorCodethat is returned fromAudioTrack.write(byte[], int, int)This is reported asSEVERITY_WARNINGsince it might be possible that audio playback will recover.- See Also:
-
TYPE_AUDIO_DECRYPTION_ERROR
public static final int TYPE_AUDIO_DECRYPTION_ERRORRaised when an error occurs while decrypting audio data. The cause of this error is aMediaCodec.CryptoExceptionthat exposes an error code usingMediaCodec.CryptoException.getErrorCode(). The error code reported by the cause is one ofMediaCodec.CryptoException.ERROR_NO_KEY,MediaCodec.CryptoException.ERROR_INSUFFICIENT_OUTPUT_PROTECTION,MediaCodec.CryptoException.ERROR_KEY_EXPIRED,MediaCodec.CryptoException.ERROR_RESOURCE_BUSY, orMediaCodec.CryptoException.ERROR_SESSION_NOT_OPENEDThis is reported asSEVERITY_ERROR.- See Also:
-
TYPE_VIDEO_DECODER_INITIALIZATION
public static final int TYPE_VIDEO_DECODER_INITIALIZATIONRaised when the video decoder can not be initialized. The cause of this error is aMediaCodecRenderer.DecoderInitializationException. This is reported asSEVERITY_ERRORsince this means that no video playback will be possible.- See Also:
-
TYPE_VIDEO_DECRYPTION_ERROR
public static final int TYPE_VIDEO_DECRYPTION_ERRORRaised when an error occurs while decrypting audio data. The cause of this error is aMediaCodec.CryptoExceptionthat exposes an error code usingMediaCodec.CryptoException.getErrorCode(). The error code reported by the cause is one ofMediaCodec.CryptoException.ERROR_NO_KEY,MediaCodec.CryptoException.ERROR_INSUFFICIENT_OUTPUT_PROTECTION,MediaCodec.CryptoException.ERROR_KEY_EXPIRED,MediaCodec.CryptoException.ERROR_RESOURCE_BUSY, orMediaCodec.CryptoException.ERROR_SESSION_NOT_OPENEDThis is reported asSEVERITY_ERROR.- See Also:
-
TYPE_MANIFEST_LOADING_FAILED
public static final int TYPE_MANIFEST_LOADING_FAILEDThis error type is raised when loading the player manifest (i.e. the DASH mpd, or the HLS playlist) failed. The cause of this error is anIOException. This is reported asSEVERITY_ERROR.- See Also:
-
TYPE_SDK_INIT_ERROR
public static final int TYPE_SDK_INIT_ERRORError raised when the SDK could not be initialised successfully. The cause of the error is aThrowable. This is reported asSEVERITY_ERROR.- See Also:
-
TYPE_NO_RENDERER_FOUND
public static final int TYPE_NO_RENDERER_FOUNDError raised when no plugin was found that can be used to create a renderer to playback a given DRM and content combination. An error of this type will be raised for example if you are trying to playback a DASH stream using OMA-DRM but the OMA-Plugin was not loaded. It is possible also that this Exception is thrown if a Renderer has been temporarily disabled. A few use cases, such as performing background playback ,can disable a number of Renderers. This error has no cause attached to it. This is reported asSEVERITY_WARNING.- See Also:
-
TYPE_NO_PLAYABLE_CONTENT
public static final int TYPE_NO_PLAYABLE_CONTENTError raised when the applied filters were not able to find any viable content that can be displayed on the current device. This can happen for example when you are trying to playback 4K video on a device that does not support it and 4K is the only representation found in the Manifest. This is reported asSEVERITY_ERROR.- See Also:
-
TYPE_PLAYBACK_ERROR
public static final int TYPE_PLAYBACK_ERRORError raised when the ExoPlayer reports a general playback error. The cause of this error is aExoPlaybackException. This is reported asSEVERITY_ERROR.- See Also:
-
TYPE_API_MISMATCH
public static final int TYPE_API_MISMATCHThis error is raised if a method is called that is not supported on the current API level. This will for example be triggered if you try to use Widevine DRM on devices that do not support it. This is reported asSEVERITY_ERROR.- See Also:
-
TYPE_UNSUPPORTED_DRM
public static final int TYPE_UNSUPPORTED_DRMThis error is raised if you are trying to use a DRM system that is not supported by the device. The cause if this error is aUnsupportedDrmException. This is reported asSEVERITY_ERROR.- See Also:
-
TYPE_SDK_NOT_INITIALIZED
public static final int TYPE_SDK_NOT_INITIALIZEDError raised when the SDK was not initialized using one ofPlayerSDK.init(Context)orPlayerSDK.init(Context, LicenseLoader). This is reported asSEVERITY_ERROR.- See Also:
-
TYPE_DRMTODAY_EXCEPTION
public static final int TYPE_DRMTODAY_EXCEPTIONThis error is raised if an exception occurred while the player was communicating with DRMToday to fetch a license. The cause of this error is aDrmTodayException. Note that this error usually occurs during license acquisition and before any decryption errors are reported by the decoder. This is reported asSEVERITY_ERROR.- See Also:
-
TYPE_DOWNLOAD_ERROR
public static final int TYPE_DOWNLOAD_ERRORThis error is raised if an exception occurred while downloading playback data. The cause of this error is aDownloadExceptionthat you can use to identify the root cause and the id of the track that caused the error. This is reported asSEVERITY_WARNINGsince it depends on where and when this exception is raised.- See Also:
-
TYPE_SECONDARY_DISPLAY
public static final int TYPE_SECONDARY_DISPLAYThis error is raised if a secondary display is detected and the current configuration does not permit playback on that display. This is reported asSEVERITY_ERROR.- See Also:
-
TYPE_KEY_EXPIRED
public static final int TYPE_KEY_EXPIREDThis error is raised if a DRM key expires during playback. This is reported asSEVERITY_ERROR.- See Also:
-
TYPE_DRM_KEY_DOWNLOAD_ERROR
public static final int TYPE_DRM_KEY_DOWNLOAD_ERRORThis error is raised if a DRM key could not be fetched successfully. This is usually caused when offline lincenses are loaded. This is reported asSEVERITY_ERROR.- See Also:
-
TYPE_CONNECTIVITY_LOST_ERROR
public static final int TYPE_CONNECTIVITY_LOST_ERRORThis error is raised if an exception occurred while downloading playback and no network connectivity is available. This is reported asSEVERITY_WARNINGand the player will automatically try to recover once connectivity is re-gained. This can be treated as in informative warning.- See Also:
-
TYPE_CONNECTIVITY_GAINED_INFO
public static final int TYPE_CONNECTIVITY_GAINED_INFOThis exception is raised after the player lost connectivity (TYPE_CONNECTIVITY_LOST_ERROR), once connectivity was re-gained. This is reported asSEVERITY_INFOand can be treated as in informative message.- See Also:
-
TYPE_BEHIND_LIVE_WINDOW
public static final int TYPE_BEHIND_LIVE_WINDOWError raised when the current playback position is behind the live edge in a live stream. The cause of this error is aBehindLiveWindowException. When this error is raised, the player is in a fatal state and you will need to restart/reopen the stream to continue playback at the live edge. Typically, this error is caused by loss of connectivity where the player is not able to keep updating the manifests to stay at the live edge or within the live window. This is reported asSEVERITY_ERROR.- See Also:
-
TYPE_INVALID_PLAYER_LICENSE
public static final int TYPE_INVALID_PLAYER_LICENSEError raised when the castLabs player license is invalid or expired. Please contact support if you see this error unexpectedly. Note that if this error occurs, playback is prevented and the player will stop working. This is reported asSEVERITY_ERROR.- See Also:
-
TYPE_DATA_DOWLOAD_ERROR
public static final int TYPE_DATA_DOWLOAD_ERRORThis error is raised if an exception occurred while downloading data. The cause can be used to identify the root cause. In contrast toTYPE_DOWNLOAD_ERRORthis type is raised for any download issues around non track specific data. This is reported asSEVERITY_WARNINGsince it depends on where and when this exception is raised. This type might contain theURLkey in theerrorDatabundle.- See Also:
-
TYPE_DRM_EXCEPTION
public static final int TYPE_DRM_EXCEPTIONThis error is raised if an exception occurred while the player was communicating with DRM server to fetch a license. The cause of this error is aDrmSession.DrmSessionException. Note that this error usually occurs during license acquisition and before any decryption errors are reported by the decoder. This is reported asSEVERITY_ERROR.- See Also:
-
TYPE_AUDIO_UNSUPPORTED
public static final int TYPE_AUDIO_UNSUPPORTEDThis error is raised if all audio tracks are filtered out as unsupported. It is reported asSEVERITY_WARNING- See Also:
-
TYPE_VIDEO_UNSUPPORTED
public static final int TYPE_VIDEO_UNSUPPORTEDThis error is raised if all video tracks are filtered out as unsupported. It is reported asSEVERITY_WARNING- See Also:
-
TYPE_TEXT_UNSUPPORTED
public static final int TYPE_TEXT_UNSUPPORTEDThis error is raised if all text tracks are filtered out as unsupported. It is reported asSEVERITY_WARNING- See Also:
-
TYPE_USER_ID_NOT_PROVIDED
public static final int TYPE_USER_ID_NOT_PROVIDEDError raised when the userID is mandatory and has not been provided. This is reported asSEVERITY_ERROR.- See Also:
-
TYPE_MANIFEST_PARSING_FAILED
public static final int TYPE_MANIFEST_PARSING_FAILEDThis error type is raised when parsing the player manifest (i.e. the DASH mpd, or the HLS playlist) failed. The cause of this error is anParserException. This is reported asSEVERITY_ERROR.- See Also:
-
TYPE_AD_REQUEST_UNSUPPORTED
public static final int TYPE_AD_REQUEST_UNSUPPORTEDError raised when trying to play Ads but the current Player setup doesn't support it. This is the case when using aSingleControllerPlaylistand informingPlayerConfig.adRequest. This is reported asSEVERITY_WARNING- See Also:
-
TYPE_DRM_PROVISION_ERROR
public static final int TYPE_DRM_PROVISION_ERRORError raised during device provisioning This is reported asSEVERITY_ERROR.- See Also:
-
TYPE_CSL_LIMIT_REACHED
public static final int TYPE_CSL_LIMIT_REACHEDError raised when concurrent stream limiting reaches maximum clients This is reported asSEVERITY_ERROR.- See Also:
-
TYPE_CSL_NETWORK_ERROR
public static final int TYPE_CSL_NETWORK_ERRORError raised when there's a network error with the concurrent stream limiting service This is reported asSEVERITY_ERROR.- See Also:
-
TYPE_HDCP_CONNECTION_WARNING
public static final int TYPE_HDCP_CONNECTION_WARNINGThis exception is raised after the player sees changes in HDCP connectivity. This is reported asSEVERITY_INFOand can be treated as in informative message.- See Also:
-
TYPE_AD_ERROR
public static final int TYPE_AD_ERRORThis error is raised when a general error occurs at initializing or during an Ad.- See Also:
-
TYPE_DNS_SERVER_ERROR
public static final int TYPE_DNS_SERVER_ERRORThis error is raised when a DNS server error occurs.- See Also:
-
TYPE_TIME_OUT_ERROR
public static final int TYPE_TIME_OUT_ERRORThis error is raised when a timeout error occurs.- See Also:
-
TYPE_MANIFEST_INVALID
public static final int TYPE_MANIFEST_INVALIDThis error happens when the player found a semantic issue with a Manifest. This could be due to a change in between manifest updates deemed as illegal by the corresponding spec.- See Also:
-
TYPE_TUNNELING_ERROR
public static final int TYPE_TUNNELING_ERRORThis error happens when tunneling mode can not be enabled on a device and the playback in non-tunneling mode continues. It is reported asSEVERITY_WARNINGand can be treated as an informative message.- See Also:
-
TYPE_VIDEO_BLOCKLIST_FAILED
public static final int TYPE_VIDEO_BLOCKLIST_FAILEDThis error is raised when video quality blocklisting fails as the current quality is the only video quality left for playback. It is reported asSEVERITY_WARNING- See Also:
-
MSG_MANIFEST_LOADING_FAILED
Message reported by exceptions of typeTYPE_MANIFEST_LOADING_FAILED- See Also:
-
MSG_VIDEO_DECODER_INITIALIZATION
Message reported by exceptions of typeTYPE_VIDEO_DECODER_INITIALIZATION- See Also:
-
HTTP_CODE
HTTP response code associated with the error- See Also:
-
URL
URL associated with the error- See Also:
-
RESPONSE_BODY
Response body associated with the error- See Also:
-
SEVERITY
Severity level of the error- See Also:
-
CODE
Error code associated with the error- See Also:
-
TRACK_TYPE
The value of the key is the track type, one ofPlayerController.VIDEO_RENDERER,PlayerController.AUDIO_RENDERER,PlayerController.TEXT_RENDERERorPlayerController.METADATA_RENDERER- See Also:
-
-
Constructor Details
-
CastlabsPlayerException
Creates a new CastlabsPlayerException with the specified severity, type, and message.- Parameters:
severity- The severity level of the errortype- The type of errormessage- The error message
-
CastlabsPlayerException
public CastlabsPlayerException(int severity, int type, @Nullable String message, @Nullable Throwable cause) Creates a new CastlabsPlayerException with the specified severity, type, message, and cause.- Parameters:
severity- The severity level of the errortype- The type of errormessage- The error messagecause- The cause of the error
-
CastlabsPlayerException
public CastlabsPlayerException(int severity, int type, @Nullable String message, @Nullable Throwable cause, @Nullable String explicitCauseMessage) Creates a new CastlabsPlayerException with the specified severity, type, message, cause, and explicit cause message.- Parameters:
severity- The severity level of the errortype- The type of errormessage- The error messagecause- The cause of the errorexplicitCauseMessage- An explicit message describing the cause
-
-
Method Details
-
getSeverity
public int getSeverity()Returns the severity of this issue.- Returns:
- The severity of this issue. One of
SEVERITY_INFO,SEVERITY_WARNING, orSEVERITY_ERROR
-
getType
public int getType()Returns the type of this error.- Returns:
- the type of this error.
-
getCauseMessage
Returns the cause message of this exception.- Returns:
- message An explicitly set cause message if not
nullor the message of the lowest exception in the cause chain otherwise. May not be used in app UI elements.
-
getErrorData
Returns aBundlewith error-specific error data. This data may be different for each error type.- Returns:
- the Bundle with error data
-
getString
Returns the value for the given key out of theerrorDataMap. Note that this method will convert the requested data into String. Even if originally it was not.- Parameters:
key- the key for which to return the value.- Returns:
- the value, or null if the key does not exist.
-
getInteger
Returns the value for the given key out of theerrorDataMap. Note that this method try to parse the requested data into an Integer. Even if originally it was not.- Parameters:
key- the key for which to return the value.- Returns:
- the value, or null if the key does not exist.
-
createFatal
public static CastlabsPlayerException createFatal(com.google.android.exoplayer2.source.dash.DashPeriodNotFoundException exception) Creates a fatal exception for a DASH period not found error.- Parameters:
exception- The DashPeriodNotFoundException that caused the error- Returns:
- A new CastlabsPlayerException instance
-
createFatal
Creates a fatal exception for a download error.- Parameters:
downloadException- The DownloadException that caused the error- Returns:
- A new CastlabsPlayerException instance
-
createFatal
public static CastlabsPlayerException createFatal(@NonNull com.google.android.exoplayer2.upstream.HttpDataSource.HttpDataSourceException exception, int type) Creates a fatal exception for an HTTP data source error.- Parameters:
exception- The HttpDataSourceException that caused the errortype- The type of error- Returns:
- A new CastlabsPlayerException instance
-
createError
public static CastlabsPlayerException createError(int severity, String message, com.google.android.exoplayer2.upstream.HttpDataSource.InvalidResponseCodeException e) Creates an error exception for an invalid HTTP response code.- Parameters:
severity- The severity level of the errormessage- The error messagee- The InvalidResponseCodeException that caused the error- Returns:
- A new CastlabsPlayerException instance
-
createError
public static CastlabsPlayerException createError(int severity, String message, com.google.android.exoplayer2.upstream.HttpDataSource.HttpDataSourceException e) Creates an error exception for an HTTP data source error.- Parameters:
severity- The severity level of the errormessage- The error messagee- The HttpDataSourceException that caused the error- Returns:
- A new CastlabsPlayerException instance
-
toString
-
log
public void log()Logs this exception using its severity to choose the log level -
typeString
Translates an error type to a human readable string- Parameters:
type- the error type- Returns:
- The string representation of the error type
-