Class: shaka.net.HttpFetchPlugin

A networking plugin to handle http and https URIs via the Fetch API.

Constructor

new HttpFetchPlugin()

A networking plugin to handle http and https URIs via the Fetch API.

Source:

Members

AbortController_ :function(new: AbortController)

Overridden in unit tests, but compiled out in production.
Type:
  • function(new: AbortController)
Source:

fetch_ :function(string, !RequestInit)

Overridden in unit tests, but compiled out in production.
Type:
  • function(string, !RequestInit)
Source:

Headers_ :function(new: Headers)

Overridden in unit tests, but compiled out in production.
Type:
  • function(new: Headers)
Source:

ReadableStream_ :function(new: ReadableStream, !Object)

Overridden in unit tests, but compiled out in production.
Type:
  • function(new: ReadableStream, !Object)
Source:

Methods

headersToGenericObject_(headersnon-null) → {Object.<string, string>}

Parameters:
Name Type Description
headers Headers
Source:
Returns:
Type
Object.<string, string>

isSupported() → {boolean}

Determine if the Fetch API is supported in the browser. Note: this is deliberately exposed as a method to allow the client app to use the same logic as Shaka when determining support.
Source:
Returns:
Type
boolean

parse(uri, request, requestType, progressUpdated, headersReceived) → {shaka.extern.IAbortableOperation.<shaka.extern.Response>}

Parameters:
Name Type Description
uri string
request shaka.extern.Request
requestType shaka.net.NetworkingEngine.RequestType
progressUpdated shaka.extern.ProgressUpdated Called when a progress event happened.
headersReceived shaka.extern.HeadersReceived Called when the headers for the download are received, but before the body is.
Source:
Returns:
Type
shaka.extern.IAbortableOperation.<shaka.extern.Response>

request_(uri, requestType, initnon-null, abortStatus, progressUpdated, headersReceived, streamDataCallbacknullable) → {Promise.<!shaka.extern.Response>}

Parameters:
Name Type Attributes Description
uri string
requestType shaka.net.NetworkingEngine.RequestType
init RequestInit
abortStatus shaka.net.HttpFetchPlugin.AbortStatus
progressUpdated shaka.extern.ProgressUpdated
headersReceived shaka.extern.HeadersReceived
streamDataCallback ?function(BufferSource):!Promise <nullable>
Source:
Returns:
Type
Promise.<!shaka.extern.Response>

Type Definitions

AbortStatus

Type:
  • {canceled: boolean, timedOut: boolean}
Properties:
Name Type Description
canceled boolean Indicates if the request was canceled.
timedOut boolean Indicates if the request timed out.
Source: