Constructor
new FailoverUri(callback, urls, opt_startByteopt, opt_endByteopt, nullable)
Creates a FailoverUri, which handles requests to multiple URLs in case of
failure.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
callback |
shaka.util.FailoverUri.NetworkCallback | ||
urls |
Array.<!goog.Uri> | ||
opt_startByte |
number |
<optional> |
The start byte of the data, defaults to 0. |
opt_endByte |
number |
<optional> <nullable> |
The end byte of the data, null means the end; defaults to null. |
- Source:
Members
-
(private) callback_ :shaka.util.FailoverUri.NetworkCallback
-
Type:
- Source:
-
currentUrl :goog.Uri
-
Type:
- goog.Uri
- Source:
-
(constant, nullable) endByte :number
-
Type:
- number
- Source:
-
(private) request_ :shaka.util.AjaxRequest
-
Type:
- Source:
-
(private, nullable) requestPromise_ :Promise
-
Type:
- Promise
- Source:
-
(constant) startByte :number
-
Type:
- number
- Source:
-
(constant, non-null) urls :Array.<!goog.Uri>
-
Type:
- Array.<!goog.Uri>
- Source:
Methods
-
(static) resolve(baseUrl, urlnon-null) → (non-null) {Array.<!goog.Uri>}
-
Resolves a relative url to the given |baseUrl|.
Parameters:
Name Type Description baseUrl
Array.<!goog.Uri> url
goog.Uri - Source:
Returns:
- Type
- Array.<!goog.Uri>
-
abortFetch()
-
Aborts fetch() if it is pending.
- Source:
-
clone() → (non-null) {shaka.util.FailoverUri}
-
Creates a deep-copy of the object.
- Source:
Returns:
-
(private) createRequest_(i, parametersnon-null, opt_estimatoropt) → (non-null) {Promise.<(!ArrayBuffer|string)>}
-
Creates a request using the given url. This will add the catch block and will recursively call itself to handle failover.
Parameters:
Name Type Attributes Description i
number parameters
shaka.util.AjaxRequest.Parameters opt_estimator
shaka.util.IBandwidthEstimator <optional>
- Source:
Returns:
- Type
- Promise.<(!ArrayBuffer|string)>
-
fetch(opt_parametersopt, opt_estimatoropt) → (non-null) {Promise.<(!ArrayBuffer|string)>}
-
Gets the data specified by the URLs.
Parameters:
Name Type Attributes Description opt_parameters
shaka.util.AjaxRequest.Parameters <optional>
opt_estimator
shaka.util.IBandwidthEstimator <optional>
- Source:
Returns:
- Type
- Promise.<(!ArrayBuffer|string)>
-
isOfflineUri() → {boolean}
-
Gets whether the URI is offline (uses the scheme idb).
- Source:
Returns:
- Type
- boolean
-
toString() → (non-null) {string}
-
Gets the first url.
- Source:
Returns:
- Type
- string
Type Definitions
-
NetworkCallback
-
A callback to the application called prior to media network events. The first parameter is the URL for the request. The second parameter is the headers for the request. These can be modified. The callback should return a modified URL for the request, or null to use the original.
Type:
- ?function(string, !Object.<string, string>): (?string)
- Source: