(iOS) Networking FAQ

1. How does the player handler error 4XX?

All HTTP failures are handled the same way.

What is a failure?

A request is considered to have failed if the HTTP response status code is not within the 200-299 range.

1.1 How can I handle specific errors then?

When using our Network API, status codes of requests or responses can be easily accessed.

Here is a practical example where we're extending a basic retry mechanism to also abort the retry when encountering a 410 (gone) status code:

networkConfig.retryHttpRequest = { requestType, retryCount, response, retryHandler, abortHandler in
    // Retry 3 times or until getting a 410
    guard response.status != 410, retryCount <= 3 else {
        // Abort retrying when threshold is reached
        abortHandler()
        return
    }

    // Customize delay for the next retry.
    // E.g. use exponential backoff:
    // https://en.wikipedia.org/wiki/Exponential_backoff
    let retryDelay: TimeInterval = exp(0.25 * Double(retryCount))

    // Retry the original request again
    retryHandler(retryDelay, response.request)
}

2. How many retries are done in case of HTTP errors?

The information about the default behaviour of the player can be found at the Customizing HTTP Request Retries page.

3. Is there any difference when fetching VOD and Live segments?

No, all requests are handled the same way through the Network API.

4. How do I process media segments?

Processing media segments is currently not supported. See Important Limitation.