Error Codes
The library follows hexadecimal error system. The least significant 16-bits (Bits 0-15) indicate a Component Error Code and the most significant 16-bits (Bits 16-31) indicate the Categories that the error falls into.
Error Category | Mask | Description |
---|---|---|
Network Error | 0x10000 | Indicates that the error occurrence is network. related |
Server Error | 0x20000 | Indicates a server response failure. |
Thirdparty Error | 0x40000 | Indicates a failure in thirdparty components such as External Player, Thirdparty Libraries etc., |
Reserved | 0x80000 | Reserved for future use. |
Reserved | 0x100000 | Reserved for future use. |
Reserved | 0x200000 | Reserved for future use. |
Playback Error | 0x400000 | Indicates that the error occurrence is during a Playback. |
Download Error | 0x800000 | Indicates that the error occurrence is during a Download. |
- 0x40* - Playback Error most probably due to player itself.
- 0x41* - Playback error due to Network failure.
- 0x42* - Playback error due to Server response failure.
- 0x80* - Download error most probably due to the downloader itself.
- 0x81* - Download error due to Network failure.
- 0x82* - Download error due to Server response failure.
Playback Error Code
Error Code | Hexadecimal value | Component Error Code | Description |
---|---|---|---|
MEDIA_SOURCE_FAILURE | 0x400201 | 0x201 | Indicates that an error has occurred while loading the MediaSource. |
MEDIA_SOURCE_TIMEOUT | 0x400202 | 0x202 | Indicates that Fetching of the Media Source from network timed-out. |
DRM_PROVISIONING_FAILURE | 0x400203 | 0x203 | Indicates that an error has occurred while Provisioning Model Certificates on the specific device. |
DRM_PROVISIONING_TIMEOUT | 0x400204 | 0x204 | Indicates that Fetching of DRM Provisioning Data from Network Timed-Out. |
DRM_LICENSE_FAILURE | 0x400205 | 0x205 | Indicates that an error has occurred while Loading DRM Keys for a particular content either from network (or) persistent storage. |
DRM_LICENSE_TIMEOUT | 0x400206 | 0x206 | Indicates that Fetching of DRM Keys from network timed-out. |
DRM_LICENSE_EXPIRED | 0x400207 | 0x207 | Indicates that Loaded DRM Keys are expired. |
MEDIA_PLAYBACK_FAILURE | 0x400208 | 0x208 | Indicates that rendering of media failed. |
MEDIA_PLAYBACK_STALE | 0x400209 | 0x209 | Indicates Player playback has stalled. |
DRM_KEY_REDUNDANT_REQUEST | 0x40020A | 0x20A | Indicates the prefetch key already requested. |
DRM_KEY_FETCH_INTERRUPTED | 0x40020B | 0x20B | Indicate the license fetcher delegate not set. |
SHARE_PLAY_ACTIVATION_FAILURE | 0x40020C | 0x20C | Indicates SharePlay activation has failed. |
PLAYBACK_NOT_ALLOWED_ON_INSECURE_DEVICE | 0x400211 | 0x211 | Indicates the playback is not allowed due to device security thread. |
PLAYBACK_NOT_SUPPORTED_ON_EXTERNAL_DISPLAY | 0x400212 | 0x212 | Indicates the playback not supported on external display. |
AIRPLAY_RECEIVER_TEMPORARILY_NOT_AVAILABLE | 0x400213 | 0x213 | Indicates airplay receiver temporarily unavailable |
MEDIA_SERVICES_WERE_RESET | 0x400214 | 0x214 | Indicates that a daemon has crashed. |
Downlaod Error Code
Error Code | Hexadecimal value | Component Error Code | Description |
---|---|---|---|
DOWNLOAD_FAILURE | 0x800301 | 0x301 | Indicates that an error has occured while downloading. |
DOWNLOAD_TASK_NOT_FOUND | 0x800302 | 0x302 | Indicates download task does not exists! |
RETRY_FAILURE | 0x800303 | 0x303 | Indicates the creating download task retry has failed. |
DRM_PERSISTENCE_FETCH_NOT_POSSIBLE | 0x800304 | 0x304 | Indicates successive key fetch within same session not possible due to limitations with ContentKeySession. |
DOWNLOAD_TASK_METADATA_NOT_FOUND | 0x800305 | 0x305 | Indicates that the task doesn't contain the necessary metadata to retry the download. |
IMA DAI Error Code
Error Code | Hexadecimal value | Component Error Code | Description |
---|---|---|---|
IMA_STREAM_MANAGER_INITIALIZATION_FAILURE | 0x41001 | 0x1001 | Indicates a failure when loading ads for IMA Server |
FLError Object
The Error object returned by the library is a linked list that traces the error occurrence from an higer-level component, to the lower-level component where the error actually occurred.
The Player component can talk to an internal component that in turn talks to head-end server. If the server returns an error-ful response, the Error
object returned from the player component might have internalError
property set to the error thrown
by the internal component which might actually be a server error information.
The more deeper we go in the linked list , the more specific the
Error
would be. It's upto the application developers to utilize the depth ofError
information as they desire.
public protocol FLError: Error {
/// The error code representing the error.
/// This code should be interpreted as combination of component and category error codes.
var errorCode: Int { get }
/// The description of the error.
var errorDescription: String { get }
/// The internal error if any.
var internalError: FLError? { get }
/// The contextual description of the error.
var contextualDescription: String? { get }
/// A computed property that returns the component error code
/// removing all CATEGORY MASK.
var componentErrorCode: Int { get }
}
Handling Player Error
Player errors could be observed through PlayerDelegate
callback playerDidFail(with error:)
. The delegate callback provides FLError
object which could be inspected for the cause and appropriate actions could be perform on the application eg. show alert or retry playback.
Playback failures caused by http status code network errors could be read as error.httpStatusCode
.
The following section shows how to handle HTTP status code failures featuring http status codes 403 and 471.
Read HTTP Status Code Errors
// Callback from the player for Playback errors
func playerDidFail(with error: FLError) {
// Read error code
let errorCode = error.errorCode
// Read hex error code
let hexErrorCode = error.hexErrorCode
// Read httpStatusCode
if let statusCode = error.httpStatusCode {
switch statusCode {
case 403:
// Handle 403
case 471:
// Handle 471
default:
// Other network status codes
}
}
}
Application may be required to perform retry for certain error codes which could take the form error.code
or error.httpStatusCode
. We recommend to use the above code snippet to read error codes and perform retry playbacks as appropriate.