Class DownloadException
java.lang.Object
java.lang.Throwable
java.lang.Exception
java.io.IOException
com.castlabs.android.player.exceptions.DownloadException
- All Implemented Interfaces:
Serializable
Exception that is raised when media download errors occur. You can
use
getTrackType()
to identify the track that caused the error.- Since:
- 3.0.0
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionstatic DownloadException
Creates a new DownloadException with the specified track type and cause.static DownloadException
Creates a new DownloadException from a Throwable, automatically determining the track type if possible from the cause.byte[]
Gets the response body from the failed request.int
Gets the HTTP status code from the failed request.int
Gets the type of track that caused the download error.getUri()
The underlying URI that caused the error.Methods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
Method Details
-
create
Creates a new DownloadException from a Throwable, automatically determining the track type if possible from the cause.- Parameters:
cause
- The underlying exception that caused the download error- Returns:
- A new DownloadException instance
-
create
Creates a new DownloadException with the specified track type and cause.- Parameters:
trackType
- The type of track that caused the errorcause
- The underlying exception that caused the download error- Returns:
- A new DownloadException instance
-
getUri
The underlying URI that caused the error. This might be null.- Returns:
- The URI or null
-
getStatusCode
public int getStatusCode()Gets the HTTP status code from the failed request.- Returns:
- The response status code or -1 if not applicable
-
getResponseBody
@Nullable public byte[] getResponseBody()Gets the response body from the failed request.- Returns:
- The response body, or null if not available
-
getTrackType
public int getTrackType()Gets the type of track that caused the download error.- Returns:
- The type of the track that caused the error. One of
PlayerController.VIDEO_RENDERER
,PlayerController.AUDIO_RENDERER
,PlayerController.TEXT_RENDERER
orPlayerController.METADATA_RENDERER
-
getMessage
- Overrides:
getMessage
in classThrowable
-